| 1 | default: |
| 2 | timeout: 2h |
| 3 | |
| 4 | stages: |
| 5 | - build |
| 6 | - test |
| 7 | - analyze |
| 8 | |
| 9 | workflow: |
| 10 | rules: |
| 11 | - if: $CI_PIPELINE_SOURCE == "merge_request_event" |
| 12 | - if: $CI_COMMIT_TAG |
| 13 | - if: $CI_COMMIT_REF_PROTECTED == "true" |
| 14 | |
| 15 | test:linux: |
| 16 | image: $image |
| 17 | stage: test |
| 18 | needs: [ ] |
| 19 | tags: |
| 20 | - saas-linux-medium-amd64 |
| 21 | variables: |
| 22 | CUSTOM_PATH: "/custom" |
| 23 | TEST_OUTPUT_DIRECTORY: "/tmp/test-output" |
| 24 | before_script: |
| 25 | - ./ci/install-dependencies.sh |
| 26 | script: |
| 27 | - useradd builder --create-home |
| 28 | - chown -R builder "${CI_PROJECT_DIR}" |
| 29 | - sudo --preserve-env --set-home --user=builder ./ci/run-build-and-tests.sh |
| 30 | after_script: |
| 31 | - | |
| 32 | if test "$CI_JOB_STATUS" != 'success' |
| 33 | then |
| 34 | sudo --preserve-env --set-home --user=builder ./ci/print-test-failures.sh |
| 35 | mv "$TEST_OUTPUT_DIRECTORY"/failed-test-artifacts t/ |
| 36 | fi |
| 37 | parallel: |
| 38 | matrix: |
| 39 | - jobname: linux-sha256 |
| 40 | image: ubuntu:rolling |
| 41 | CC: clang |
| 42 | - jobname: linux-reftable |
| 43 | image: ubuntu:rolling |
| 44 | CC: clang |
| 45 | - jobname: linux-TEST-vars |
| 46 | image: ubuntu:20.04 |
| 47 | CC: gcc |
| 48 | CC_PACKAGE: gcc-8 |
| 49 | - jobname: linux-breaking-changes |
| 50 | image: ubuntu:rolling |
| 51 | CC: gcc |
| 52 | - jobname: fedora-breaking-changes-meson |
| 53 | image: fedora:latest |
| 54 | - jobname: linux-leaks |
| 55 | image: ubuntu:rolling |
| 56 | CC: gcc |
| 57 | - jobname: linux-reftable-leaks |
| 58 | image: ubuntu:rolling |
| 59 | CC: gcc |
| 60 | - jobname: linux-asan-ubsan |
| 61 | image: ubuntu:rolling |
| 62 | CC: clang |
| 63 | - jobname: linux-meson |
| 64 | image: ubuntu:rolling |
| 65 | CC: gcc |
| 66 | - jobname: linux-musl-meson |
| 67 | image: alpine:latest |
| 68 | # Supported until 2025-04-02. |
| 69 | - jobname: linux32 |
| 70 | image: i386/ubuntu:20.04 |
| 71 | # A RHEL 8 compatible distro. Supported until 2029-05-31. |
| 72 | - jobname: almalinux-8 |
| 73 | image: almalinux:8 |
| 74 | # Supported until 2026-08-31. |
| 75 | - jobname: debian-11 |
| 76 | image: debian:11 |
| 77 | artifacts: |
| 78 | paths: |
| 79 | - t/failed-test-artifacts |
| 80 | reports: |
| 81 | junit: build/meson-logs/testlog.junit.xml |
| 82 | when: on_failure |
| 83 | |
| 84 | test:osx: |
| 85 | image: $image |
| 86 | stage: test |
| 87 | needs: [ ] |
| 88 | tags: |
| 89 | - saas-macos-large-m2pro |
| 90 | variables: |
| 91 | TEST_OUTPUT_DIRECTORY: "/Volumes/RAMDisk" |
| 92 | before_script: |
| 93 | # Create a 4GB RAM disk that we use to store test output on. This small hack |
| 94 | # significantly speeds up tests by more than a factor of 2 because the |
| 95 | # macOS runners use network-attached storage as disks, which is _really_ |
| 96 | # slow with the many small writes that our tests do. |
| 97 | - sudo diskutil apfs create $(hdiutil attach -nomount ram://8192000) RAMDisk |
| 98 | - ./ci/install-dependencies.sh |
| 99 | script: |
| 100 | - ./ci/run-build-and-tests.sh |
| 101 | after_script: |
| 102 | - | |
| 103 | if test "$CI_JOB_STATUS" != 'success' |
| 104 | then |
| 105 | ./ci/print-test-failures.sh |
| 106 | mv "$TEST_OUTPUT_DIRECTORY"/failed-test-artifacts t/ |
| 107 | fi |
| 108 | parallel: |
| 109 | matrix: |
| 110 | - jobname: osx-clang |
| 111 | image: macos-15-xcode-16 |
| 112 | CC: clang |
| 113 | - jobname: osx-reftable |
| 114 | image: macos-26-xcode-26 |
| 115 | CC: clang |
| 116 | - jobname: osx-meson |
| 117 | image: macos-26-xcode-26 |
| 118 | CC: clang |
| 119 | artifacts: |
| 120 | paths: |
| 121 | - t/failed-test-artifacts |
| 122 | reports: |
| 123 | junit: build/meson-logs/testlog.junit.xml |
| 124 | when: on_failure |
| 125 | |
| 126 | .windows_before_script: &windows_before_script |
| 127 | # Disabling realtime monitoring fails on some of the runners, but it |
| 128 | # significantly speeds up test execution in the case where it works. We thus |
| 129 | # try our luck, but ignore any failures. |
| 130 | - Set-MpPreference -DisableRealtimeMonitoring $true; $true |
| 131 | |
| 132 | build:mingw64: |
| 133 | stage: build |
| 134 | tags: |
| 135 | - saas-windows-medium-amd64 |
| 136 | variables: |
| 137 | NO_PERL: 1 |
| 138 | before_script: |
| 139 | - *windows_before_script |
| 140 | - ./ci/install-sdk.ps1 -directory "git-sdk" |
| 141 | script: |
| 142 | - git-sdk/usr/bin/bash.exe -l -c 'ci/make-test-artifacts.sh artifacts' |
| 143 | artifacts: |
| 144 | paths: |
| 145 | - artifacts |
| 146 | - git-sdk |
| 147 | |
| 148 | test:mingw64: |
| 149 | stage: test |
| 150 | tags: |
| 151 | - saas-windows-medium-amd64 |
| 152 | needs: |
| 153 | - job: "build:mingw64" |
| 154 | artifacts: true |
| 155 | before_script: |
| 156 | - *windows_before_script |
| 157 | - git-sdk/usr/bin/bash.exe -l -c 'tar xf artifacts/artifacts.tar.gz' |
| 158 | - New-Item -Path .git/info -ItemType Directory |
| 159 | - New-Item .git/info/exclude -ItemType File -Value "/git-sdk" |
| 160 | script: |
| 161 | - git-sdk/usr/bin/bash.exe -l -c "ci/run-test-slice.sh $CI_NODE_INDEX $CI_NODE_TOTAL" |
| 162 | after_script: |
| 163 | - git-sdk/usr/bin/bash.exe -l -c 'ci/print-test-failures.sh' |
| 164 | parallel: 10 |
| 165 | |
| 166 | .msvc-meson: |
| 167 | variables: |
| 168 | TEST_OUTPUT_DIRECTORY: "C:/Git-Test" |
| 169 | tags: |
| 170 | - saas-windows-medium-amd64 |
| 171 | cache: |
| 172 | key: |
| 173 | files: |
| 174 | - ci/install-dependencies.ps1 |
| 175 | paths: |
| 176 | - .dependencies |
| 177 | before_script: |
| 178 | - *windows_before_script |
| 179 | - ./ci/install-dependencies.ps1 |
| 180 | - $env:Path = "C:\Meson;C:\Rust\bin;$env:Path" |
| 181 | - New-Item -Path $env:TEST_OUTPUT_DIRECTORY -ItemType Directory |
| 182 | |
| 183 | build:msvc-meson: |
| 184 | extends: .msvc-meson |
| 185 | stage: build |
| 186 | script: |
| 187 | - meson setup build --vsenv -Dperl=disabled -Dbackend_max_links=1 -Dcredential_helpers=wincred -Dtest_output_directory="$TEST_OUTPUT_DIRECTORY" |
| 188 | - meson compile -C build |
| 189 | artifacts: |
| 190 | paths: |
| 191 | - build |
| 192 | |
| 193 | test:msvc-meson: |
| 194 | extends: .msvc-meson |
| 195 | stage: test |
| 196 | timeout: 6h |
| 197 | needs: |
| 198 | - job: "build:msvc-meson" |
| 199 | artifacts: true |
| 200 | script: |
| 201 | - | |
| 202 | & "C:/Program Files/Git/usr/bin/bash.exe" -l -c 'ci/run-test-slice-meson.sh build $CI_NODE_INDEX $CI_NODE_TOTAL' |
| 203 | after_script: |
| 204 | - | |
| 205 | if ($env:CI_JOB_STATUS -ne "success") { |
| 206 | & "C:/Program Files/Git/usr/bin/bash.exe" -l -c 'ci/print-test-failures.sh' |
| 207 | Move-Item -Path "$env:TEST_OUTPUT_DIRECTORY/failed-test-artifacts" -Destination t/ |
| 208 | } |
| 209 | parallel: 10 |
| 210 | artifacts: |
| 211 | paths: |
| 212 | - t/failed-test-artifacts |
| 213 | reports: |
| 214 | junit: build/meson-logs/testlog.junit.xml |
| 215 | when: on_failure |
| 216 | |
| 217 | test:fuzz-smoke-tests: |
| 218 | image: ubuntu:latest |
| 219 | stage: test |
| 220 | needs: [ ] |
| 221 | variables: |
| 222 | CC: clang |
| 223 | before_script: |
| 224 | - ./ci/install-dependencies.sh |
| 225 | script: |
| 226 | - ./ci/run-build-and-minimal-fuzzers.sh |
| 227 | |
| 228 | static-analysis: |
| 229 | image: ubuntu:22.04 |
| 230 | stage: analyze |
| 231 | needs: [ ] |
| 232 | variables: |
| 233 | jobname: StaticAnalysis |
| 234 | before_script: |
| 235 | - ./ci/install-dependencies.sh |
| 236 | script: |
| 237 | - ./ci/run-static-analysis.sh |
| 238 | - ./ci/check-directional-formatting.bash |
| 239 | |
| 240 | rust-analysis: |
| 241 | image: ubuntu:rolling |
| 242 | stage: analyze |
| 243 | needs: [ ] |
| 244 | variables: |
| 245 | jobname: RustAnalysis |
| 246 | before_script: |
| 247 | - ./ci/install-dependencies.sh |
| 248 | script: |
| 249 | - ./ci/run-rust-checks.sh |
| 250 | |
| 251 | check-whitespace: |
| 252 | image: ubuntu:latest |
| 253 | stage: analyze |
| 254 | needs: [ ] |
| 255 | before_script: |
| 256 | - ./ci/install-dependencies.sh |
| 257 | # Since $CI_MERGE_REQUEST_TARGET_BRANCH_SHA is only defined for merged |
| 258 | # pipelines, we fallback to $CI_MERGE_REQUEST_DIFF_BASE_SHA, which should |
| 259 | # be defined in all pipelines. |
| 260 | script: |
| 261 | - | |
| 262 | R=${CI_MERGE_REQUEST_TARGET_BRANCH_SHA:-${CI_MERGE_REQUEST_DIFF_BASE_SHA:?}} || exit |
| 263 | ./ci/check-whitespace.sh "$R" |
| 264 | rules: |
| 265 | - if: $CI_PIPELINE_SOURCE == 'merge_request_event' |
| 266 | |
| 267 | check-style: |
| 268 | image: ubuntu:latest |
| 269 | stage: analyze |
| 270 | needs: [ ] |
| 271 | allow_failure: true |
| 272 | variables: |
| 273 | CC: clang |
| 274 | jobname: ClangFormat |
| 275 | before_script: |
| 276 | - ./ci/install-dependencies.sh |
| 277 | # Since $CI_MERGE_REQUEST_TARGET_BRANCH_SHA is only defined for merged |
| 278 | # pipelines, we fallback to $CI_MERGE_REQUEST_DIFF_BASE_SHA, which should |
| 279 | # be defined in all pipelines. |
| 280 | script: |
| 281 | - | |
| 282 | R=${CI_MERGE_REQUEST_TARGET_BRANCH_SHA:-${CI_MERGE_REQUEST_DIFF_BASE_SHA:?}} || exit |
| 283 | ./ci/run-style-check.sh "$R" |
| 284 | rules: |
| 285 | - if: $CI_PIPELINE_SOURCE == 'merge_request_event' |
| 286 | |
| 287 | documentation: |
| 288 | image: ubuntu:latest |
| 289 | stage: analyze |
| 290 | needs: [ ] |
| 291 | variables: |
| 292 | jobname: Documentation |
| 293 | before_script: |
| 294 | - ./ci/install-dependencies.sh |
| 295 | script: |
| 296 | - ./ci/test-documentation.sh |