Use virtualenv for CI jobs
- Replaces system-wide installs with virtualenv for CI jobs. - Improves dependency isolation and reproducibility. - Sets up a virtualenv in each job. - Activates the virtualenv before running commands. - Installs dependencies within the virtualenv.
This commit is contained in:
parent
16837fb6fe
commit
a1307e9223
@ -7,7 +7,7 @@ on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@ -17,9 +17,15 @@ jobs:
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Lint with ruff and mypy
|
||||
- name: Set up virtualenv
|
||||
run: |
|
||||
uv pip install --system ruff mypy
|
||||
uv venv .venv
|
||||
source .venv/bin/activate
|
||||
uv pip install ruff mypy
|
||||
|
||||
- name: Run Ruff & Mypy
|
||||
run: |
|
||||
source .venv/bin/activate
|
||||
uv run ruff check
|
||||
uv run ruff format --check
|
||||
uv run mypy .
|
||||
@ -34,9 +40,15 @@ jobs:
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Run tests
|
||||
- name: Set up virtualenv
|
||||
run: |
|
||||
uv pip install --system pytest coverage
|
||||
uv venv .venv
|
||||
source .venv/bin/activate
|
||||
uv pip install pytest coverage
|
||||
|
||||
- name: Run Tests
|
||||
run: |
|
||||
source .venv/bin/activate
|
||||
uv run pytest -v --cov=. --cov-report=xml
|
||||
|
||||
- name: Upload to Codecov
|
||||
|
Loading…
x
Reference in New Issue
Block a user