/
.gitlab-ci.yml
232 lines (208 loc) · 5.52 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
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
# SPDX-FileCopyrightText: 2017 Florian Müllner
#
# SPDX-License-Identifier: GPL-2.0-or-later
include:
- remote: 'https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml'
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/057b052e682d8e5a20c1eb2dd60d5b87d2b56856/templates/fedora.yml'
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/34f4ade99434043f88e164933f570301fd18b125/templates/ci-fairy.yml'
stages:
- pre_review
- prepare
- review
- build
- deploy
- housekeeping
default:
# Cancel jobs if newer commits are pushed to the branch
interruptible: true
# Auto-retry jobs in case of infra failures
retry:
max: 1
when:
- 'runner_system_failure'
- 'stuck_or_timeout_failure'
- 'scheduler_failure'
- 'api_failure'
variables:
FDO_UPSTREAM_REPO: GNOME/polari
MANIFEST_PATH: "flatpak/org.gnome.Polari.json"
BUNDLE: "polari-git.flatpak"
LINT_LOG: "eslint-report.xml"
workflow:
rules:
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"'
when: never
- if: '$CI_MERGE_REQUEST_IID'
- if: '$CI_COMMIT_TAG'
- if: '$CI_COMMIT_BRANCH'
.pipeline_guard: &pipeline_guard
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_COMMIT_TAG'
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- if: '$CI_COMMIT_BRANCH =~ /^gnome-[0-9-]+$/'
- when: 'manual'
.polari.fedora:
variables:
FDO_DISTRIBUTION_VERSION: 39
FDO_DISTRIBUTION_TAG: '2023-08-25.2'
FDO_DISTRIBUTION_PACKAGES: >
meson gcc g++ pkgconf git gettext itstool
desktop-file-utils */appstream-util */json-glib-validate
nodejs npm
'pkgconfig(gtk4)' 'pkgconfig(gjs-1.0)'
'pkgconfig(gobject-introspection-1.0)'
'pkgconfig(tracker-sparql-3.0)'
'pkgconfig(telepathy-glib)'
FDO_DISTRIBUTION_EXEC: |
# For static analysis with eslint
npm install -g eslint@^8.0.0 eslint-plugin-jsdoc@^46.0.0 &&
./.gitlab-ci/install-meson-project.sh \
https://gitlab.gnome.org/fmuellner/gjs-ci-tools.git \
main .
.prereview_req: &prereview_req
needs:
- check_commit_log
- check-merge-request
check_commit_log:
extends:
- .fdo.ci-fairy
stage: pre_review
script:
- if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
then
ci-fairy check-commits --junit-xml=commit-message-junit-report.xml ;
else
echo "Not a merge request" ;
fi
<<: *pipeline_guard
artifacts:
expire_in: 1 week
paths:
- commit-message-junit-report.xml
reports:
junit: commit-message-junit-report.xml
check-merge-request:
extends:
- .fdo.ci-fairy
stage: pre_review
script:
- if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
then
ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request-report.xml ;
else
echo "Not a merge request" ;
fi
<<: *pipeline_guard
artifacts:
expire_in: 1 week
paths:
- check-merge-request-report.xml
reports:
junit: check-merge-request-report.xml
check-reuse:
stage: pre_review
image:
name: fsfe/reuse:latest
entrypoint: [""]
script:
- reuse lint
build-fedora-container:
extends:
- .fdo.container-build@fedora@x86_64
- .polari.fedora
stage: prepare
<<: *prereview_req
eslint:
extends:
- .fdo.distribution-image@fedora
- .polari.fedora
stage: review
needs:
- build-fedora-container
script:
- eslint -o $LINT_LOG -f junit --resolve-plugins-relative-to $(npm root -g) src
artifacts:
paths:
- ${LINT_LOG}
reports:
junit: ${LINT_LOG}
js-check:
extends:
- .fdo.distribution-image@fedora
- .polari.fedora
stage: review
needs:
- build-fedora-container
script:
- gjs-check-syntax
.flatpak-template:
stage: build
<<: *prereview_req
variables:
RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo"
FLATPAK_MODULE: "polari"
APP_ID: "org.gnome.Polari"
extends: .flatpak
flatpak:
variables:
BRANCH: "snapshot"
CONFIG_OPTS: "-Dsnapshot=true --werror --warnlevel 2"
extends: .flatpak-template
rules:
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
flatpak-main:
extends: .flatpak-template
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
nightly:
extends: '.publish_nightly'
needs:
- flatpak-main
fedora-build:
extends:
- .fdo.distribution-image@fedora
- .polari.fedora
stage: build
needs:
- build-fedora-container
script:
- meson setup build --werror
- meson compile -C build
- meson test -C build
- meson install -C build
artifacts:
paths:
- build
fedora-dist:
extends:
- .fdo.distribution-image@fedora
- .polari.fedora
stage: deploy
needs:
- fedora-build
script:
- meson dist -C build
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:
- meson.build
fedora-dist-tarball:
extends: fedora-dist
artifacts:
expose_as: 'Get tarball here'
paths:
- build/meson-dist/$CI_PROJECT_NAME-$CI_COMMIT_TAG.tar.xz
rules:
- if: '$CI_COMMIT_TAG'
check-flatpak-deps:
image:
name: ghcr.io/flathub/flatpak-external-data-checker
entrypoint: [""]
stage: housekeeping
<<: *prereview_req
script:
- /app/flatpak-external-data-checker $MANIFEST_PATH
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule" && $POLARI_SCHEDULED_JOB == "x-checker"'