| 1 |
|
| 2 |
|
| 3 |
name: CI |
| 4 |
on: |
| 5 |
push: |
| 6 |
branches: '*' |
| 7 |
tags: 'v[0-9]+.*' |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
pull_request: |
| 13 |
|
| 14 |
|
| 15 |
workflow_dispatch: |
| 16 |
inputs: |
| 17 |
debug_enabled: |
| 18 |
type: boolean |
| 19 |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' |
| 20 |
required: false |
| 21 |
default: false |
| 22 |
|
| 23 |
|
| 24 |
jobs: |
| 25 |
build: |
| 26 |
strategy: |
| 27 |
fail-fast: false |
| 28 |
matrix: |
| 29 |
platform: [ubuntu-latest, macos-latest, windows-latest] |
| 30 |
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
runs-on: ${{ matrix.platform }} |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
steps: |
| 40 |
|
| 41 |
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 42 |
|
| 43 |
- uses: actions/checkout@v5 |
| 44 |
with: |
| 45 |
submodules: recursive |
| 46 |
fetch-depth: 0 |
| 47 |
|
| 48 |
- uses: actions/setup-python@v6 |
| 49 |
with: |
| 50 |
python-version: ${{ matrix.python-version }} |
| 51 |
|
| 52 |
- uses: astral-sh/setup-uv@v7 |
| 53 |
with: |
| 54 |
enable-cache: false |
| 55 |
|
| 56 |
- uses: mxschmitt/action-tmate@v3 |
| 57 |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} |
| 58 |
|
| 59 |
|
| 60 |
- run: bash .ci/run |
| 61 |
env: |
| 62 |
|
| 63 |
CI_MYPY_COVERAGE: ${{ matrix.platform == 'ubuntu-latest' && '--cobertura-xml-report .coverage.mypy' || '' }} |
| 64 |
|
| 65 |
- if: matrix.platform == 'ubuntu-latest' |
| 66 |
uses: codecov/codecov-action@v5 |
| 67 |
with: |
| 68 |
fail_ci_if_error: true |
| 69 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 70 |
flags: mypy-${{ matrix.python-version }} |
| 71 |
files: .coverage.mypy/cobertura.xml |
| 72 |
|
| 73 |
|
| 74 |
pypi: |
| 75 |
|
| 76 |
|
| 77 |
if: github.event_name == 'push' && (startsWith(github.event.ref, 'refs/tags/') || (github.event.ref == format('refs/heads/{0}', github.event.repository.master_branch))) |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
needs: [build] |
| 82 |
|
| 83 |
runs-on: ubuntu-latest |
| 84 |
|
| 85 |
permissions: |
| 86 |
|
| 87 |
id-token: write |
| 88 |
|
| 89 |
steps: |
| 90 |
|
| 91 |
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 92 |
|
| 93 |
- uses: actions/checkout@v5 |
| 94 |
with: |
| 95 |
submodules: recursive |
| 96 |
fetch-depth: 0 |
| 97 |
|
| 98 |
- uses: actions/setup-python@v6 |
| 99 |
with: |
| 100 |
python-version: '3.10' |
| 101 |
|
| 102 |
- uses: astral-sh/setup-uv@v7 |
| 103 |
with: |
| 104 |
enable-cache: false |
| 105 |
|
| 106 |
- name: 'release to test pypi' |
| 107 |
|
| 108 |
if: github.event.ref == format('refs/heads/{0}', github.event.repository.master_branch) |
| 109 |
run: .ci/release-uv --use-test-pypi |
| 110 |
|
| 111 |
- name: 'release to prod pypi' |
| 112 |
|
| 113 |
if: startsWith(github.event.ref, 'refs/tags/') |
| 114 |
run: .ci/release-uv |