Skip to content

Commit

Permalink
Persist venv across job steps
Browse files Browse the repository at this point in the history
  • Loading branch information
lochhh committed Sep 20, 2024
1 parent 2ac9b00 commit 48e086b
Showing 1 changed file with 9 additions and 51 deletions.
60 changes: 9 additions & 51 deletions .github/workflows/build_env_run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,60 +35,18 @@ jobs:
pip install -e .[dev]
pip list
python -c "import aeon"
build_env_run_tests: # checks for building env using mamba and runs codebase checks and tests
name: Build env and run tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
if: github.event.pull_request.draft == false
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.11]
fail-fast: false
defaults:
run:
shell: ${{ matrix.os == 'windows-latest' && 'cmd' || 'bash' }} -l {0}
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up conda env (Linux, Windows)
if: ${{ matrix.os != 'macos-latest' }}
uses: conda-incubator/setup-miniconda@v3
with:
use-mamba: true
miniforge-variant: Mambaforge
python-version: ${{ matrix.python-version }}
activate-environment: aeon

- name: Set up conda env (macOS)
if: ${{ matrix.os == 'macos-latest' }}
uses: conda-incubator/setup-miniconda@v2
with:
use-mamba: true
miniforge-variant: Mambaforge
python-version: ${{ matrix.python-version }}
activate-environment: aeon
architecture: arm64
miniconda-version: "latest"

- name: Install datajoint wheel build with pip flag (macOS)
if: ${{ matrix.os == 'macos-latest' }}
run: pip install --use-pep517 datajoint git+https://github.com/datajoint-company/datajoint-utilities.git

- name: Install pyproject.toml dependencies
run: pip install -e .[dev]

# Run codebase checks and tests
- name: Activate venv for later steps
run: |
echo "VIRTUAL_ENV=$(pwd)/.venv" >> $GITHUB_ENV
echo "$(pwd)/.venv/bin" >> $GITHUB_PATH # For Unix-like systems
echo "$(pwd)/.venv/Scripts" >> $GITHUB_PATH # For Windows
# Only run codebase checks and tests for Linux (ubuntu).
- name: ruff
run: python -m ruff check .

run: ruff check .
- name: pyright
run: python -m pyright --level error --project ./pyproject.toml .

run: pyright --level error --project ./pyproject.toml .
- name: pytest
run: python -m pytest tests/ --ignore=tests/dj_pipeline

run: pytest tests/ --ignore=tests/dj_pipeline
- name: generate test coverage report
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
Expand Down

0 comments on commit 48e086b

Please sign in to comment.