ci #1491
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: | |
# trigger if default branch contents change | |
push: | |
branches: [main, master] | |
# trigger on pull requests that target the default branch | |
pull_request: | |
branches: [main, master] | |
# allow triggering manually | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup variables | |
uses: ./.github/actions/setup-variables | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Install Python ${{ env.LOWEST_PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.LOWEST_PYTHON_VERSION }} | |
- name: Install Python dependencies | |
run: make dev.python | |
- name: Save cache base key for Python | |
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV | |
- name: Use pre-commit hook cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Install pre-commit hooks | |
run: make dev.hooks | |
- name: Run lint | |
run: make lint | |
test: | |
name: test / ${{ matrix.os }} / ${{ matrix.python-version }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { os: ubuntu-latest, python-version: '3.8' } | |
- { os: ubuntu-latest, python-version: '3.9' } | |
- { os: ubuntu-latest, python-version: '3.10' } | |
- { os: ubuntu-latest, python-version: '3.11' } | |
- { os: ubuntu-latest, python-version: '3.12' } | |
- { os: ubuntu-latest, python-version: '3.13' } | |
# - {os: macos-latest, python-version: '3.13'} | |
# - {os: windows-latest, python-version: '3.13'} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup variables | |
uses: ./.github/actions/setup-variables | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Install Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Python dependencies | |
run: make dev.python | |
- name: Run tests with coverage | |
run: make test.coverage | |
- name: Upload coverage data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-data-${{ matrix.os }}-${{ matrix.python-version }} | |
path: .coverage.* | |
include-hidden-files: true | |
coverage: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup variables | |
uses: ./.github/actions/setup-variables | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Install Python ${{ env.LOWEST_PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.LOWEST_PYTHON_VERSION }} | |
- run: uv pip install --upgrade coverage[toml] | |
- uses: actions/download-artifact@v4 | |
- name: Check for coverage threshold | |
run: | | |
python -m coverage combine coverage-data-* | |
python -m coverage html --skip-covered --skip-empty | |
python -m coverage report --fail-under=100 | |
- name: Upload coverage report if check failed | |
uses: actions/upload-artifact@v4 | |
with: | |
name: html-report | |
path: htmlcov | |
if: ${{ failure() }} | |
test-outdated: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup variables | |
uses: ./.github/actions/setup-variables | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Install Python ${{ env.LOWEST_PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.LOWEST_PYTHON_VERSION }} | |
- name: Install valid but outdated Python dependencies | |
run: make dev.python dev.python.outdated | |
- name: Run tests | |
run: make test | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup variables | |
uses: ./.github/actions/setup-variables | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Install Python ${{ env.LOWEST_PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.LOWEST_PYTHON_VERSION }} | |
- name: Install Python dependencies | |
run: make dev.python | |
- name: Build package (wheel) | |
run: make build | |
- name: Install package (wheel) | |
run: pip install dist/*.whl | |
- name: Run console smoke test (wheel) | |
run: myproject -h | |
- name: Uninstall (wheel) | |
run: make uninstall | |
- name: Install package (editable) | |
run: make install | |
- name: Run console smoke test (editable) | |
run: myproject -h | |
- name: Uninstall (editable) | |
run: make uninstall | |
- name: Install pipx | |
run: pip install pipx | |
- name: Install package (pipx) | |
run: pipx install . | |
- name: Run console smoke test (pipx) | |
run: myproject -h | |
- name: Uninstall (pipx) | |
run: pipx uninstall myproject | |
# --> | |
convert: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup variables | |
uses: ./.github/actions/setup-variables | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Install Python ${{ env.LOWEST_PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.LOWEST_PYTHON_VERSION }} | |
- name: Convert the template to a project | |
run: python -m magic --name="artproject" --author="Arthur" --email="arthur@example.com" | |
- name: Install Python dependencies | |
run: make dev.python dev.hooks | |
- name: Run tests | |
run: make test | |
- name: Run lint | |
run: make lint | |
- name: Install package | |
run: make install | |
- name: Smoke test console interface | |
run: artproject -h | |
# <-- |