Debian Codegraph @

.github/workflows/main.yml

raw
1 name: CI
2
3 on:
4 push:
5 branches: ["main"]
6 pull_request:
7
8 concurrency:
9 group: ci-${{ github.ref }}
10 cancel-in-progress: true
11
12 defaults:
13 run:
14 shell: bash -eux {0}
15
16 env:
17 HATCH_ENV: "cov"
18
19 jobs:
20 check_release:
21 runs-on: ubuntu-latest
22 env:
23 HATCH_ENV: ""
24 steps:
25 - uses: actions/checkout@v4
26 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
27 - uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
28 with:
29 token: ${{ secrets.GITHUB_TOKEN }}
30
31 check_links:
32 runs-on: ubuntu-latest
33 steps:
34 - uses: actions/checkout@v4
35 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
36 - uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
37
38 test:
39 runs-on: ${{ matrix.os }}
40 timeout-minutes: 20
41
42 strategy:
43 fail-fast: false
44 matrix:
45 os: [ubuntu-latest, windows-latest, macos-latest]
46 python-version:
47 - "3.10"
48 - "3.14"
49 - "3.14t"
50 include:
51 - os: windows-latest
52 python-version: "3.12"
53 - os: ubuntu-latest
54 python-version: "pypy-3.11"
55 - os: ubuntu-latest
56 python-version: "3.11"
57 - os: macos-latest
58 python-version: "3.10"
59 steps:
60 - uses: actions/checkout@v4
61 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
62
63 - name: disable warnings on pypy or windows
64 if: ${{ startsWith(matrix.python-version, 'pypy') || startsWith(matrix.os, 'windows') }}
65 run: |
66 echo "PYTEST_ADDOPTS=${PYTEST_ADDOPTS:-} -W default" >> $GITHUB_ENV
67
68 - name: disable coverage on pypy
69 if: ${{ startsWith(matrix.python-version, 'pypy') }}
70 run: |
71 echo "HATCH_ENV=test" >> $GITHUB_ENV
72
73 - name: show env
74 run: |
75 hatch -e ${HATCH_ENV} run python -VV
76 hatch -e ${HATCH_ENV} run pip freeze
77
78 - name: Run the tests
79 run: |
80 hatch run ${HATCH_ENV}:test
81 env:
82 PYTHONTRACEMALLOC: "10"
83
84 - uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1
85
86 coverage:
87 runs-on: ubuntu-latest
88 needs:
89 - test
90 steps:
91 - uses: actions/checkout@v4
92 - uses: jupyterlab/maintainer-tools/.github/actions/report-coverage@v1
93 with:
94 fail_under: 78
95
96 docs:
97 runs-on: ubuntu-latest
98 steps:
99 - uses: actions/checkout@v4
100 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
101 - name: Build API docs
102 run: |
103 hatch run docs:api
104 # If this fails run `hatch run docs:api` locally
105 # and commit.
106 git status --porcelain
107 if git status -s | grep "^\s*[AM]"; then
108 exit 1
109 fi
110 echo "API docs done"
111 - run: hatch run docs:build
112
113 lint:
114 name: Test Lint
115 runs-on: ubuntu-latest
116 steps:
117 - uses: actions/checkout@v4
118 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
119 - name: Run Linters
120 run: |
121 hatch run typing:test
122 hatch run lint:build
123 pipx run interrogate -v .
124 pipx run doc8 --max-line-length=200 --ignore-path=docs/source/other/full-config.rst
125
126 test_minimum_verisons:
127 name: Test Minimum Versions
128 runs-on: ubuntu-latest
129 timeout-minutes: 20
130 steps:
131 - uses: actions/checkout@v4
132 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
133 with:
134 dependency_type: minimum
135 python_version: "3.10"
136
137 - name: show env
138 run: |
139 hatch -e test run python -VV
140 hatch -e test run pip freeze
141
142 - name: Run the unit tests
143 run: |
144 hatch -vv run test:nowarn
145
146 - name: Run the unit tests with orjson installed
147 run: |
148 hatch -e test run pip install orjson
149 hatch -vv run test:nowarn
150
151 test_prereleases:
152 name: Test Prereleases
153 timeout-minutes: 10
154 runs-on: ubuntu-latest
155 steps:
156 - uses: actions/checkout@v4
157 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
158 with:
159 dependency_type: pre
160 - name: Run the tests
161 run: |
162 hatch run test:nowarn
163
164 make_sdist:
165 name: Make SDist
166 runs-on: ubuntu-latest
167 timeout-minutes: 10
168 steps:
169 - uses: actions/checkout@v4
170 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
171 - uses: jupyterlab/maintainer-tools/.github/actions/make-sdist@v1
172
173 test_sdist:
174 runs-on: ubuntu-latest
175 needs: [make_sdist]
176 name: Install from SDist and Test
177 timeout-minutes: 20
178 steps:
179 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
180 - uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1
181 with:
182 test_command: pytest -vv
183
184 tests_check: # This job does nothing and is only used for the branch protection
185 if: always()
186 needs:
187 - coverage
188 - docs
189 - lint
190 - check_links
191 - test_minimum_verisons
192 - test_prereleases
193 - test_sdist
194 runs-on: ubuntu-latest
195 steps:
196 - name: Decide whether the needed jobs succeeded or failed
197 uses: re-actors/alls-green@release/v1
198 with:
199 jobs: ${{ toJSON(needs) }}