fallbackdir: Update list generated on September 18, 2023
[tor.git] / .gitlab-ci.yml
blob41caa955371f2453f356be55c1bb393c88654284
1 ####
2 # DO NOT EDIT THIS FILE IN MASTER.  ONLY EDIT IT IN THE OLDEST SUPPORTED
3 # BRANCH, THEN MERGE FORWARD.
4 ####
6 # This file controls how gitlab validates Tor commits and merge requests.
8 # It is primarily based on a set of scripts and configurations by
9 # Hans-Christoph Steiner.  It only copies parts of those scripts and
10 # configurations for now.  If you want a new piece of functionality
11 # (more debians, more fedoras, android support) then you shouldn't
12 # start from scratch: have a look at the original ticket, at
13 # https://gitlab.torproject.org/tpo/core/tor/-/issues/32193 !
15 # The file to copy from is
16 # https://gitlab.torproject.org/tpo/core/tor/-/merge_requests/96/diffs#diff-content-587d266bb27a4dc3022bbed44dfa19849df3044c
18 # Having said that, if there is anything really stupid here, don't
19 # blame it on Hans-Christoph! Tor probably added it on their own.
21 # Copyright 2020, The Tor Project, Inc.
22 # See LICENSE for licence information.
24 # These variables are set everywhere, unconditionally.
25 variables:
26   TERM: "ansi"
27   DEBUG_CI: "yes"
29 # This template is for exporting ephemeral things from the scripts.  By
30 # convention we expect our scripts to copy stuff into artifacts/, rather than
31 # having a big list of files that be treated as artifacts.
32 .artifacts-template: &artifacts-template
33   artifacts:
34     name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}"
35     expire_in: 1 week
36     when: always
37     paths:
38       - artifacts/
41 # This template is used for x86-64 builds.
42 .x86-64-template: &x86-64-template
43   tags:
44     - amd64
46 # This template should be usable on any system that's based on apt.
47 .apt-template: &apt-template |
48       export LC_ALL=C.UTF-8
49       echo Etc/UTC > /etc/timezone
50       mkdir -p apt-cache
51       export APT_CACHE_DIR="$(pwd)/apt-cache"
52       rm -f /etc/apt/apt.conf.d/docker-clean
53       echo 'quiet "1";' \
54            'APT::Install-Recommends "0";' \
55            'APT::Install-Suggests "0";' \
56            'APT::Acquire::Retries "20";' \
57            'APT::Get::Assume-Yes "true";' \
58            'Dpkg::Use-Pty "0";' \
59            "Dir::Cache::Archives \"${APT_CACHE_DIR}\"; " \
60         >> /etc/apt/apt.conf.d/99gitlab
61       apt-get update -qq
62       apt-get upgrade -qy
64 # This template sets us up for Debian system in particular.
65 .debian-template: &debian-template
66   <<: *artifacts-template
67   <<: *x86-64-template
68   variables:
69     DEBIAN_FRONTEND: "noninteractive"
70   # TODO: Using "cache" in this way speeds up our downloads.  It would be
71   # even better, though, to start with a pre-upgraded debian image.
72   #
73   # TODO: Will we have to do this differently once we have more than one
74   # debian version that we're using?
75   cache:
76     key: apt
77     paths:
78       - apt-cache
79   before_script:
80     - *apt-template
81     # Install patches unconditionally.
82     - apt-get install
83         apt-utils
84         automake
85         build-essential
86         ca-certificates
87         file
88         git
89         libevent-dev
90         liblzma-dev
91         libscrypt-dev
92         libseccomp-dev
93         libssl-dev
94         pkg-config
95         python3
96         zlib1g-dev
97     # Install patches that we only need for some use cases.
98     - if [ "$ASCIIDOC" = yes ]; then apt-get install asciidoc xmlto; fi
99     - if [ "$DOXYGEN" = yes ]; then apt-get install doxygen; fi
100     - if [ "$STEM" = yes ]; then apt-get install timelimit; fi
101     - if [ "$CC" = clang ]; then apt-get install clang; fi
102     - if [ "$NSS" = yes ]; then apt-get install libnss3 libnss3-dev; fi
103     # TODO: This next line should not be debian-only.
104     - if [ "$STEM" = yes ]; then git clone --depth 1 https://gitlab.torproject.org/tpo/network-health/stem.git ; export STEM_PATH="$(pwd)/stem"; fi
105     # TODO: This next line should not be debian-only.
106     - if [ "$CHUTNEY" = yes ]; then git clone --depth 1 https://gitlab.torproject.org/tpo/core/chutney.git ;  export CHUTNEY_PATH="$(pwd)/chutney"; fi
107     - if [ "$TRACING" = yes ]; then apt install liblttng-ust-dev; fi
109 # Minimal check on debian: just make, make check.
111 debian-minimal:
112   image: debian:bullseye
113   <<: *debian-template
114   script:
115     - ./scripts/ci/ci-driver.sh
117 # Minmal check on debian/i386: just make, make check.
119 debian-i386-minimal:
120   image: i386/debian:bullseye
121   <<: *debian-template
122   script:
123     - ./scripts/ci/ci-driver.sh
124   tags:
125     - physical
127 #####
128 # Run "make check" with a hardened clang on debian stable.  This takes
129 # care of a hardening check, and a compile-with-clang check.
131 # TODO: This will be faster once we merge #40098 and #40099.
132 debian-hardened:
133   image: debian:bullseye
134   <<: *debian-template
135   variables:
136     ALL_BUGS_ARE_FATAL: "yes"
137     HARDENING: "yes"
138     CC: "clang"
139   script:
140     - ./scripts/ci/ci-driver.sh
142 #####
143 # Distcheck on debian stable
144 debian-distcheck:
145   image: debian:bullseye
146   <<: *debian-template
147   variables:
148     DISTCHECK: "yes"
149     CHECK: "no"
150   script:
151     - ./scripts/ci/ci-driver.sh
153 #####
154 # Documentation tests on debian stable: doxygen and asciidoc.
155 debian-docs:
156   image: debian:bullseye
157   <<: *debian-template
158   variables:
159     DOXYGEN: "yes"
160     ASCIIDOC: "yes"
161     CHECK: "no"
162     RUN_STAGE_BUILD: "no"
163   script:
164     - ./scripts/ci/ci-driver.sh
166 #####
167 # Integration tests on debian stable: chutney and stem.
169 # TODO: It would be cool if this target didn't have to re-build tor, and
170 #       could instead re-use Tor from debian-minimal.  That can be done
171 #       with the 'artifacts' mechanism, in theory, but it would be good to
172 #       avoid having to have a system with hundreds of artifacts.
173 debian-integration:
174   image: debian:bullseye
175   <<: *debian-template
176   variables:
177     CHECK: "no"
178     CHUTNEY: "yes"
179     CHUTNEY_MAKE_TARGET: "test-network-all"
180     STEM: "yes"
181     ALL_BUGS_ARE_FATAL: "yes"
182   script:
183     - ./scripts/ci/ci-driver.sh
185 #####
186 # Tracing build on Debian stable.
187 debian-tracing:
188   image: debian:bullseye
189   <<: *debian-template
190   variables:
191     TRACING: "yes"
192     CHECK: "no"
193     DISTCHECK: "yes"
194   script:
195     - ./scripts/ci/ci-driver.sh
197 #####
198 # No-authority mode
199 debian-disable-dirauth:
200   image: debian:bullseye
201   <<: *debian-template
202   variables:
203     DISABLE_DIRAUTH: "yes"
204   script:
205     - ./scripts/ci/ci-driver.sh
207 #####
208 # No-relay mode
209 debian-disable-relay:
210   image: debian:bullseye
211   <<: *debian-template
212   variables:
213     DISABLE_RELAY: "yes"
214   script:
215     - ./scripts/ci/ci-driver.sh
217 #####
218 # NSS check on debian
219 debian-nss:
220   image: debian:bullseye
221   <<: *debian-template
222   variables:
223     NSS: "yes"
224   script:
225     - ./scripts/ci/ci-driver.sh
227 #####
228 # Debian packaging triggers for maintenance branches
229 debian-packaging-0.4.5:
230   stage: deploy
231   trigger:
232     project: tpo/core/debian/tor
233     branch: debian-0.4.5
234   rules:
235     - if: $CI_PROJECT_NAMESPACE == "tpo/core" &&
236           $CI_COMMIT_BRANCH == "maint-0.4.5"
237 debian-packaging-0.4.6:
238   stage: deploy
239   trigger:
240     project: tpo/core/debian/tor
241     branch: debian-0.4.6
242   rules:
243     - if: $CI_PROJECT_NAMESPACE == "tpo/core" &&
244           $CI_COMMIT_BRANCH == "maint-0.4.6"