Merge branch 'jk/jump-quickfix-fixes'
[git/gitster.git] / .gitlab-ci.yml
blob80b1668ebeb10cf4946d667f83aa110579315581
1 default:
2   timeout: 2h
4 workflow:
5   rules:
6     - if: $CI_PIPELINE_SOURCE == "merge_request_event"
7     - if: $CI_COMMIT_TAG
8     - if: $CI_COMMIT_REF_PROTECTED == "true"
10 test:linux:
11   image: $image
12   variables:
13     CUSTOM_PATH: "/custom"
14   before_script:
15     - ./ci/install-dependencies.sh
16   script:
17     - useradd builder --create-home
18     - chown -R builder "${CI_PROJECT_DIR}"
19     - sudo --preserve-env --set-home --user=builder ./ci/run-build-and-tests.sh
20   after_script:
21     - |
22       if test "$CI_JOB_STATUS" != 'success'
23       then
24         sudo --preserve-env --set-home --user=builder ./ci/print-test-failures.sh
25       fi
26   parallel:
27     matrix:
28       - jobname: linux-old
29         image: ubuntu:16.04
30         CC: gcc
31       - jobname: linux-sha256
32         image: ubuntu:latest
33         CC: clang
34       - jobname: linux-reftable
35         image: ubuntu:latest
36         CC: clang
37       - jobname: linux-gcc
38         image: ubuntu:20.04
39         CC: gcc
40         CC_PACKAGE: gcc-8
41       - jobname: linux-TEST-vars
42         image: ubuntu:20.04
43         CC: gcc
44         CC_PACKAGE: gcc-8
45       - jobname: linux-gcc-default
46         image: ubuntu:latest
47         CC: gcc
48       - jobname: linux-leaks
49         image: ubuntu:latest
50         CC: gcc
51       - jobname: linux-reftable-leaks
52         image: ubuntu:latest
53         CC: gcc
54       - jobname: linux-asan-ubsan
55         image: ubuntu:latest
56         CC: clang
57       - jobname: pedantic
58         image: fedora:latest
59       - jobname: linux-musl
60         image: alpine:latest
61   artifacts:
62     paths:
63       - t/failed-test-artifacts
64     when: on_failure
66 test:osx:
67   image: $image
68   tags:
69     - saas-macos-medium-m1
70   variables:
71     TEST_OUTPUT_DIRECTORY: "/Volumes/RAMDisk"
72   before_script:
73     # Create a 4GB RAM disk that we use to store test output on. This small hack
74     # significantly speeds up tests by more than a factor of 2 because the
75     # macOS runners use network-attached storage as disks, which is _really_
76     # slow with the many small writes that our tests do.
77     - sudo diskutil apfs create $(hdiutil attach -nomount ram://8192000) RAMDisk
78     - ./ci/install-dependencies.sh
79   script:
80     - ./ci/run-build-and-tests.sh
81   after_script:
82     - |
83       if test "$CI_JOB_STATUS" != 'success'
84       then
85         ./ci/print-test-failures.sh
86         mv "$TEST_OUTPUT_DIRECTORY"/failed-test-artifacts t/
87       fi
88   parallel:
89     matrix:
90       - jobname: osx-clang
91         image: macos-13-xcode-14
92         CC: clang
93       - jobname: osx-reftable
94         image: macos-13-xcode-14
95         CC: clang
96   artifacts:
97     paths:
98       - t/failed-test-artifacts
99     when: on_failure
101 test:fuzz-smoke-tests:
102   image: ubuntu:latest
103   variables:
104     CC: clang
105   before_script:
106     - ./ci/install-dependencies.sh
107   script:
108     - ./ci/run-build-and-minimal-fuzzers.sh
110 static-analysis:
111   image: ubuntu:22.04
112   variables:
113     jobname: StaticAnalysis
114   before_script:
115     - ./ci/install-dependencies.sh
116   script:
117     - ./ci/run-static-analysis.sh
118     - ./ci/check-directional-formatting.bash
120 check-whitespace:
121   image: ubuntu:latest
122   before_script:
123     - ./ci/install-dependencies.sh
124   # Since $CI_MERGE_REQUEST_TARGET_BRANCH_SHA is only defined for merged
125   # pipelines, we fallback to $CI_MERGE_REQUEST_DIFF_BASE_SHA, which should
126   # be defined in all pipelines.
127   script:
128     - |
129       R=${CI_MERGE_REQUEST_TARGET_BRANCH_SHA-${CI_MERGE_REQUEST_DIFF_BASE_SHA:?}} || exit
130       ./ci/check-whitespace.sh "$R"
131   rules:
132     - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
134 check-style:
135   image: ubuntu:latest
136   allow_failure: true
137   variables:
138     CC: clang
139     jobname: ClangFormat
140   before_script:
141     - ./ci/install-dependencies.sh
142   # Since $CI_MERGE_REQUEST_TARGET_BRANCH_SHA is only defined for merged
143   # pipelines, we fallback to $CI_MERGE_REQUEST_DIFF_BASE_SHA, which should
144   # be defined in all pipelines.
145   script:
146     - |
147       R=${CI_MERGE_REQUEST_TARGET_BRANCH_SHA-${CI_MERGE_REQUEST_DIFF_BASE_SHA:?}} || exit
148       ./ci/run-style-check.sh "$R"
149   rules:
150     - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
152 documentation:
153   image: ubuntu:latest
154   variables:
155     jobname: Documentation
156   before_script:
157     - ./ci/install-dependencies.sh
158   script:
159     - ./ci/test-documentation.sh