-
-
Notifications
You must be signed in to change notification settings - Fork 298
312 lines (285 loc) · 9.12 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
name: automated tests
on:
push: null
pull_request: null
schedule:
- cron: 0 0 * * *
jobs:
build:
outputs:
bin_ids: ${{ env.bin_ids }}
bins: ${{ env.bins }}
clients: ${{ env.clients }}
slow: ${{ env.slow }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 1
submodules: true
- name: get package version
run: echo "version="`jq -r .version package.json` >> $GITHUB_ENV
- name: cancel spurious build on tagged version
uses: andymckay/cancel-action@master
if: github.event.head_commit.message == env.version && !startsWith(github.ref,
'refs/tags/')
- name: install python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install packaging xvfbwrapper
pip install -r requirements.txt
- name: install node
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: install node packages
run: npm install && npm ls
- name: set slow/legacy/beta flags
run: ./util/action-flags
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: get previous test durations
run: curl -L
https://github.com/retorquere/zotero-better-bibtex/releases/download/builds/durations${{
env.slow }}.json --create-dirs -o test/balance/durations.json
- name: balance tests
id: balance
run: ./util/balance.py --durations test/balance/durations.json --bins test/balance/bins.json
--minutes 10 ${{ env.slow }} ${{ env.beta }} ${{ env.legacy }}
- name: build ${{ env.beta }} ${{ env.legacy }}
run: npm run build
env:
VERSION_WITH_ISSUE: false
- name: publish debug bridge
run: ./util/publish-debug-bridge.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: store build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
xpi/
gen/
test/balance/
retention-days: 1
site:
runs-on: ubuntu-latest
continue-on-error: true
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref,
'refs/tags/')) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 1
submodules: true
- name: install python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install packaging xvfbwrapper
pip install -r requirements.txt
- name: install node
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: install node packages
run: npm install && npm ls
- name: build site and install hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: latest
extended: true
- name: prepare docs for deploy
run: npm run docs:deploy
- name: deploy site
uses: peaceiris/actions-gh-pages@v4
if: ${{ success() }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site/public
test:
needs:
- build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
bin: ${{ fromJSON(needs.build.outputs.bin_ids) }}
client: ${{ fromJSON(needs.build.outputs.clients) }}
worker: [--worker, --no-worker]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 1
submodules: true
- name: fetch build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: install python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install packaging xvfbwrapper
pip install -r requirements.txt
- name: Set system-wide proxy using PAC URL
run: |
echo "auto_proxy=http://proxy-doc.ird.fr/proxy.pac" | sudo tee -a /etc/environment
echo "auto_proxy=http://proxy-doc.ird.fr/proxy.pac" >> $GITHUB_ENV
- name: Verify proxy settings
run: env | grep -i proxy
- name: install ${{ matrix.client }}
run: |
curl -sL https://raw.githubusercontent.com/retorquere/zotero-deb/master/install.sh | sudo bash
sudo apt-get update
sudo apt-get install ${{ matrix.client }}
sudo apt-get install mesa-utils xvfb
sudo apt-get install wmctrl xdotool
curl -LO https://github.com/jgm/pandoc/releases/download/3.1.11.1/pandoc-3.1.11.1-linux-amd64.tar.gz
tar xvzf pandoc-3.1.11.1-linux-amd64.tar.gz
sudo mv pandoc-3.1.11.1/bin/pandoc /usr/bin
pandoc -v
# preserve log hierarchy
mkdir stats
mkdir .stats
mktemp .stats/stats.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- name: Run tests
# continue-on-error: ${{ matrix.client == 'jurism' }}
run: ./test/behave --client ${{ matrix.client }} ${{ matrix.worker }} --format
ci --bin ${{ matrix.bin }} --bins ${{ needs.build.outputs.bins }} --durations
test/stats/durations--${{ matrix.client }}--${{ matrix.bin }}${{ matrix.worker
}}.json ${{ needs.build.outputs.slow }}
env:
PYTHONUNBUFFERED: true
- name: save log on failure
if: ${{ failure() || cancelled() }}
run: |
touch ~/.BBTTEST.log
cp ~/.BBTTEST.log ~/BBTTEST--${{ matrix.client }}--${{ matrix.bin }}${{ matrix.worker }}.txt
cp -r ~/.BBTTEST ~/BBTTEST
- name: upload log on failure
if: ${{ failure() || cancelled() }}
uses: actions/upload-artifact@v4
with:
name: debug-log--${{ matrix.client }}--${{ matrix.bin }}${{ matrix.worker
}}
path: |
~/BBTTEST*.txt
exported/
retention-days: 5
- name: store test artifacts
if: matrix.client == 'zotero' && matrix.worker == '--worker' && github.event_name
== 'push' && github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v4
with:
name: test-artifacts--${{ matrix.client }}--${{ matrix.bin }}${{ matrix.worker
}}
path: ./*/stats/durations*
retention-days: 2
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true
release:
if: github.event_name != 'schedule'
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 1
submodules: true
- name: fetch build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: install python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install packaging xvfbwrapper
pip install -r requirements.txt
- name: install node
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: install node packages
run: npm install && npm ls
- run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/github-script@v7
continue-on-error: true
with:
script: |
if (process.env.XPI_RELEASED) {
github.rest.issues.addLabels({
issue_number: parseInt(process.env.XPI_RELEASED),
owner: 'retorquere',
repo: 'zotero-better-bibtex',
labels: ['awaiting-user-feedback'],
})
}
durations:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs:
- build
- test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 1
submodules: true
- name: install python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install packaging xvfbwrapper
pip install -r requirements.txt
- name: fetch test artifacts
uses: actions/download-artifact@v4
with:
pattern: test-artifacts--*
merge-multiple: true
- name: collect test data
run: jq -s add test/stats/durations--*.json > test/stats/durations${{ needs.build.outputs.slow
}}.json
- name: Store build stats
run: |
gh release upload builds test/stats/durations${{ needs.build.outputs.slow }}.json --clobber --repo ${{ github.repository }}
env:
GH_TOKEN: ${{ github.token }}