summaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: 2589098eff72b36add85e210a0376c0a84834a44 (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
default:
  timeout: 2h

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

test:linux:
  image: $image
  variables:
    CUSTOM_PATH: "/custom"
  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
      fi
  parallel:
    matrix:
      - jobname: linux-sha256
        image: ubuntu:latest
        CC: clang
      - jobname: linux-reftable
        image: ubuntu:latest
        CC: clang
      - jobname: linux-gcc
        image: ubuntu:20.04
        CC: gcc
        CC_PACKAGE: gcc-8
      - jobname: linux-TEST-vars
        image: ubuntu:20.04
        CC: gcc
        CC_PACKAGE: gcc-8
      - jobname: linux-gcc-default
        image: ubuntu:latest
        CC: gcc
      - jobname: linux-leaks
        image: ubuntu:latest
        CC: gcc
      - jobname: linux-reftable-leaks
        image: ubuntu:latest
        CC: gcc
      - jobname: linux-asan-ubsan
        image: ubuntu:latest
        CC: clang
      - jobname: pedantic
        image: fedora:latest
      - jobname: linux-musl
        image: alpine:latest
  artifacts:
    paths:
      - t/failed-test-artifacts
    when: on_failure

test:osx:
  image: $image
  tags:
    - saas-macos-medium-m1
  variables:
    TEST_OUTPUT_DIRECTORY: "/Volumes/RAMDisk"
  before_script:
    # Create a 4GB RAM disk that we use to store test output on. This small hack
    # significantly speeds up tests by more than a factor of 2 because the
    # macOS runners use network-attached storage as disks, which is _really_
    # slow with the many small writes that our tests do.
    - sudo diskutil apfs create $(hdiutil attach -nomount ram://8192000) RAMDisk
    - ./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-13-xcode-14
        CC: clang
      - jobname: osx-reftable
        image: macos-13-xcode-14
        CC: clang
  artifacts:
    paths:
      - t/failed-test-artifacts
    when: on_failure

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

static-analysis:
  image: ubuntu:22.04
  variables:
    jobname: StaticAnalysis
  before_script:
    - ./ci/install-dependencies.sh
  script:
    - ./ci/run-static-analysis.sh
    - ./ci/check-directional-formatting.bash

check-whitespace:
  image: ubuntu:latest
  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
  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
  variables:
    jobname: Documentation
  before_script:
    - ./ci/install-dependencies.sh
  script:
    - ./ci/test-documentation.sh