BlueGit

timfa bluegit

Files

bluegit / blue-ci-cd.yml

blue-ci-cd.yml

blue-ci-cd.yml 3.5 KiB Download Raw
1# Pipeline waarmee Steve BlueGit zelf test, bouwt en op master publiceert.
2# De mirror https://git.timfalken.com/timfa/bluegit leest dit bestand.
3# .gitlab-ci.yml blijft de GitLab-pipeline zolang de repository daar nog staat.
4#
5# Go-jobs gebruiken de preset bluegit/go. Frontend-checks gebruiken bluegit/node.
6# De AUR-job blijft op archlinux/archlinux:base-devel: makepkg en pacman
7# zitten niet in een preset.
8#
9# Geheimen op de repository of de groep (een repositorygeheim wint):
10# AUR_SSH_PRIVATE_KEY of AUR_SSH_PRIVATE_KEY_B64
11# AUR_GIT_AUTHOR_NAME, AUR_GIT_AUTHOR_EMAIL
12# BLUEGIT_UPDATE_TOKEN
13# Markeer ze als beschermd en bescherm master. Dan komen ze alleen mee
14# op een beschermde branch. Een merge request draait alleen test en build.
15
16stages: [test, build, release]
17
18variables:
19 CGO_ENABLED: "0"
20 # go.mod vraagt Go 1.26 (post-quantum SSH-kex). Een ouder bluegit/go-image
21 # haalt de juiste toolchain dan zelf op.
22 GOTOOLCHAIN: auto
23
24jobs:
25 .on_ci:
26 rules:
27 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
28 - if: $CI_COMMIT_BRANCH != null
29 - if: $CI_COMMIT_TAG != null
30
31 .on_master:
32 rules:
33 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
34 when: never
35 - if: $CI_COMMIT_BRANCH == "master"
36 - if: $CI_COMMIT_BRANCH == "main"
37
38 vet:
39 stage: test
40 image: bluegit/go
41 extends: .on_ci
42 script:
43 - go vet ./...
44
45 test:
46 stage: test
47 image: bluegit/go
48 extends: .on_ci
49 script:
50 - go test ./...
51
52 frontend_checks:
53 stage: test
54 image: bluegit/node
55 extends: .on_ci
56 script:
57 - chmod +x scripts/frontend-checks.sh
58 - ./scripts/frontend-checks.sh
59
60 build:
61 stage: build
62 image: bluegit/go
63 extends: .on_ci
64 script:
65 - go build -trimpath -ldflags="-s -w" -o bluegit ./cmd/bluegit
66 artifacts:
67 paths: [bluegit]
68 expire_in: 14d
69
70 # Vóór self_update. De archive-route staat live, dus de tarball van
71 # deze sha is te downloaden met de binary die al draait.
72 # allow_failure: een AUR-storing maakt de pipeline niet rood en houdt
73 # self_update niet tegen.
74 publish_aur:
75 stage: release
76 image: archlinux/archlinux:base-devel
77 extends: .on_master
78 needs: [build]
79 allow_failure: true
80 script:
81 - pacman -Syu --noconfirm
82 - pacman -S --noconfirm --needed git openssh curl coreutils shadow util-linux
83 - chmod +x scripts/aur-ssh-setup.sh scripts/publish-aur.sh
84 - ./scripts/aur-ssh-setup.sh
85 - ./scripts/publish-aur.sh
86
87 # Het aparte runner-pakket. Zelfde AUR-SSH-geheim als publish_aur.
88 publish_aur_runner:
89 stage: release
90 image: archlinux/archlinux:base-devel
91 extends: .on_master
92 needs: [build]
93 allow_failure: true
94 script:
95 - pacman -Syu --noconfirm
96 - pacman -S --noconfirm --needed git openssh curl coreutils shadow util-linux
97 - chmod +x scripts/aur-ssh-setup.sh scripts/publish-aur.sh
98 - ./scripts/aur-ssh-setup.sh
99 - AUR_PKG=bluegit-runner ./scripts/publish-aur.sh
100
101 # Laatste job. needs: [publish_aur] geldt ook als die job met
102 # allow_failure mislukt. Alleen de POST; de job eindigt meteen groen.
103 # De updater bouwt zelf uit git; dit artifact gaat niet mee.
104 # BLUEGIT_UPDATE_TOKEN is hetzelfde geheim als in /etc/bluegit/env.
105 # CI_API_URL eindigt op /api/v1.
106 self_update:
107 stage: release
108 image: bluegit/base
109 extends: .on_master
110 needs: [publish_aur, publish_aur_runner]
111 script:
112 - chmod +x scripts/self-update.sh
113 - ./scripts/self-update.sh