Repository navigation
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
320 lines (301 loc) · 10.8 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
320 lines (301 loc) · 10.8 KB
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
# -*- indent-tabs-mode: nil -*-
#
# Continuous Integration configuration for Orca
#
# Full documentation for Gitlab CI: https://docs.gitlab.com/ee/ci/
#
# Introduction to Gitlab CI: https://docs.gitlab.com/ee/ci/quick_start/index.html
# Include the parameters we need from Freedesktop CI Templates,
# plus the GNOME release-service.
include:
- local: 'ci/container_builds.yml'
- component: gitlab.gnome.org/GNOME/citemplates/release-service@master
inputs:
job-stage: release
dist-job-name: "build-release-tarball"
tarball-artifact-path: "${TARBALL_ARTIFACT_PATH}"
# Stages in the CI pipeline in which jobs will be run
stages:
- container-build
- build
- test
- format
- lint
- pages
- release
# Enable merge request pipelines and avoid duplicate pipelines
# https://docs.gitlab.com/ee/ci/yaml/index.html#switch-between-branch-pipelines-and-merge-request-pipelines
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
- if: '$CI_COMMIT_TAG'
- if: '$CI_COMMIT_BRANCH'
variables:
MESON_BUILD_DIR: _build
TARBALL_ARTIFACT_PATH: "${MESON_BUILD_DIR}/meson-dist/${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.xz"
.manual-development-branch:
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH && $CI_COMMIT_BRANCH !~ /^gnome-/'
when: manual
allow_failure: true
# Main build job; installs at-spi2-core and builds/installs Orca.
#
# The build is done in a _build directory; see build_and_install.sh.
#
# At the end, prepares the Mallard docs with translations in _build and makes them
# ready for rendering into HTML. The rendering is done in the "pages" job below.
build-opensuse-x86_64:
stage: build
extends:
- '.orca_opensuse_tumbleweed_x86_64'
- '.fdo.distribution-image@opensuse'
needs:
- job: opensuse-container@x86_64
artifacts: false
script:
- bash -x ci/install_atspi.sh
- bash -x ci/build_and_install.sh
- bash -x ci/prepare_translated_docs.sh
artifacts:
paths:
- _build/help
expire_in: 1 day
unit-tests:
stage: test
extends:
- '.orca_opensuse_tumbleweed_x86_64'
- '.fdo.distribution-image@opensuse'
needs:
- job: opensuse-container@x86_64
artifacts: false
script:
- bash -x ci/install_atspi.sh
- source ci/env.sh
- meson setup -D prefix=/usr -D mathcat=false "${MESON_BUILD_DIR}"
- meson test -C "${MESON_BUILD_DIR}" --suite unit --print-errorlogs
.integration-tests:
stage: test
rules:
- !reference [.manual-development-branch, rules]
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_DRAFT == "true"'
when: manual
allow_failure: true
# Run for tags and pipelines not triggered by a push or merge request.
- if: '$CI_COMMIT_TAG || ($CI_PIPELINE_SOURCE != "push" && $CI_PIPELINE_SOURCE != "merge_request_event")'
# Match anything except documentation and translation content, including unknown files.
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:
regexp: &integration_changes '\A(?!(?:[^/]+\.md|AUTHORS|ChangeLog[^/]*|COPYING|HACKING|MAINTAINERS|NEWS|QUICKSTART|RELEASE-HOWTO|TODO|docs/.*\.(?:md|1)|tests/README\.md|po/.*\.po|help/.*\.(?:po|page|png|svg)|(?:po|help)/LINGUAS)\z)'
# A new branch has no previous commit to compare against.
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BEFORE_SHA == "0000000000000000000000000000000000000000" && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
changes:
compare_to: 'refs/heads/$CI_DEFAULT_BRANCH'
regexp: *integration_changes
- if: '$CI_PIPELINE_SOURCE == "push" && ($CI_COMMIT_BEFORE_SHA != "0000000000000000000000000000000000000000" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH)'
changes:
regexp: *integration_changes
- when: manual
allow_failure: true
variables:
ORCA_TEST_RETRY_DIR: "${CI_PROJECT_DIR}/${MESON_BUILD_DIR}/integration-retries"
extends:
- '.orca_opensuse_tumbleweed_x86_64'
- '.fdo.distribution-image@opensuse'
needs:
- job: opensuse-container@x86_64
artifacts: false
before_script:
- source ci/env.sh
- bash -x ci/install_atspi.sh
- bash -x ci/build_and_install.sh
allow_failure: true
after_script:
- source ci/env.sh
- python3 -m tests.integration_retry --summary "${ORCA_TEST_RETRY_DIR}"
artifacts:
when: always
paths:
- _build/integration-retries/
reports:
junit: _build/meson-logs/testlog.junit.xml
expire_in: 1 day
integration-tests-base:
extends: .integration-tests
allow_failure: false
script:
- python3 -c 'from PyQt5.QtCore import qVersion; print("Qt5", qVersion())'
- python3 -c 'from PySide6.QtCore import qVersion; print("Qt6", qVersion())'
- |
python3 - <<'PY'
import gi
gi.require_version("Gtk", "3.0")
gi.require_version("Vte", "2.91")
from gi.repository import Gtk, Vte
print("GTK3:", Gtk.get_major_version(), Gtk.get_minor_version(), Gtk.get_micro_version())
print("VTE (GTK3):", Vte.get_major_version(), Vte.get_minor_version(), Vte.get_micro_version())
PY
- |
python3 - <<'PY'
import gi
gi.require_version("Gtk", "4.0")
gi.require_version("Vte", "3.91")
from gi.repository import Gtk, Vte
print("GTK4:", Gtk.get_major_version(), Gtk.get_minor_version(), Gtk.get_micro_version())
print("VTE (GTK4):", Vte.get_major_version(), Vte.get_minor_version(), Vte.get_micro_version())
PY
- meson test -C "${MESON_BUILD_DIR}" --suite core --suite gtk3 --suite gtk4 --suite qt5 --suite qt6 --suite gtk3-terminal --suite gtk4-terminal --suite konsole-terminal --num-processes 1 --timeout-multiplier 2 --print-errorlogs
integration-tests-chromium:
extends: .integration-tests
allow_failure: false
timeout: 2h
variables:
ORCA_BUILD_MATHCAT: "true"
script:
- chromium --version
- meson test -C "${MESON_BUILD_DIR}" --suite chromium --num-processes 1 --timeout-multiplier 2 --print-errorlogs
integration-tests-firefox:
extends: .integration-tests
allow_failure: false
timeout: 2h
variables:
ORCA_BUILD_MATHCAT: "true"
script:
- firefox --full-version
- meson test -C "${MESON_BUILD_DIR}" --suite gecko --num-processes 1 --timeout-multiplier 2 --print-errorlogs
integration-tests-file-manager:
extends: .integration-tests
allow_failure: false
script:
- rpm -q caja dolphin nautilus
# Nautilus refuses to run as root.
- chown -R nobody "${MESON_BUILD_DIR}"
- runuser -u nobody -- env PATH="$PATH" meson test -C "${MESON_BUILD_DIR}" --suite file-manager --num-processes 1 --timeout-multiplier 2 --print-errorlogs
integration-tests-document:
extends: .integration-tests
allow_failure: false
script:
- atril --version
- meson test -C "${MESON_BUILD_DIR}" --suite document --num-processes 1 --timeout-multiplier 2 --print-errorlogs
# Linters: Ruff and Mypy
#
# The configurations are in pyproject.toml.
linters:
stage: lint
extends:
- '.orca_opensuse_tumbleweed_x86_64'
- '.fdo.distribution-image@opensuse'
needs:
- job: opensuse-container@x86_64
artifacts: false
- job: auto-format
optional: true
script:
- source ci/env.sh
- status=0
- codespell src/orca || status=1
- ruff format --check src/orca || status=1
- ruff check src/orca || status=1
- python ci/check_orca_rules.py || status=1
- mypy src/orca || status=1
- exit $status
allow_failure: false
# Auto-format code with ruff and commit back to the branch.
# Only runs on merge requests from branches in this project (not forks),
# since the CI_JOB_TOKEN cannot push to external repositories.
# If changes are pushed, exits with failure to stop this pipeline;
# a new pipeline will start with the formatted code.
auto-format:
stage: format
extends:
- '.orca_opensuse_tumbleweed_x86_64'
- '.fdo.distribution-image@opensuse'
needs:
- job: opensuse-container@x86_64
artifacts: false
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TITLE =~ /^Draft:/'
when: never
# Only run for MRs from branches in this project, not forks (CI token can't push to forks)
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH == $CI_MERGE_REQUEST_PROJECT_PATH'
script:
- source ci/env.sh
- ruff format src/orca
- ruff check --fix src/orca || true
- |
if [ -n "$(git status --porcelain)" ]; then
git stash
git config user.name "GitLab CI"
git config user.email "ci@gitlab.gnome.org"
git remote set-url origin "https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.gnome.org/${CI_MERGE_REQUEST_SOURCE_PROJECT_PATH}.git"
git fetch origin "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"
git checkout "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"
git stash pop
git add -A
git commit -m "style: auto-format with ruff"
git push origin "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"
echo "Pushed formatting changes. A new pipeline will run."
exit 1
else
echo "No formatting changes needed"
fi
# Build a tarball for the release if we have a tag.
build-release-tarball:
stage: build
extends:
- '.orca_opensuse_tumbleweed_x86_64'
- '.fdo.distribution-image@opensuse'
needs:
- job: opensuse-container@x86_64
artifacts: false
rules:
- if: '$CI_COMMIT_TAG'
when: always
- when: never
script:
- bash -x ci/install_atspi.sh
- meson setup "${MESON_BUILD_DIR}"
- meson dist -C "${MESON_BUILD_DIR}"
artifacts:
name: "${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- "${TARBALL_ARTIFACT_PATH}"
# Renders the documentation from Mallard into HTML, and puts it in public/
#
# Assumes that a previous build job put the translated docs in _build/help/{language_name}
# for all available languages.
render-mallard-docs:
stage: build
extends:
- '.orca_opensuse_tumbleweed_x86_64'
- '.fdo.distribution-image@opensuse'
needs:
- job: opensuse-container@x86_64
artifacts: false
- job: build-opensuse-x86_64 # this one puts the translated docs in _build/help
script:
- bash -x ci/render_mallard_docs.sh
artifacts:
paths:
- public
expire_in: 1 day
# Takes the public/ generated in the render-mallard-docs job and publishes it via GitLab pages.
pages:
stage: pages
extends:
- '.orca_opensuse_tumbleweed_x86_64'
- '.fdo.distribution-image@opensuse'
needs:
- job: render-mallard-docs
script:
# This is so that GitLab will see that there is something to do, as the job
# needs nothing except the artifacts from the render-mallard-docs job.
- echo
artifacts:
paths:
- public
expire_in: 1 day
rules:
- if: '$CI_COMMIT_BRANCH == "main"'