Debian Codegraph @

.github/workflows/ci.yml

raw
1 name: Continuous Integration
2
3 on:
4 push:
5 branches: [master]
6 pull_request:
7 branches: [master]
8
9 env:
10 PYTHON_DEFAULT_VERSION: "3.12"
11
12 jobs:
13 lint:
14 runs-on: ubuntu-latest
15 steps:
16 - uses: actions/checkout@v4
17 with:
18 fetch-depth: 0
19 - uses: codespell-project/actions-codespell@2391250ab05295bddd51e36a8c6295edb6343b0e
20 with:
21 ignore_words_list: datas re-use
22 - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
23 uses: actions/setup-python@v5
24 with:
25 python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
26 - name: Install dependencies
27 run: python -m pip install --upgrade nox pdm
28 - name: Run linters
29 run: nox -vs lint
30 - name: Validate new changelog entries
31 if: (contains(github.event.pull_request.labels.*.name, '-changelog') == false) && (github.event.pull_request.base.ref != '')
32 run: if [ -z "$(git diff --diff-filter=A --name-only origin/${{ github.event.pull_request.base.ref }} changelog.d)" ];
33 then echo no changelog item added; exit 1; fi
34 - name: Changelog validation
35 run: nox -vs towncrier_check
36 build:
37 needs: lint
38 runs-on: ubuntu-latest
39 steps:
40 - uses: actions/checkout@v4
41 with:
42 fetch-depth: 0
43 - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
44 uses: actions/setup-python@v5
45 with:
46 python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
47 - name: Install dependencies
48 run: python -m pip install --upgrade nox pdm
49 - name: Build the distribution
50 run: nox -vs build
51 cleanup_buckets:
52 needs: lint
53 env:
54 B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
55 B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
56 runs-on: ubuntu-latest
57 steps:
58 - uses: actions/checkout@v4
59 if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
60 with:
61 fetch-depth: 0
62 - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
63 if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
64 uses: actions/setup-python@v5
65 with:
66 python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
67 cache: "pip"
68 - name: Install dependencies
69 if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
70 run: python -m pip install --upgrade nox pdm
71 - name: Find and remove old buckets
72 if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
73 run: nox -vs cleanup_buckets
74 test:
75 needs: cleanup_buckets
76 env:
77 B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
78 B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
79 runs-on: ${{ matrix.os }}
80 strategy:
81 fail-fast: false
82 matrix:
83 os: ["ubuntu-latest", "macos-latest", "windows-latest"]
84 python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"]
85 exclude:
86 - os: "macos-latest"
87 python-version: "pypy3.10"
88 - os: "windows-latest"
89 python-version: "pypy3.10"
90 # Workaround for https://github.com/actions/setup-python/issues/696
91 - os: "macos-latest"
92 python-version: 3.7
93 - os: "macos-latest"
94 python-version: 3.8
95 - os: "macos-latest"
96 python-version: 3.9
97 include:
98 # Workaround for https://github.com/actions/setup-python/issues/696
99 - os: "macos-13"
100 python-version: 3.7
101 - os: "macos-13"
102 python-version: 3.8
103 - os: "macos-13"
104 python-version: 3.9
105 steps:
106 - uses: actions/checkout@v4
107 with:
108 fetch-depth: 0
109 - name: Set up Python ${{ matrix.python-version }}
110 uses: actions/setup-python@v5
111 with:
112 python-version: ${{ matrix.python-version }}
113 - name: Install test binary dependencies
114 if: startsWith(matrix.os, 'ubuntu')
115 run: |
116 sudo apt-get -y update
117 sudo apt-get -y install zsh fish
118 sudo chmod -R 755 /usr/share/zsh/vendor-completions /usr/share/zsh # Fix permissions for zsh completions
119 - name: Install test binary dependencies (macOS)
120 if: startsWith(matrix.os, 'macos')
121 run: |
122 brew install fish
123 - name: Install dependencies
124 run: python -m pip install --upgrade nox pdm
125 - name: Run unit tests
126 run: nox -vs unit -p ${{ matrix.python-version }}
127 - name: Run integration tests (without secrets)
128 run: nox -vs integration -p ${{ matrix.python-version }} -- -m "not require_secrets"
129 - name: Run integration tests (with secrets)
130 # Limit CI workload by running integration tests with secrets only on edge Python versions.
131 if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' && contains(fromJSON('["3.7", "pypy3.10", "3.12"]'), matrix.python-version) }}
132 run: nox -vs integration -p ${{ matrix.python-version }} -- -m "require_secrets" --cleanup
133 test-docker:
134 needs: cleanup_buckets
135 env:
136 B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
137 B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
138 runs-on: ubuntu-latest
139 steps:
140 - uses: actions/checkout@v4
141 with:
142 fetch-depth: 0
143 - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
144 uses: actions/setup-python@v5
145 with:
146 python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
147 - name: Install dependencies
148 run: sudo python -m pip install --upgrade nox pdm
149 - name: Generate Dockerfile
150 run: nox -vs generate_dockerfile
151 - name: Set up QEMU
152 uses: docker/setup-qemu-action@v3
153 - name: Set up Docker Buildx
154 uses: docker/setup-buildx-action@v3
155 - name: Build Docker
156 uses: docker/build-push-action@v5
157 with:
158 context: .
159 load: true
160 tags: backblazeit/b2:test
161 platforms: linux/amd64
162 - name: Run tests with docker
163 if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
164 run: nox -vs docker_test -- backblazeit/b2:test
165 test-linux-bundle:
166 needs: cleanup_buckets
167 env:
168 B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
169 B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
170 runs-on: ubuntu-latest
171 container:
172 image: "python:3.12" # can not use ${{ env.PYTHON_DEFAULT_VERSION }} here
173 env:
174 DEBIAN_FRONTEND: noninteractive
175 steps:
176 - uses: actions/checkout@v4
177 with:
178 fetch-depth: 0
179 - name: Install dependencies
180 run: |
181 apt-get -y update
182 apt-get -y install patchelf
183 python -m pip install --upgrade nox pdm
184 git config --global --add safe.directory '*'
185 - name: Bundle the distribution
186 id: bundle
187 run: nox -vs bundle
188 - name: Generate hashes
189 id: hashes
190 run: nox -vs make_dist_digest
191 - name: Run integration tests (without secrets)
192 run: nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "not require_secrets"
193 - name: Run integration tests (with secrets)
194 if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
195 run: nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "require_secrets" --cleanup
196 - name: Upload assets
197 if: failure()
198 uses: actions/upload-artifact@v2
199 with:
200 path: ${{ steps.bundle.outputs.asset_path }}
201 if-no-files-found: warn
202 retention-days: 7
203 test-windows-bundle:
204 needs: cleanup_buckets
205 env:
206 B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
207 B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
208 runs-on: ${{ matrix.os }}
209 strategy:
210 fail-fast: false
211 matrix:
212 os: [windows-2019, windows-latest]
213 steps:
214 - uses: actions/checkout@v4
215 with:
216 fetch-depth: 0
217 - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
218 uses: actions/setup-python@v5
219 with:
220 python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
221 - name: Install dependencies
222 run: python -m pip install --upgrade nox pdm
223 - name: Bundle the distribution
224 id: bundle
225 shell: bash
226 run: nox -vs bundle
227 - name: Generate hashes
228 id: hashes
229 run: nox -vs make_dist_digest
230 - name: Run integration tests (without secrets)
231 run: nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "not require_secrets"
232 - name: Run integration tests (with secrets)
233 if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
234 run: nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "require_secrets" --cleanup
235 - name: Upload assets
236 if: failure()
237 uses: actions/upload-artifact@v2
238 with:
239 path: ${{ steps.bundle.outputs.asset_path }}
240 if-no-files-found: warn
241 retention-days: 7
242 doc:
243 needs: build
244 runs-on: ubuntu-latest
245 steps:
246 - uses: actions/checkout@v4
247 with:
248 fetch-depth: 0
249 - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
250 uses: actions/setup-python@v5
251 with:
252 python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
253 - name: Install dependencies
254 env:
255 DEBIAN_FRONTEND: noninteractive
256 run: |
257 sudo apt-get update -y
258 sudo apt-get install -y graphviz plantuml
259 python -m pip install --upgrade nox pdm
260 - name: Build the docs
261 run: nox --non-interactive -vs doc