From 1a0a2ef27702a1dc044f0512ff830e08327c7d5d Mon Sep 17 00:00:00 2001 From: Dave Hall Date: Sun, 11 Feb 2024 09:07:16 +0000 Subject: [PATCH] Activating venv in CI (#100) This avoids requiring repetitive `poetry run` usage, and slightly speed up steps. It might make #99 work too. --- .github/actions/setup/action.yml | 6 ++++++ .github/workflows/build.yml | 16 ++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 9be50f30..9d3cea05 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -16,3 +16,9 @@ runs: shell: bash - run: poetry check --lock shell: bash + # Activate venv. + - run: | + VIRTUAL_ENV=$(poetry env info --path) + echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV + echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH + shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f83073b6..e7e77c9b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,17 +44,17 @@ jobs: - name: Install dependencies run: poetry install --no-root --all-extras - name: Install lib versions - run: poetry run pip install -e .[pytest,trio] ${{ matrix.lib-versions }} + run: pip install -e .[pytest,trio] ${{ matrix.lib-versions }} # Run checks. - name: Check (ruff) - run: poetry run ruff check + run: ruff check - name: Check (ruff format) - run: poetry run ruff format --check + run: ruff format --check - name: Check (mypy) - run: poetry run mypy + run: mypy # Run tests. - name: Test - run: poetry run coverage run -m pytest + run: coverage run -m pytest # Upload coverage. - name: Upload coverage uses: actions/upload-artifact@v4 @@ -74,7 +74,7 @@ jobs: run: poetry install --all-extras --only main --only docs # Build docs. - name: Build docs - run: poetry run sphinx-build -W docs docs/_build + run: sphinx-build -W docs docs/_build report: runs-on: ubuntu-latest @@ -97,9 +97,9 @@ jobs: pattern: .coverage.* merge-multiple: true - name: Combine coverage - run: poetry run coverage combine .coverage.* + run: coverage combine .coverage.* - name: Report coverage - run: poetry run coverage report + run: coverage report # Fail if any `needs` job was not a success. # Along with `if: always()`, this allows this job to act as a single required status check for the entire workflow. - name: Fail on workflow error