Configure uv to use git commits and tags in cache key #13
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: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
env: | |
FORCE_COLOR: "1" | |
PIP_DISABLE_PIP_VERSION_CHECK: "1" | |
PIP_NO_PYTHON_VERSION_WARNING: "1" | |
jobs: | |
run-checks: | |
name: Run linter and tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- name: Set up Python 🐍 | |
uses: actions/setup-python@v5 | |
with: | |
cache: pip | |
- name: Install dependencies 📦️ | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements/requirements-dev.txt | |
pip install -e . | |
- name: Lint 🧹 | |
run: ruff check | |
- name: Run tests 🧪 | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements/requirements-dev.txt | |
pip install -e . | |
coverage run -m pytest | |
- name: Upload coverage data 📤 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: .coverage | |
include-hidden-files: true | |
if-no-files-found: ignore | |
coverage: | |
# https://hynek.me/articles/ditch-codecov-python/ | |
name: Generate coverage report | |
runs-on: ubuntu-latest | |
needs: run-checks | |
if: always() | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up Python 🐍 | |
uses: actions/setup-python@v5 | |
with: | |
cache: pip | |
- name: Install uv 🌟 | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: ">=0.0.1" | |
- name: Download coverage data 📥 | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage | |
merge-multiple: true | |
- name: Generate coverage report 📊 | |
run: | | |
uv tool install coverage | |
coverage html --skip-covered --skip-empty | |
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY | |
# Generate report again, this time with a fail-under threshold | |
coverage report --fail-under=80 | |
- name: Upload HTML report if coverage check fails | |
uses: actions/upload-artifact@v4 | |
with: | |
name: html-cov-report | |
path: htmlcov | |
if: ${{ failure() }} | |