-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
207 lines (191 loc) · 4.85 KB
/
.gitlab-ci.yml
File metadata and controls
207 lines (191 loc) · 4.85 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
spec:
inputs:
python_versions:
type: array
default:
- "python-3.10"
- "python-3.11"
- "python-3.12"
- "python-3.13"
- "python-3.14"
- "pypy-3.11"
default_version:
default: "python-3.13"
build_images:
options: ["never", "always"]
default: "never"
---
include:
- component: gitlab.gnome.org/GNOME/citemplates/release-service@master
inputs:
dist-job-name: "sdist"
tarball-artifact-path: "${TARBALL_ARTIFACT_PATH}"
stages:
- images
- pre-commit
- build
- coverage
- documentation
- build-release
- deploy
variables:
REGISTRY: registry.gitlab.gnome.org/gnome/pygobject
CI_IMAGE: registry.gitlab.gnome.org/gnome/pygobject/ci
TARBALL_ARTIFACT_PATH: "dist/${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.gz"
# Normal build whenever Dockerfile has not changed
default:
interruptible: true
cache:
paths:
- _ccache/
# Build images if Dockerfile has changed
build-image:
stage: images
image: quay.io/buildah/stable:latest
rules:
- if: $CI_PROJECT_NAMESPACE == "GNOME" && $CI_COMMIT_BRANCH == "main"
changes:
- ".gitlab-ci.yml"
- ".gitlab-ci/Dockerfile"
when: always
- when: $[[ inputs.build_images ]]
variables:
STORAGE_DRIVER: vfs
BUILDAH_ISOLATION: chroot
parallel:
matrix:
- IMAGE_TAG: $[[ inputs.python_versions ]]
script:
- echo "$CI_REGISTRY_PASSWORD" | buildah login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin
- IMG="$CI_IMAGE:$IMAGE_TAG"
- echo "Building image '$IMG'"
- buildah build --build-arg BASE=${IMAGE_TAG/-/:} -t $IMG -f Dockerfile .gitlab-ci
- buildah push $IMG
cache:
paths:
pre-commit:
stage: pre-commit
image: $CI_IMAGE:$[[ inputs.default_version ]]
variables:
XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache"
script:
- git config --global --add safe.directory "$CI_PROJECT_DIR"
- python -m pip install -q --no-warn-script-location pre-commit
- python -m pre_commit run --verbose --all-files || git diff
artifacts:
when: on_failure
paths:
- .cache/pre-commit/pre-commit.log
cache:
paths:
- .cache
linux:
stage: build
image: $CI_IMAGE:$IMAGE_TAG
parallel:
matrix:
- IMAGE_TAG: $[[ inputs.python_versions ]]
TEST_GTK_VERSION: "3.0"
- IMAGE_TAG: $[[ inputs.default_version ]]
TEST_GTK_VERSION: "4.0"
artifacts:
when: always
paths:
- coverage/
- test-results.xml
reports:
junit: test-results.xml
script:
- bash -x ./.gitlab-ci/test-docker.sh
windows:
stage: build
tags:
- win32-ps
parallel:
matrix:
- MSYSTEM:
- "UCRT64"
- "CLANG64"
artifacts:
when: always
paths:
- coverage/
- _build/meson-logs
- test-results.xml
reports:
junit: test-results.xml
script:
- $env:CHERE_INVOKING = 'yes'
- C:\msys64\usr\bin\pacman --noconfirm -Syyuu
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
gnome-master:
stage: build
image: quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master
tags:
- flatpak
parallel:
matrix:
- TEST_GTK_VERSION:
- "3.0"
- "4.0"
artifacts:
paths:
- coverage/
script:
- bash -x ./.gitlab-ci/test-flatpak.sh
linux-pdm:
stage: build
image: $CI_IMAGE:$[[ inputs.default_version ]]
variables:
TEST_GTK_VERSION: "3.0"
before_script:
- python -m pip install "pdm!=2.17.3"
- python -m pdm install -v
script:
- xvfb-run -a python -m pdm run pytest
minimal-meson:
allow_failure: true
stage: build
image: quay.io/fedora/fedora:40
before_script:
- dnf install --assumeyes gcc meson git flex bison diffutils python3-devel python3-test python3-pytest gobject-introspection-devel
script:
- meson setup _build
- meson compile -C _build
- PYTEST_ADDOPTS="-sv -k 'not test_cairo'" meson test -C _build --suite pygobject --verbose
coverage:
stage: coverage
image: $CI_IMAGE:$[[ inputs.default_version ]]
artifacts:
paths:
- coverage/
script:
- bash -x ./.gitlab-ci/coverage-docker.sh
coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
pages:
stage: documentation
image: $CI_IMAGE:$[[ inputs.default_version ]]
dependencies:
- coverage
before_script:
- python -m pip install "pdm!=2.17.3"
- python -m pdm install -v
script:
- python -m pdm run sphinx-build -T -E -W --keep-going -b html -d _build/doctrees -D language=en docs/ public
- mv coverage/ public/
artifacts:
paths:
- public
expire_in: 30 days
rules:
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_COMMIT_TAG
sdist:
stage: build-release
image: $CI_IMAGE:$[[ inputs.default_version ]]
artifacts:
paths:
- dist/
script:
- git config --global --add safe.directory "$CI_PROJECT_DIR"
- bash -x ./.gitlab-ci/build-sdists.sh