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