From 48e086b68a2201d69fe9077696b8c7a39a12aaed Mon Sep 17 00:00:00 2001 From: lochhh Date: Fri, 20 Sep 2024 10:58:00 +0100 Subject: [PATCH] Persist venv across job steps --- .github/workflows/build_env_run_tests.yml | 60 ++++------------------- 1 file changed, 9 insertions(+), 51 deletions(-) diff --git a/.github/workflows/build_env_run_tests.yml b/.github/workflows/build_env_run_tests.yml index bb11beff..6054202e 100644 --- a/.github/workflows/build_env_run_tests.yml +++ b/.github/workflows/build_env_run_tests.yml @@ -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: |