|
6 | 6 | branches: '*' |
7 | 7 | tags: 'v[0-9]+.*' # only trigger on 'release' tags for PyPi |
8 | 8 | # Ideally I would put this in the pypi job... but github syntax doesn't allow for regexes there :shrug: |
9 | | - # P.S. fuck made up yaml DSLs. |
| 9 | + |
| 10 | + # Needed to trigger on others' PRs. |
10 | 11 | # Note that people who fork it need to go to "Actions" tab on their fork and click "I understand my workflows, go ahead and enable them". |
11 | | - pull_request: # needed to trigger on others' PRs |
12 | | - workflow_dispatch: # needed to trigger workflows manually |
13 | | - # todo cron? |
| 12 | + pull_request: |
| 13 | + |
| 14 | + # Needed to trigger workflows manually. |
| 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 | + schedule: |
| 24 | + - cron: '31 18 * * 5' # run every Friday |
14 | 25 |
|
15 | | -env: |
16 | | - # useful for scripts & sometimes tests to know |
17 | | - CI: true |
18 | 26 |
|
19 | 27 | jobs: |
20 | 28 | build: |
21 | 29 | strategy: |
| 30 | + fail-fast: false |
22 | 31 | matrix: |
23 | | - platform: [ubuntu-latest] |
24 | | - python-version: [3.7, 3.8, 3.9] |
| 32 | + platform: [ubuntu-latest, macos-latest, windows-latest] |
| 33 | + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 34 | + exclude: [ |
| 35 | + # windows runners are pretty scarce, so let's only run lowest and highest python version |
| 36 | + {platform: windows-latest, python-version: '3.10'}, |
| 37 | + {platform: windows-latest, python-version: '3.11'}, |
| 38 | + {platform: windows-latest, python-version: '3.12'}, |
| 39 | + |
| 40 | + # same, macos is a bit too slow and ubuntu covers python quirks well |
| 41 | + {platform: macos-latest , python-version: '3.10'}, |
| 42 | + {platform: macos-latest , python-version: '3.11'}, |
| 43 | + {platform: macos-latest , python-version: '3.12'}, |
| 44 | + ] |
25 | 45 |
|
26 | 46 | runs-on: ${{ matrix.platform }} |
27 | 47 |
|
| 48 | + # useful for 'optional' pipelines |
| 49 | + # continue-on-error: ${{ matrix.platform == 'windows-latest' }} |
| 50 | + |
28 | 51 | steps: |
29 | 52 | # ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation |
30 | 53 | - run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
31 | 54 |
|
32 | | - - uses: actions/setup-python@v1 |
| 55 | + - uses: actions/checkout@v4 |
33 | 56 | with: |
34 | | - python-version: ${{ matrix.python-version }} |
| 57 | + submodules: recursive |
| 58 | + fetch-depth: 0 # nicer to have all git history when debugging/for tests |
35 | 59 |
|
36 | | - - uses: actions/checkout@v2 |
| 60 | + - uses: actions/setup-python@v5 |
37 | 61 | with: |
38 | | - submodules: recursive |
| 62 | + python-version: ${{ matrix.python-version }} |
| 63 | + |
| 64 | + - uses: astral-sh/setup-uv@v5 |
| 65 | + with: |
| 66 | + enable-cache: false # we don't have lock files, so can't use them as cache key |
39 | 67 |
|
40 | | - # uncomment for SSH debugging |
41 | | - # - uses: mxschmitt/action-tmate@v2 |
| 68 | + - uses: mxschmitt/action-tmate@v3 |
| 69 | + if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} |
42 | 70 |
|
43 | | - - run: .ci/run |
| 71 | + # explicit bash command is necessary for Windows CI runner, otherwise it thinks it's cmd... |
| 72 | + - run: bash .ci/run |
| 73 | + env: |
| 74 | + # only compute lxml coverage on ubuntu; it crashes on windows |
| 75 | + CI_MYPY_COVERAGE: ${{ matrix.platform == 'ubuntu-latest' && '--cobertura-xml-report .coverage.mypy' || '' }} |
44 | 76 |
|
45 | | - - uses: actions/upload-artifact@v2 |
| 77 | + - if: matrix.platform == 'ubuntu-latest' # no need to compute coverage for other platforms |
| 78 | + uses: codecov/codecov-action@v5 |
46 | 79 | with: |
47 | | - name: .coverage.mypy |
48 | | - path: .coverage.mypy/ |
49 | | - # restrict to a single python version, otherwise uploading fails |
50 | | - if: ${{ matrix.python-version == '3.8' }} |
| 80 | + fail_ci_if_error: true # default false |
| 81 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 82 | + flags: mypy-${{ matrix.python-version }} |
| 83 | + files: .coverage.mypy/cobertura.xml |
| 84 | + |
0 commit comments