-
Notifications
You must be signed in to change notification settings - Fork 2
/
.drone.yml
518 lines (473 loc) · 11.8 KB
/
.drone.yml
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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
---
kind: pipeline
type: docker
name: Build and check
platform:
os: linux
arch: amd64
steps:
- name: Prepare
image: archlinux/archlinux:base-devel
volumes:
- name: pkgcache
path: /var/cache/pacman/pkg
- name: pkgdb
path: /var/lib/pacman/sync
commands:
- source tools/build-env.sh
- run_nobody tools/prepare-build.sh namcap diffoscope openssh unzip
- name: Generate package list
image: archlinux/archlinux:base-devel
commands:
- source tools/build-env.sh
- run_nobody tools/gen-packagelist.sh
when:
ref:
include:
- refs/heads/master
- name: Analyze build scripts
image: archlinux/archlinux:base-devel
volumes:
- name: pkgcache
path: /var/cache/pacman/pkg
- name: pkgdb
path: /var/lib/pacman/sync
commands:
- pacman -Sy && pacman-key --init && pacman -S --noconfirm archlinux-keyring
- pacman -Syu --noconfirm namcap
- if [ -n "$PACKAGE" ]; then
namcap packages/$PACKAGE/PKGBUILD;
else namcap packages/*/PKGBUILD; fi
depends_on:
- Prepare
- name: Build packages
image: archlinux/archlinux:base-devel
volumes:
- name: pkgcache
path: /var/cache/pacman/pkg
- name: pkgdb
path: /var/lib/pacman/sync
environment:
SRCDEST: /drone/src/.tmp/cache/srcdest
PKGDEST: /drone/src/out
commands:
- source tools/build-env.sh
- pacman -Sy && pacman-key --init && pacman -S --noconfirm archlinux-keyring && pacman -Syu --noconfirm
- pacman --noconfirm -U https://archive.archlinux.org/packages/f/fakeroot/fakeroot-1.34-1-x86_64.pkg.tar.zst
- run_nobody tools/clean-build-all.sh
- if ls -1 out/*-debug-*$PKGEXT 2>/dev/null 1>&2; then
mv out/*-debug-*$PKGEXT out-debug/; fi
depends_on:
- Prepare
- name: List built packages
image: alpine:3.15
commands:
- ls -1 out/
- ls -1 out-debug/
depends_on:
- Build packages
when:
status:
- success
- failure
- name: Analyze built packages
image: archlinux/archlinux:base-devel
volumes:
- name: pkgcache
path: /var/cache/pacman/pkg
- name: pkgdb
path: /var/lib/pacman/sync
commands:
- source tools/build-env.sh
- pacman -Sy && pacman-key --init && pacman -S --noconfirm archlinux-keyring
- pacman -Syu --noconfirm namcap
- cd out
- if ls -1 *$PKGEXT 2>/dev/null 1>&2; then namcap *$PKGEXT; fi
depends_on:
- Build packages
when:
status:
- success
- failure
- name: Reproduce packages
image: archlinux/archlinux:base-devel
volumes:
- name: pkgcache
path: /var/cache/pacman/pkg
- name: pkgdb
path: /var/lib/pacman/sync
environment:
SRCDEST: /drone/src/.tmp/cache/srcdest
PKGDEST: /drone/src/out2
commands:
- sleep 9 # backoff to prevent false positives
- source ./tools/build-env.sh
- pacman -Sy && pacman-key --init && pacman -S --noconfirm archlinux-keyring && pacman -Syu --noconfirm
- pacman --noconfirm -U https://archive.archlinux.org/packages/f/fakeroot/fakeroot-1.34-1-x86_64.pkg.tar.zst
- run_nobody tools/clean-build-all.sh
depends_on:
- Prepare
- name: Check reproduced checksums
image: archlinux/archlinux:base-devel
commands:
- source ./tools/build-env.sh
- run_nobody ./tools/compare-checksums.sh
depends_on:
- Build packages
- Reproduce packages
when:
status:
- success
- failure
- name: Analyze reproduced packages
image: archlinux/archlinux:base-devel
volumes:
- name: pkgcache
path: /var/cache/pacman/pkg
- name: pkgdb
path: /var/lib/pacman/sync
commands:
- source tools/build-env.sh
- pacman -Sy && pacman-key --init && pacman -S --noconfirm archlinux-keyring
- pacman -Syu --noconfirm diffoscope unzip
- run_nobody ./tools/diff-packages.sh
depends_on:
- Build packages
- Reproduce packages
when:
status:
- success
- failure
- name: Sign packages
image: plugins/gpgsign
pull: if-not-exists
settings:
key:
from_secret: pkgsignkey
passphrase:
from_secret: pkgsignkey-pass
files:
- out/*.pkg.tar.*
- out-debug/*.pkg.tar.*
armor: false
detach_sign: true
depends_on:
- Build packages
when:
ref:
include:
- refs/heads/master
- name: Update db
image: archlinux/archlinux:base-devel
volumes:
- name: pkgdb
path: /var/lib/pacman/sync
commands:
- source tools/build-env.sh
- tools/update-db.sh
depends_on:
- Sign packages
- Generate package list
when:
ref:
include:
- refs/heads/master
- name: Publish
image: appleboy/drone-scp
pull: if-not-exists
settings:
host: arch.osamc.de
user: aiwahpoo
key:
from_secret: ssh-key
source: out
target: /var/www/virtual/aiwahpoo/html/proaudio/x86_64
strip_components: 1
overwrite: true
depends_on:
- Update db
when:
ref:
include:
- refs/heads/master
- name: Publish debug packages
image: appleboy/drone-scp
pull: if-not-exists
settings:
host: arch.osamc.de
user: aiwahpoo
key:
from_secret: ssh-key
source: out-debug
target: /var/www/virtual/aiwahpoo/html/debug-archive
strip_components: 1
overwrite: true
depends_on:
- Sign packages
when:
ref:
include:
- refs/heads/master
- name: Push to AUR
image: archlinux/archlinux:base-devel
volumes:
- name: pkgcache
path: /var/cache/pacman/pkg
- name: pkgdb
path: /var/lib/pacman/sync
environment:
SSH_KEY:
from_secret: ssh-key
commands:
- source tools/build-env.sh
- pacman -Sy && pacman-key --init && pacman -S --noconfirm archlinux-keyring
- pacman -Syu --noconfirm git openssh
- echo "$${SSH_KEY}" > aur/.ssh/id_osamc
- cp -a aur/.ssh /root && chmod 600 /root/.ssh/*
- tools/push-aur.sh
- rm -rf /root/.ssh
depends_on:
- Build packages
when:
ref:
include:
- refs/heads/master
# use a shared pacman cache to speed up successive package installs
volumes:
- name: pkgcache
temp: {}
- name: pkgdb
temp: {}
trigger:
ref:
include:
- refs/heads/master
- refs/pull/**
---
kind: pipeline
type: docker
name: Build arm64
# makepkg -A will attempt building even if aarch64 is missing in PKGBUILD
platform:
os: linux
arch: arm64
steps:
- name: Prepare
image: lopsided/archlinux-arm64v8:devel
volumes:
- name: pkgcache
path: /var/cache/pacman/pkg
- name: pkgdb
path: /var/lib/pacman/sync
failure: ignore # arm64 is not critical for now
environment:
PKGDEST: /drone/src/out
MAKEPKG_ARGS: -A
commands:
- source tools/build-env.sh
- run_nobody tools/prepare-build.sh
- name: Generate package list
image: lopsided/archlinux-arm64v8:devel
commands:
- source tools/build-env.sh
- run_nobody tools/gen-packagelist.sh
when:
ref:
include:
- refs/heads/master
- name: Build packages
image: lopsided/archlinux-arm64v8:devel
volumes:
- name: pkgcache
path: /var/cache/pacman/pkg
- name: pkgdb
path: /var/lib/pacman/sync
environment:
PKGDEST: /drone/src/out
MAKEPKG_ARGS: -A
commands:
- source tools/build-env.sh
- pacman -Sy && pacman-key --init && pacman -S --noconfirm archlinux-keyring && pacman -Syu --noconfirm
- run_nobody tools/clean-build-all.sh
- if ls -1 out/*-debug-*$PKGEXT 2>/dev/null 1>&2; then
mv out/*-debug-*$PKGEXT out-debug/; fi
depends_on:
- Prepare
- name: List built packages
image: alpine:3.15
commands:
- ls -1 out/
- ls -1 out-debug/
depends_on:
- Build packages
when:
status:
- success
- failure
- name: Sign packages
image: plugins/gpgsign
pull: if-not-exists
settings:
key:
from_secret: pkgsignkey
passphrase:
from_secret: pkgsignkey-pass
files:
- out/*.pkg.tar.*
- out-debug/*.pkg.tar.*
armor: false
detach_sign: true
depends_on:
- Build packages
when:
ref:
include:
- refs/heads/master
status:
- success
- failure
- name: Update db
image: lopsided/archlinux-arm64v8:devel
commands:
- source tools/build-env.sh
- tools/update-db.sh
depends_on:
- Sign packages
- Generate package list
when:
ref:
include:
- refs/heads/master
- name: Publish
image: appleboy/drone-scp
pull: if-not-exists
settings:
host: arch.osamc.de
user: aiwahpoo
key:
from_secret: ssh-key
source: out
target: /var/www/virtual/aiwahpoo/html/proaudio/aarch64
strip_components: 1
overwrite: true
depends_on:
- Update db
when:
ref:
include:
- refs/heads/master
- name: Publish debug packages
image: appleboy/drone-scp
pull: if-not-exists
settings:
host: arch.osamc.de
user: aiwahpoo
key:
from_secret: ssh-key
source: out-debug
target: /var/www/virtual/aiwahpoo/html/debug-archive
strip_components: 1
overwrite: true
depends_on:
- Sign packages
when:
ref:
include:
- refs/heads/master
# use a shared pacman cache to speed up successive package installs
volumes:
- name: pkgcache
temp: {}
- name: pkgdb
temp: {}
trigger:
ref:
include:
- refs/heads/master
- refs/pull/**
---
kind: pipeline
type: docker
name: Website
steps:
- name: Fetch databases
image: archlinux/archlinux:base-devel
commands:
- for ARCH in x86_64 aarch64; do
mkdir -p .tmp/db/$ARCH &&
curl https://arch.osamc.de/proaudio/$ARCH/proaudio.files.tar.gz |
bsdtar -xC .tmp/db/$ARCH; done
when:
status:
- success
- failure
- name: Build site
image: klakegg/hugo:busybox
commands:
- hugo
- name: Publish
image: appleboy/drone-scp
pull: if-not-exists
settings:
host: arch.osamc.de
user: aiwahpoo
key:
from_secret: ssh-key
source: .tmp/public
target: /var/www/virtual/aiwahpoo/html
strip_components: 2
overwrite: true
when:
ref:
include:
- refs/heads/master
depends_on:
- Build and check
- Build arm64
trigger:
ref:
include:
- refs/heads/master
- refs/pull/**
when:
status:
- success
- failure
---
kind: pipeline
name: Send notification
steps:
- name: Notify Matrix chat
image: spotlightkid/drone-matrixchat-notify
settings:
homeserver: "https://sonoj.org"
roomid: "!WYagUGTylkAMKoxcVa:sonoj.org"
userid: "@arch-bot:sonoj.org"
accesstoken:
from_secret: matrix-bot-token
deviceid: "HOFQKIPDQE"
template: |
CI pipeline `${DRONE_REPO}` build #${DRONE_BUILD_NUMBER} status: **${DRONE_BUILD_STATUS}**
Build logs: [#${DRONE_BUILD_NUMBER}](${DRONE_BUILD_LINK})
PR: [#${DRONE_PULL_REQUEST} ${DRONE_PULL_REQUEST_TITLE}](${DRONE_COMMIT_LINK}) by *${DRONE_COMMIT_AUTHOR}*
```
${DRONE_COMMIT_MESSAGE}
```
markdown: "yes"
when:
status:
- success
- failure
depends_on:
- Build and check
- Build arm64
- Website
trigger:
ref:
include:
- refs/heads/master
- refs/pull/**
when:
status:
- success
- failure