-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
.gitlab-ci.yml
201 lines (177 loc) · 6.26 KB
/
.gitlab-ci.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
include:
- project: 'gnome/citemplates'
file: 'flatpak/flatpak_ci_initiative.yml'
- project: 'Rirusha/citemplates'
file: 'lints.yml'
- project: 'Rirusha/citemplates'
file: 'vala-checkers.yml'
variables:
APP_ID: 'space.rirusha.Cassette-Devel'
MANIFEST_PATH: $CI_PROJECT_DIR/build-aux/flatpak/nightly/${APP_ID}.yml
BUNDLE: "${APP_ID}.flatpak"
RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo"
FLATPAK_MODULE: "cassette"
stages:
- lint-vala
- lint-blp
- lint-checkers
- test-mr
- build-aarch64
- build-x86_64
- deploy
- deploy-sithyfus
- update-repo
# lint-vala:
# stage: 'lint-vala'
# extends: '.lint-vala'
# lint-blp:
# stage: 'lint-blp'
# extends: '.lint-blp'
# lint-checkers:
# stage: 'lint-checkers'
# extends: '.lint-checkers'
test-mr:
variables:
RUN_TESTS: "0"
stage: 'test-mr'
extends: '.flatpak'
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
.setup-gpg:
image: 'quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master'
stage: 'setup-gpg'
tags:
- flatpak
before_script:
- mkdir -p ${GNUPGHOME}
- gpg --list-keys --with-keygrip
- touch ${GNUPGHOME}/gpg.conf
- touch ${GNUPGHOME}/gpg-agent.conf
- echo "allow-preset-passphrase" >> ${GNUPGHOME}/gpg-agent.conf
- echo "pinentry-mode loopback" >> ${GNUPGHOME}/gpg.conf
- echo "batch" >> ${GNUPGHOME}/gpg.conf
- echo "yes" >> ${GNUPGHOME}/gpg.conf
- echo "passphrase-file ${GPG_PASSPHRASE}" >> ${GNUPGHOME}/gpg.conf
- gpg-connect-agent reloadagent /bye
- cat ${GPG_PASSPHRASE} | /usr/libexec/gpg-preset-passphrase --preset ${GPG_KEY_GREP}
- base64 -d ${GPG_PRIVATE_KEY} | gpg --import
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == 'push'
.build:
extends: '.setup-gpg'
stage: 'build'
interruptible: true
variables:
GNUPGHOME: /build/.gnupg
LANG: "C.UTF-8"
RUN_TESTS: "0"
ARCH: x86_64
script:
- cat /etc/os-release
- flatpak --version
# Report the installed versions of the runtime
- flatpak info org.gnome.Platform
- flatpak info org.gnome.Sdk
# Print the date, since appstream depends on local timezone
- date && date -u
- |
export REWRITE_RUN_TESTS="--run-tests"
if [[ $RUN_TESTS != "1" ]]; then
export REWRITE_RUN_TESTS="--no-run-tests"
fi
rewrite-flatpak-manifest ${REWRITE_RUN_TESTS} ${MANIFEST_PATH} ${FLATPAK_MODULE} -- ${CONFIG_OPTS}
- |
if [ ${ARCH} = "x86_64" ]; then
tar xf repo.tar
rm -rf repo.tar
fi
- >-
xvfb-run -a -s "-screen 0 1024x768x24" --
dbus-run-session
flatpak-builder ${CI_FB_ARGS} --keep-build-dirs --arch=${ARCH} --user --gpg-sign=${GPG_KEY_ID} --gpg-homedir=${GNUPGHOME} --disable-rofiles-fuse flatpak_app --repo=repo ${BRANCH:+--default-branch=$BRANCH} ${MANIFEST_PATH}
# Generate a Flatpak bundle
- flatpak build-bundle --runtime-repo=${RUNTIME_REPO} --gpg-sign=${GPG_KEY_ID} --gpg-homedir=${GNUPGHOME} repo ${BUNDLE} ${APP_ID} ${BRANCH}
- echo "[Flatpak Repo]" > repo/index.flatpakrepo
- echo "Title=Cassette Nightly Repo" >> repo/index.flatpakrepo
- echo "Url=https://cassette-rirusha-7b5d032b879376545602ad6add1827529edccbba8e6c57.pages.gitlab.gnome.org/" >> repo/index.flatpakrepo
- echo "Homepage=https://https://gitlab.gnome.org/Rirusha/Cassette/" >> repo/index.flatpakrepo
- echo "Comment=Repository with development version of Cassette" >> repo/index.flatpakrepo
- echo "Description=Repository with development version of Cassette" >> repo/index.flatpakrepo
- echo "Icon=https://dl.flathub.org/repo/logo.svg" >> repo/index.flatpakrepo
- echo "GPGKey=$(gpg --export ${GPG_KEY_ID} | base64 --wrap=0)" >> repo/index.flatpakrepo
- flatpak build-update-repo --gpg-sign=${GPG_KEY_ID} --gpg-homedir=${GNUPGHOME} --generate-static-deltas --prune repo
- tar cf repo.tar repo/
- rm -rf .flatpak-builder
artifacts:
name: 'Flatpak artifacts'
when: 'always'
paths:
- $BUNDLE
- 'repo.tar'
- '.flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/meson-logs/meson-log.txt'
- '.flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/meson-logs/testlog.txt'
reports:
junit: '.flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/meson-logs/testlog.junit.xml'
expire_in: 14 days
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == 'push'
build-x86_64:
extends: '.build'
variables:
ARCH: x86_64
dependencies:
- "build-aarch64"
tags:
- flatpak
stage: "build-x86_64"
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == 'push'
# Need to fix `Error: module cassette: Error removing file /builds/Rirusha/cassette-test-ci/.flatpak-builder/build/cassette: Directory not empty`
build-aarch64:
extends: '.build'
variables:
ARCH: aarch64
tags:
- flatpak-aarch64
stage: "build-aarch64"
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == 'push'
pages:
variables:
BUILD_OUTPUT_PATH: $CI_PROJECT_DIR/repo
stage: deploy
image: alpine:latest
dependencies:
- "build-x86_64"
script:
- apk add rsync
- tar xf repo.tar
- find $BUILD_OUTPUT_PATH \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i -e "s#href=\"\/#href=\"$CI_PAGES_URL/#g" -e "s#src=\"\/#src=\"$CI_PAGES_URL/#g"
- mkdir public || true
- rsync -av --exclude='public' --exclude='.git' $BUILD_OUTPUT_PATH/ public
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == 'push'
artifacts:
paths:
- public
expire_in: 14 days
update-repo:
stage: update-repo
image: alpine:latest
dependencies:
- "build-x86_64"
script:
- tar xf repo.tar
- apk add git
- git clone https://Rirusha:${GITHUB_TOKEN}@github.com/Rirusha/rirusha.space.git
- rm -f rirusha.space/repos/cassette-nightly.flatpakrepo && cp repo/index.flatpakrepo rirusha.space/repos/cassette-nightly.flatpakrepo
- cd rirusha.space
- git add .
- echo $(git status --porcelain)
- git config --global user.email "not-a@mail.com"
- git config --global user.name "Updater Bot"
- git commit -m "Update cassette-nightly repo" || true
- git push
- cd ..
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == 'push'