summaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: 9f1b22e418a1dffa8c06e77fafca9c9e3319c300 (plain)
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
# TODO: Figure out if we can reuse these jobs but run them after our own checks without having
#  to manually merge `stages`.
include:
  - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
  - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml


stages:
  - ci-test
  - ci-os-support
  - aggregate-coverage
  - pages
  - os-build-tests
  - provisioning
  - build
  - publish
  - test

tests-testing:
  stage: os-build-tests
  image: debian:testing-slim
  script:
    - apt-get update
    - apt-get build-dep -y .
    - dpkg-buildpackage -us -uc -tc

tests-unstable:
  stage: os-build-tests
  image: debian:unstable-slim
  script:
    - apt-get update
    - apt-get build-dep -Ppkg.debputy.ci -y .
    - dpkg-buildpackage -Ppkg.debputy.ci -us -uc -tc

tests-ubuntu-noble:
  stage: os-build-tests
  image: ubuntu:noble
  script:
    - apt-get update
    - apt-get build-dep -Ppkg.debputy.ci -y .
    - dpkg-buildpackage -Ppkg.debputy.ci -us -uc -tc


tests-debian-bookwork-backports:
  stage: os-build-tests
  image: debian:bookworm-slim
  script:
    - apt-get update
    - apt-get build-dep -Ppkg.debputy.ci,pkg.debputy.bookworm-backports -y .
    - dpkg-buildpackage -Ppkg.debputy.ci,pkg.debputy.bookworm-backports -us -uc -tc


code-lint-mypy:
  stage: ci-test
  image: debian:unstable-slim
  script:
    - apt-get update
    - apt-get build-dep -Ppkg.debputy.ci -y .
    - apt-get install -y mypy python3-lxml
    # Remove the `|| true` once we get to a sufficient level of typing where we can set the minimum bar
    - mypy --html-report mypy-report --junit-format per_file --junit-xml mypy-xunit-report.xml --cobertura-xml-report mypy-cobertura-report src tests || true
  artifacts:
    paths:
      - mypy-report
    reports:
      junit: mypy-xunit-report.xml
      coverage_report:
        coverage_format: cobertura
        path: mypy-cobertura-report/cobertura.xml
  except:
    variables:
      - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/

tests-unstable-coverage-without-optional-bd:
  stage: ci-test
  image: debian:unstable-slim
  script:
    - apt-get update
    - apt-get build-dep -Ppkg.debputy.minimal-tests,pkg.debputy.test-coverage -y .
    - py.test-3 -v --cov --cov-branch --doctest-modules --junit-xml=xunit-report.xml --cov-report xml:coverage.xml
  after_script:
  - mkdir -p coverage-results/tests-unstable-coverage-without-optional-bd
  - cp .coverage coverage-results/tests-unstable-coverage-without-optional-bd/coverage
  artifacts:
    paths:
      - coverage-results/tests-unstable-coverage-without-optional-bd
    reports:
      junit: xunit-report.xml
      coverage_report:
        coverage_format: cobertura
        path: coverage.xml

tests-unstable-coverage:
  stage: ci-test
  image: debian:unstable-slim
  script:
    - apt-get update
    - apt-get build-dep -Ppkg.debputy.test-coverage -y .
    - py.test-3 -v --cov --cov-branch --doctest-modules --junit-xml=xunit-report.xml --cov-report xml:coverage.xml
  after_script:
  - mkdir -p coverage-results/tests-unstable-coverage
  - cp .coverage coverage-results/tests-unstable-coverage/coverage
  artifacts:
    paths:
      - coverage-results/tests-unstable-coverage
    reports:
      junit: xunit-report.xml
      coverage_report:
        coverage_format: cobertura
        path: coverage.xml

tests-unstable-coverage-with-extra-bd:
  stage: ci-test
  image: debian:unstable
  script:
    - apt-get update
    - apt-get build-dep -Ppkg.debputy.ci,pkg.debputy.test-coverage -y .
    - py.test-3 -v --cov --cov-branch --doctest-modules --junit-xml=xunit-report.xml --cov-report xml:coverage.xml
  after_script:
  - mkdir -p coverage-results/tests-unstable-coverage-with-extra-bd
  - cp .coverage coverage-results/tests-unstable-coverage-with-extra-bd/coverage
  artifacts:
    paths:
      - coverage-results/tests-unstable-coverage-with-extra-bd
    reports:
      junit: xunit-report.xml
      coverage_report:
        coverage_format: cobertura
        path: coverage.xml


tests-ubuntu-noble-coverage-with-extra-bd:
  stage: ci-os-support
  image: ubuntu:noble
  script:
    - apt-get update
    - apt-get build-dep -Ppkg.debputy.ci,pkg.debputy.test-coverage -y .
    - py.test-3 -v --cov --cov-branch --doctest-modules --junit-xml=xunit-report.xml --cov-report xml:coverage.xml
  after_script:
  - mkdir -p coverage-results/tests-ubuntu-noble-coverage-with-extra-bd
  - cp .coverage coverage-results/tests-ubuntu-noble-coverage-with-extra-bd/coverage
  artifacts:
    paths:
      - coverage-results/tests-ubuntu-noble-coverage-with-extra-bd
    reports:
      junit: xunit-report.xml
      coverage_report:
        coverage_format: cobertura
        path: coverage.xml


tests-ubuntu-noble-coverage-without-optional-bd:
  stage: ci-os-support
  image: ubuntu:noble
  script:
    - apt-get update
    - apt-get build-dep -Ppkg.debputy.minimal-tests,pkg.debputy.test-coverage -y .
    - py.test-3 -v --cov --cov-branch --doctest-modules --junit-xml=xunit-report.xml --cov-report xml:coverage.xml
  after_script:
  - mkdir -p coverage-results/tests-ubuntu-noble-coverage-without-optional-bd
  - cp .coverage coverage-results/tests-ubuntu-noble-coverage-without-optional-bd/coverage
  artifacts:
    paths:
      - coverage-results/tests-ubuntu-noble-coverage-without-optional-bd
    reports:
      junit: xunit-report.xml
      coverage_report:
        coverage_format: cobertura
        path: coverage.xml

tests-debian-bookworm-backports-coverage-with-extra-bd:
  stage: ci-os-support
  image: debian:bookworm-slim
  script:
    - apt-get update
    - apt-get build-dep -Ppkg.debputy.ci,pkg.debputy.test-coverage,pkg.debputy.bookworm-backports -y .
    - py.test-3 -v --cov --cov-branch --doctest-modules --junit-xml=xunit-report.xml --cov-report xml:coverage.xml
  after_script:
  - mkdir -p coverage-results/tests-ubuntu-noble-coverage-with-extra-bd
  - cp .coverage coverage-results/tests-ubuntu-noble-coverage-with-extra-bd/coverage
  artifacts:
    paths:
      - coverage-results/tests-ubuntu-noble-coverage-with-extra-bd
    reports:
      junit: xunit-report.xml
      coverage_report:
        coverage_format: cobertura
        path: coverage.xml


tests-debian-bookworm-backports-coverage-without-optional-bd:
  stage: ci-os-support
  image: debian:bookworm-slim
  script:
    - apt-get update
    - apt-get build-dep -Ppkg.debputy.minimal-tests,pkg.debputy.test-coverage,pkg.debputy.bookworm-backports -y .
    - py.test-3 -v --cov --cov-branch --doctest-modules --junit-xml=xunit-report.xml --cov-report xml:coverage.xml
  after_script:
  - mkdir -p coverage-results/tests-ubuntu-noble-coverage-without-optional-bd
  - cp .coverage coverage-results/tests-ubuntu-noble-coverage-without-optional-bd/coverage
  artifacts:
    paths:
      - coverage-results/tests-ubuntu-noble-coverage-without-optional-bd
    reports:
      junit: xunit-report.xml
      coverage_report:
        coverage_format: cobertura
        path: coverage.xml


aggregate-coverage:
  stage: aggregate-coverage
  image: debian:unstable-slim
  coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
  script:
  - apt-get update -y
  - apt-get install -y python3-coverage
  - python3-coverage combine coverage-results/*/coverage*
  - python3-coverage html -d coverage-report
  - python3-coverage report
  artifacts:
    paths:
    - coverage-report
  dependencies:
  - tests-unstable-coverage
  - tests-unstable-coverage-without-optional-bd
  - tests-unstable-coverage-with-extra-bd
  - tests-ubuntu-noble-coverage-with-extra-bd
  - tests-ubuntu-noble-coverage-without-optional-bd

pages:
  stage: pages
  script:
  - mkdir public
  - mv coverage-report public/
  - mv mypy-report public/
  dependencies:
  - aggregate-coverage
  - code-lint-mypy
  artifacts:
    paths:
    - public
  only:
  - main

variables:
  SALSA_CI_DISABLE_WRAP_AND_SORT: 1
  SALSA_CI_AUTOPKGTEST_ALLOWED_EXIT_STATUS: 0
  SALSA_CI_DISABLE_APTLY: 0

debputy-reformat:
  stage: ci-test
  image: debian:unstable-slim
  script:
    - apt-get update -qq && apt-get -qq build-dep --no-install-recommends --yes .
    - ./debputy.sh reformat --linter-exit-code --no-auto-fix
  except:
    variables:
      - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/

debputy-lint:
  stage: ci-test
  image: debian:sid-slim
  script:
    - apt-get update -qq && apt-get -qq build-dep --no-install-recommends --yes . && apt-get -qq install --yes python3-levenshtein python3-junit.xml
    - PERL5LIB=lib ./debputy.sh lint --lint-report-format=junit4-xml --report-output debputy-lint-report.xml
    # Mostly just for the validation that --spellcheck does not crash
    - PERL5LIB=lib ./debputy.sh lint --spellcheck
  except:
    variables:
      - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
  artifacts:
    reports:
      junit: debputy-lint-report.xml