Refactor tests to reduce creation of venvs for speed #295
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: ['main'] | |
pull_request: | |
jobs: | |
tests: | |
runs-on: ${{ matrix.os }} | |
env: | |
PYTHONIOENCODING: utf-8 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup git user config | |
run: | | |
git config --global user.name placeholder | |
git config --global user.email placeholder@example.com | |
- name: Set up uv | |
uses: astral-sh/setup-uv@e779db74266a80753577425b0f4ee823649f251d # v3.2.3 | |
with: | |
version: "latest" | |
- name: Set up Python | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup dependencies | |
run: | | |
uv export --resolution ${{ matrix.resolution }} > requirements.txt | |
uv pip install --system --break-system-packages -r requirements.txt | |
- name: Run pre-commit | |
if: matrix.pre-commit | |
run: | | |
uv run --frozen pre-commit run --all-files | |
- name: Run pytest | |
uses: pavelzw/pytest-action@510c5e90c360a185039bea56ce8b3e7e51a16507 # v2.2.0 | |
with: | |
custom-arguments: --cov --junitxml=junit.xml -o junit_family=legacy | |
- name: Run benchmarks | |
uses: CodSpeedHQ/action@513a19673a831f139e8717bf45ead67e47f00044 # v3.2.0 | |
if: matrix.codspeed | |
with: | |
token: ${{ secrets.CODSPEED_TOKEN }} | |
run: pytest --codspeed | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1 | |
if: matrix.codecov | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload test results to Codecov | |
uses: codecov/test-results-action@44ecb3a270cd942bdf0fa8f2ce14cb32493e810a # v1.0.3 | |
if: matrix.codecov && !cancelled() | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
python-version: ["3.10", "3.11", "3.12", "3.13"] | |
resolution: ["highest"] | |
codspeed: [false] | |
codecov: [false] | |
pre-commit: [false] | |
include: | |
- os: "ubuntu-latest" | |
python-version: "3.10" | |
resolution: "lowest-direct" | |
codspeed: false | |
codecov: false | |
pre-commit: false | |
- os: "ubuntu-latest" | |
python-version: "3.13" | |
resolution: "highest" | |
codspeed: true | |
codecov: true | |
pre-commit: true |