summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 0242283c3c55716b80560cd73a75145117379f94 (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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
default:
  timeout: 2h

stages:
  - build
  - test
  - analyze

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_REF_PROTECTED == "true"

test:linux:
  image: $image
  stage: test
  needs: [ ]
  tags:
    - saas-linux-medium-amd64
  variables:
    CUSTOM_PATH: "/custom"
    TEST_OUTPUT_DIRECTORY: "/tmp/test-output"
  before_script:
    - ./ci/install-dependencies.sh
  script:
    - useradd builder --create-home
    - chown -R builder "${CI_PROJECT_DIR}"
    - sudo --preserve-env --set-home --user=builder ./ci/run-build-and-tests.sh
  after_script:
    - |
      if test "$CI_JOB_STATUS" != 'success'
      then
        sudo --preserve-env --set-home --user=builder ./ci/print-test-failures.sh
        mv "$TEST_OUTPUT_DIRECTORY"/failed-test-artifacts t/
      fi
  parallel:
    matrix:
      - jobname: linux-sha256
        image: ubuntu:rolling
        CC: clang
      - jobname: linux-reftable
        image: ubuntu:rolling
        CC: clang
      - jobname: linux-TEST-vars
        image: ubuntu:20.04
        CC: gcc
        CC_PACKAGE: gcc-8
      - jobname: linux-breaking-changes
        image: ubuntu:rolling
        CC: gcc
      - jobname: fedora-breaking-changes-meson
        image: fedora:latest
      - jobname: linux-leaks
        image: ubuntu:rolling
        CC: gcc
      - jobname: linux-reftable-leaks
        image: ubuntu:rolling
        CC: gcc
      - jobname: linux-asan-ubsan
        image: ubuntu:rolling
        CC: clang
      - jobname: linux-meson
        image: ubuntu:rolling
        CC: gcc
      - jobname: linux-musl-meson
        image: alpine:latest
        # Supported until 2025-04-02.
      - jobname: linux32
        image: i386/ubuntu:20.04
      # A RHEL 8 compatible distro.  Supported until 2029-05-31.
      - jobname: almalinux-8
        image: almalinux:8
      # Supported until 2026-08-31.
      - jobname: debian-11
        image: debian:11
  artifacts:
    paths:
      - t/failed-test-artifacts
    reports:
      junit: build/meson-logs/testlog.junit.xml
    when: on_failure

test:osx:
  image: $image
  stage: test
  needs: [ ]
  tags:
    - saas-macos-large-m2pro
  variables:
    TEST_OUTPUT_DIRECTORY: "/tmp/test-output"
  before_script:
    - ./ci/install-dependencies.sh
  script:
    - ./ci/run-build-and-tests.sh
  after_script:
    - |
      if test "$CI_JOB_STATUS" != 'success'
      then
        ./ci/print-test-failures.sh
        mv "$TEST_OUTPUT_DIRECTORY"/failed-test-artifacts t/
      fi
  parallel:
    matrix:
      - jobname: osx-clang
        image: macos-15-xcode-16
        CC: clang
      - jobname: osx-reftable
        image: macos-26-xcode-26
        CC: clang
      - jobname: osx-meson
        image: macos-26-xcode-26
        CC: clang
  artifacts:
    paths:
      - t/failed-test-artifacts
    reports:
      junit: build/meson-logs/testlog.junit.xml
    when: on_failure

.windows_before_script: &windows_before_script
  # Disabling realtime monitoring fails on some of the runners, but it
  # significantly speeds up test execution in the case where it works. We thus
  # try our luck, but ignore any failures.
  - Set-MpPreference -DisableRealtimeMonitoring $true; $true

build:mingw64:
  stage: build
  tags:
    - saas-windows-medium-amd64
  variables:
    NO_PERL: 1
  before_script:
    - *windows_before_script
    - ./ci/install-sdk.ps1 -directory "git-sdk"
  script:
    - git-sdk/usr/bin/bash.exe -l -c 'ci/make-test-artifacts.sh artifacts'
  artifacts:
    paths:
      - artifacts
      - git-sdk

test:mingw64:
  stage: test
  tags:
    - saas-windows-medium-amd64
  needs:
    - job: "build:mingw64"
      artifacts: true
  variables:
    # Windows runners don't have enough RAM to run EXPENSIVE tests.
    GIT_TEST_LONG: false
  before_script:
    - *windows_before_script
    - git-sdk/usr/bin/bash.exe -l -c 'tar xf artifacts/artifacts.tar.gz'
    - New-Item -Path .git/info -ItemType Directory
    - New-Item .git/info/exclude -ItemType File -Value "/git-sdk"
  script:
    - git-sdk/usr/bin/bash.exe -l -c "ci/run-test-slice.sh $CI_NODE_INDEX $CI_NODE_TOTAL"
  after_script:
    - git-sdk/usr/bin/bash.exe -l -c 'ci/print-test-failures.sh'
  parallel: 10

.msvc-meson:
  variables:
    TEST_OUTPUT_DIRECTORY: "C:/Git-Test"
  tags:
    - saas-windows-medium-amd64
  cache:
    key:
      files:
        - ci/install-dependencies.ps1
    paths:
      - .dependencies
  before_script:
    - *windows_before_script
    - ./ci/install-dependencies.ps1
    - $env:Path = "C:\Meson;C:\Rust\bin;$env:Path"
    - New-Item -Path $env:TEST_OUTPUT_DIRECTORY -ItemType Directory

build:msvc-meson:
  extends: .msvc-meson
  stage: build
  script:
    - meson setup build --vsenv -Dperl=disabled -Dbackend_max_links=1 -Dcredential_helpers=wincred -Dtest_output_directory="$TEST_OUTPUT_DIRECTORY"
    - meson compile -C build
  artifacts:
    paths:
      - build

test:msvc-meson:
  extends: .msvc-meson
  stage: test
  timeout: 6h
  needs:
    - job: "build:msvc-meson"
      artifacts: true
  script:
    - |
      & "C:/Program Files/Git/usr/bin/bash.exe" -l -c 'ci/run-test-slice-meson.sh build $CI_NODE_INDEX $CI_NODE_TOTAL'
  variables:
    # Windows runners don't have enough RAM to run EXPENSIVE tests.
    GIT_TEST_LONG: false
  after_script:
    - |
      if ($env:CI_JOB_STATUS -ne "success") {
        & "C:/Program Files/Git/usr/bin/bash.exe" -l -c 'ci/print-test-failures.sh'
        Move-Item -Path "$env:TEST_OUTPUT_DIRECTORY/failed-test-artifacts" -Destination t/
      }
  parallel: 10
  artifacts:
    paths:
      - t/failed-test-artifacts
    reports:
      junit: build/meson-logs/testlog.junit.xml
    when: on_failure

test:fuzz-smoke-tests:
  image: ubuntu:latest
  stage: test
  needs: [ ]
  variables:
    CC: clang
  before_script:
    - ./ci/install-dependencies.sh
  script:
    - ./ci/run-build-and-minimal-fuzzers.sh

static-analysis:
  image: ubuntu:latest
  stage: analyze
  needs: [ ]
  variables:
    jobname: StaticAnalysis
  before_script:
    - ./ci/install-dependencies.sh
  script:
    - ./ci/run-static-analysis.sh
    - ./ci/check-directional-formatting.bash

rust-analysis:
  image: ubuntu:rolling
  stage: analyze
  needs: [ ]
  variables:
    jobname: RustAnalysis
  before_script:
    - ./ci/install-dependencies.sh
  script:
    - ./ci/run-rust-checks.sh

check-whitespace:
  image: ubuntu:latest
  stage: analyze
  needs: [ ]
  before_script:
    - ./ci/install-dependencies.sh
  # Since $CI_MERGE_REQUEST_TARGET_BRANCH_SHA is only defined for merged
  # pipelines, we fallback to $CI_MERGE_REQUEST_DIFF_BASE_SHA, which should
  # be defined in all pipelines.
  script:
    - |
      R=${CI_MERGE_REQUEST_TARGET_BRANCH_SHA:-${CI_MERGE_REQUEST_DIFF_BASE_SHA:?}} || exit
      ./ci/check-whitespace.sh "$R"
  rules:
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'

check-style:
  image: ubuntu:latest
  stage: analyze
  needs: [ ]
  allow_failure: true
  variables:
    CC: clang
    jobname: ClangFormat
  before_script:
    - ./ci/install-dependencies.sh
  # Since $CI_MERGE_REQUEST_TARGET_BRANCH_SHA is only defined for merged
  # pipelines, we fallback to $CI_MERGE_REQUEST_DIFF_BASE_SHA, which should
  # be defined in all pipelines.
  script:
    - |
      R=${CI_MERGE_REQUEST_TARGET_BRANCH_SHA:-${CI_MERGE_REQUEST_DIFF_BASE_SHA:?}} || exit
      ./ci/run-style-check.sh "$R"
  rules:
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'

documentation:
  image: ubuntu:latest
  stage: analyze
  needs: [ ]
  variables:
    jobname: Documentation
  before_script:
    - ./ci/install-dependencies.sh
  script:
    - ./ci/test-documentation.sh