chore(deps): update dependency deptry to v0.21.2 #275
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: Test | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
PYTHON_VERSION: "3.12" | |
UV_VERSION: "0.5.x" | |
UV_FROZEN: "1" | |
UV_NO_SYNC: "1" | |
jobs: | |
ruff: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Extract Ruff version from pyproject.toml | |
id: extract-ruff-version | |
run: | | |
echo "ruff_version=$(python -c "import tomllib;f=open('pyproject.toml', 'rb');print(next(iter(version.strip() for package, version in (dep.split('==') for dep in tomllib.load(f)['tool']['uv']['dev-dependencies'] if '==' in dep) if package.strip() == 'ruff')));f.close()")" >> "$GITHUB_OUTPUT" | |
- uses: chartboost/ruff-action@v1 | |
with: | |
version: ${{ steps.extract-ruff-version.outputs.ruff_version }} | |
mypy: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.13", "3.12", "3.11", "3.10", "3.9"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: ${{ env.UV_VERSION }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install the project | |
run: uv sync --no-dev --group typing | |
- name: Run mypy | |
run: uv run -- mypy . | |
build-docs: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: ${{ env.UV_VERSION }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install the project | |
run: uv sync --no-dev --group docs | |
- name: Build docs | |
run: uv run -- mkdocs build | |
pytest: | |
if: github.event.pull_request.draft == false | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ["3.13", "3.12", "3.11", "3.10", "3.9"] | |
# Python 3.8 & 3.9 are on macos-13 but not macos-latest (macos-14-arm64) | |
# https://github.com/actions/setup-python/issues/696#issuecomment-1637587760 | |
exclude: | |
- os: macos-latest | |
python-version: "3.9" | |
include: | |
- os: macos-13 | |
python-version: "3.9" | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python-version }} | |
COVERAGE_FILE: .coverage.${{ matrix.os }}-${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: ${{ env.UV_VERSION }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install the project | |
run: uv sync --no-dev --group testing | |
- name: Run pytest | |
run: uv run -- coverage run --source=./capsula -m pytest ./tests --import-mode importlib | |
- name: Generate coverage report | |
run: | | |
uv run -- coverage report -m | |
uv run -- coverage xml -o ./coverage.xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
files: coverage.xml | |
env_vars: OS,PYTHON | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
collect: | |
if: github.event.pull_request.draft == false | |
needs: [ruff, mypy, build-docs, pytest] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Collect results | |
run: echo "All checks passed!" |