t0410: make test description clearer
[git/gitster.git] / .gitlab-ci.yml
blob526ecfe030a43e0a5a83ddd35cb7c96d46ab2485
1 default:
2   timeout: 2h
4 stages:
5   - build
6   - test
7   - analyze
9 workflow:
10   rules:
11     - if: $CI_PIPELINE_SOURCE == "merge_request_event"
12     - if: $CI_COMMIT_TAG
13     - if: $CI_COMMIT_REF_PROTECTED == "true"
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   before_script:
24     - ./ci/install-dependencies.sh
25   script:
26     - useradd builder --create-home
27     - chown -R builder "${CI_PROJECT_DIR}"
28     - sudo --preserve-env --set-home --user=builder ./ci/run-build-and-tests.sh
29   after_script:
30     - |
31       if test "$CI_JOB_STATUS" != 'success'
32       then
33         sudo --preserve-env --set-home --user=builder ./ci/print-test-failures.sh
34       fi
35   parallel:
36     matrix:
37       - jobname: linux-old
38         image: ubuntu:16.04
39         CC: gcc
40       - jobname: linux-sha256
41         image: ubuntu:latest
42         CC: clang
43       - jobname: linux-reftable
44         image: ubuntu:latest
45         CC: clang
46       - jobname: linux-gcc
47         image: ubuntu:20.04
48         CC: gcc
49         CC_PACKAGE: gcc-8
50       - jobname: linux-TEST-vars
51         image: ubuntu:20.04
52         CC: gcc
53         CC_PACKAGE: gcc-8
54       - jobname: linux-gcc-default
55         image: ubuntu:latest
56         CC: gcc
57       - jobname: linux-leaks
58         image: ubuntu:latest
59         CC: gcc
60       - jobname: linux-reftable-leaks
61         image: ubuntu:latest
62         CC: gcc
63       - jobname: linux-asan-ubsan
64         image: ubuntu:latest
65         CC: clang
66       - jobname: pedantic
67         image: fedora:latest
68       - jobname: linux-musl
69         image: alpine:latest
70   artifacts:
71     paths:
72       - t/failed-test-artifacts
73     when: on_failure
75 test:osx:
76   image: $image
77   stage: test
78   needs: [ ]
79   tags:
80     - saas-macos-medium-m1
81   variables:
82     TEST_OUTPUT_DIRECTORY: "/Volumes/RAMDisk"
83   before_script:
84     # Create a 4GB RAM disk that we use to store test output on. This small hack
85     # significantly speeds up tests by more than a factor of 2 because the
86     # macOS runners use network-attached storage as disks, which is _really_
87     # slow with the many small writes that our tests do.
88     - sudo diskutil apfs create $(hdiutil attach -nomount ram://8192000) RAMDisk
89     - ./ci/install-dependencies.sh
90   script:
91     - ./ci/run-build-and-tests.sh
92   after_script:
93     - |
94       if test "$CI_JOB_STATUS" != 'success'
95       then
96         ./ci/print-test-failures.sh
97         mv "$TEST_OUTPUT_DIRECTORY"/failed-test-artifacts t/
98       fi
99   parallel:
100     matrix:
101       - jobname: osx-clang
102         image: macos-13-xcode-14
103         CC: clang
104       - jobname: osx-reftable
105         image: macos-13-xcode-14
106         CC: clang
107   artifacts:
108     paths:
109       - t/failed-test-artifacts
110     when: on_failure
112 build:mingw64:
113   stage: build
114   tags:
115     - saas-windows-medium-amd64
116   variables:
117     NO_PERL: 1
118   before_script:
119     - ./ci/install-sdk.ps1 -directory "git-sdk"
120   script:
121     - git-sdk/usr/bin/bash.exe -l -c 'ci/make-test-artifacts.sh artifacts'
122   artifacts:
123     paths:
124       - artifacts
125       - git-sdk
127 test:mingw64:
128   stage: test
129   tags:
130     - saas-windows-medium-amd64
131   needs:
132     - job: "build:mingw64"
133       artifacts: true
134   before_script:
135     - git-sdk/usr/bin/bash.exe -l -c 'tar xf artifacts/artifacts.tar.gz'
136     - New-Item -Path .git/info -ItemType Directory
137     - New-Item .git/info/exclude -ItemType File -Value "/git-sdk"
138   script:
139     - git-sdk/usr/bin/bash.exe -l -c "ci/run-test-slice.sh $CI_NODE_INDEX $CI_NODE_TOTAL"
140   after_script:
141     - git-sdk/usr/bin/bash.exe -l -c 'ci/print-test-failures.sh'
142   parallel: 10
144 test:fuzz-smoke-tests:
145   image: ubuntu:latest
146   stage: test
147   needs: [ ]
148   variables:
149     CC: clang
150   before_script:
151     - ./ci/install-dependencies.sh
152   script:
153     - ./ci/run-build-and-minimal-fuzzers.sh
155 static-analysis:
156   image: ubuntu:22.04
157   stage: analyze
158   needs: [ ]
159   variables:
160     jobname: StaticAnalysis
161   before_script:
162     - ./ci/install-dependencies.sh
163   script:
164     - ./ci/run-static-analysis.sh
165     - ./ci/check-directional-formatting.bash
167 check-whitespace:
168   image: ubuntu:latest
169   stage: analyze
170   needs: [ ]
171   before_script:
172     - ./ci/install-dependencies.sh
173   # Since $CI_MERGE_REQUEST_TARGET_BRANCH_SHA is only defined for merged
174   # pipelines, we fallback to $CI_MERGE_REQUEST_DIFF_BASE_SHA, which should
175   # be defined in all pipelines.
176   script:
177     - |
178       R=${CI_MERGE_REQUEST_TARGET_BRANCH_SHA-${CI_MERGE_REQUEST_DIFF_BASE_SHA:?}} || exit
179       ./ci/check-whitespace.sh "$R"
180   rules:
181     - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
183 check-style:
184   image: ubuntu:latest
185   stage: analyze
186   needs: [ ]
187   allow_failure: true
188   variables:
189     CC: clang
190     jobname: ClangFormat
191   before_script:
192     - ./ci/install-dependencies.sh
193   # Since $CI_MERGE_REQUEST_TARGET_BRANCH_SHA is only defined for merged
194   # pipelines, we fallback to $CI_MERGE_REQUEST_DIFF_BASE_SHA, which should
195   # be defined in all pipelines.
196   script:
197     - |
198       R=${CI_MERGE_REQUEST_TARGET_BRANCH_SHA-${CI_MERGE_REQUEST_DIFF_BASE_SHA:?}} || exit
199       ./ci/run-style-check.sh "$R"
200   rules:
201     - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
203 documentation:
204   image: ubuntu:latest
205   stage: analyze
206   needs: [ ]
207   variables:
208     jobname: Documentation
209   before_script:
210     - ./ci/install-dependencies.sh
211   script:
212     - ./ci/test-documentation.sh