use uv to download requirements and cache (#18) #79
This file contains hidden or 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: pytest | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| pytest: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
| include: | |
| - os: ubuntu-latest | |
| uv-cache: ~/.cache/uv | |
| - os: macos-latest | |
| uv-cache: ~/Library/Caches/uv | |
| env: | |
| OS: ${{ matrix.os }} | |
| PYTHON: ${{ matrix.python-version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache uv cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ matrix.uv-cache }} | |
| key: ${{ runner.os }}-uv-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-uv- | |
| ${{ runner.os }}- | |
| - name: Install dependencies using uv | |
| run: | | |
| pip install uv | |
| uv venv | |
| source .venv/bin/activate | |
| uv pip install coverage pytest pytest-cov | |
| uv pip install ".[dev]" | |
| uv pip list | |
| - name: Run Tests | |
| run: | | |
| source .venv/bin/activate | |
| coverage erase | |
| coverage run -m pytest | |
| - name: Generate Coverage Report | |
| run: | | |
| source .venv/bin/activate | |
| coverage report -m -i | |
| coverage xml -i | |
| - name: Upload Coverage to Codecov | |
| if: runner.os != 'macOS' | |
| uses: codecov/codecov-action@v1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: ./coverage.xml | |
| flags: unittests | |
| env_vars: OS,PYTHON | |
| name: codecov-umbrella | |
| fail_ci_if_error: false |