ci: cache uv from pyproject #3
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: ci | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: {} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: test (py${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "**/pyproject.toml" | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Create venv + install package | |
| run: | | |
| uv venv --python ${{ matrix.python-version }} | |
| uv pip install -e ".[dev]" | |
| - name: Lint | |
| run: uv run ruff check blockference tests | |
| - name: Run tests with coverage | |
| run: uv run pytest --cov=blockference --cov-report=xml --cov-report=term | |
| - name: Smoke-run the full pipeline | |
| run: | | |
| uv run python -m blockference.simulations.grid_sim \ | |
| --pipeline configs/smoke.yml --run-name ci_smoke | |
| test -f output/ci_smoke/data/trajectory.csv | |
| test -f output/ci_smoke/animations/trajectory.gif | |
| test -f output/ci_smoke/validation_report.json | |
| - name: Upload coverage | |
| if: matrix.python-version == '3.11' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: coverage.xml | |
| if-no-files-found: ignore |