fix lint clippy::arc_with_non_send_sync
[tor.git] / .gitlab-ci.yml
blob45142671aa6a8852dab4244980ddb1cbdc33254b
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
45     - physical
47 # This template should be usable on any system that's based on apt.
48 .apt-template: &apt-template |
49       export LC_ALL=C.UTF-8
50       echo Etc/UTC > /etc/timezone
51       mkdir -p apt-cache
52       export APT_CACHE_DIR="$(pwd)/apt-cache"
53       rm -f /etc/apt/apt.conf.d/docker-clean
54       echo 'quiet "1";' \
55            'Acquire::Retries "20";' \
56            'APT::Install-Recommends "0";' \
57            'APT::Install-Suggests "0";' \
58            'APT::Get::Assume-Yes "true";' \
59            'Dpkg::Use-Pty "0";' \
60            "Dir::Cache::Archives \"${APT_CACHE_DIR}\"; " \
61         >> /etc/apt/apt.conf.d/99gitlab
62       apt-get update -qq
63       apt-get upgrade -qy
65 # This template sets us up for Debian system in particular.
66 .debian-template: &debian-template
67   <<: *artifacts-template
68   <<: *x86-64-template
69   variables:
70     DEBIAN_FRONTEND: "noninteractive"
71   # TODO: Using "cache" in this way speeds up our downloads.  It would be
72   # even better, though, to start with a pre-upgraded debian image.
73   #
74   # TODO: Will we have to do this differently once we have more than one
75   # debian version that we're using?
76   cache:
77     key: apt
78     paths:
79       - apt-cache
80   before_script:
81     - *apt-template
82     # Install patches unconditionally.
83     - apt-get install
84         apt-utils
85         automake
86         build-essential
87         ca-certificates
88         file
89         git
90         libevent-dev
91         liblzma-dev
92         libscrypt-dev
93         libseccomp-dev
94         libssl-dev
95         pkg-config
96         python3
97         zlib1g-dev
98     # Install patches that we only need for some use cases.
99     - if [ "$ASCIIDOC" = yes ]; then apt-get install asciidoc xmlto; fi
100     - if [ "$DOXYGEN" = yes ]; then apt-get install doxygen; fi
101     - if [ "$STEM" = yes ]; then apt-get install timelimit; fi
102     - if [ "$CC" = clang ]; then apt-get install clang; fi
103     - if [ "$NSS" = yes ]; then apt-get install libnss3 libnss3-dev; fi
104     # llvm-symbolizer for sanitizer backtrace
105     - if [ "$HARDENING" = yes ]; then apt-get install llvm; fi
106     # TODO: This next line should not be debian-only.
107     - if [ "$STEM" = yes ]; then git clone --depth 1 https://gitlab.torproject.org/tpo/network-health/stem.git ; export STEM_PATH="$(pwd)/stem"; fi
108     # TODO: This next line should not be debian-only.
109     - if [ "$CHUTNEY" = yes ]; then git clone --depth 1 https://gitlab.torproject.org/tpo/core/chutney.git ;  export CHUTNEY_PATH="$(pwd)/chutney"; fi
110     - if [ "$TRACING" = yes ]; then apt install liblttng-ust-dev; fi
112 # Minimal check on debian: just make, make check.
114 debian-minimal:
115   image: debian:bullseye
116   <<: *debian-template
117   script:
118     - ./scripts/ci/ci-driver.sh
120 # Minimal check on debian/i386: just make, make check.
122 debian-i386-minimal:
123   image: i386/debian:bullseye
124   <<: *debian-template
125   script:
126     - ./scripts/ci/ci-driver.sh
128 #####
129 # Run "make check" with a hardened clang on debian stable.  This takes
130 # care of a hardening check, and a compile-with-clang check.
132 # TODO: This will be faster once we merge #40098 and #40099.
133 debian-hardened:
134   image: debian:bullseye
135   <<: *debian-template
136   variables:
137     ALL_BUGS_ARE_FATAL: "yes"
138     HARDENING: "yes"
139     CC: "clang"
140   script:
141     - ./scripts/ci/ci-driver.sh
143 #####
144 # Distcheck on debian stable
145 debian-distcheck:
146   image: debian:bullseye
147   <<: *debian-template
148   variables:
149     DISTCHECK: "yes"
150     CHECK: "no"
151   script:
152     - ./scripts/ci/ci-driver.sh
154 #####
155 # Documentation tests on debian stable: doxygen and asciidoc.
156 debian-docs:
157   image: debian:bullseye
158   <<: *debian-template
159   variables:
160     DOXYGEN: "yes"
161     ASCIIDOC: "yes"
162     CHECK: "no"
163     RUN_STAGE_BUILD: "no"
164   script:
165     - ./scripts/ci/ci-driver.sh
167 #####
168 # Integration tests on debian stable: chutney and stem.
170 # TODO: It would be cool if this target didn't have to re-build tor, and
171 #       could instead re-use Tor from debian-minimal.  That can be done
172 #       with the 'artifacts' mechanism, in theory, but it would be good to
173 #       avoid having to have a system with hundreds of artifacts.
174 debian-integration:
175   image: debian:bullseye
176   <<: *debian-template
177   variables:
178     CHECK: "no"
179     CHUTNEY: "yes"
180     CHUTNEY_MAKE_TARGET: "test-network-all"
181     STEM: "yes"
182     ALL_BUGS_ARE_FATAL: "yes"
183   script:
184     - ./scripts/ci/ci-driver.sh
186 #####
187 # Tracing build on Debian stable.
188 debian-tracing:
189   image: debian:bullseye
190   <<: *debian-template
191   variables:
192     TRACING: "yes"
193     CHECK: "no"
194     DISTCHECK: "yes"
195   script:
196     - ./scripts/ci/ci-driver.sh
198 #####
199 # No-authority mode
200 debian-disable-dirauth:
201   image: debian:bullseye
202   <<: *debian-template
203   variables:
204     DISABLE_DIRAUTH: "yes"
205   script:
206     - ./scripts/ci/ci-driver.sh
208 #####
209 # No-relay mode
210 debian-disable-relay:
211   image: debian:bullseye
212   <<: *debian-template
213   variables:
214     DISABLE_RELAY: "yes"
215   script:
216     - ./scripts/ci/ci-driver.sh
218 #####
219 # GPL licensed mode, enables pow module
220 debian-gpl:
221   image: debian:buster
222   <<: *debian-template
223   variables:
224     GPL: "yes"
225   script:
226     - ./scripts/ci/ci-driver.sh
228 #####
229 # NSS check on debian
230 debian-nss:
231   image: debian:bullseye
232   <<: *debian-template
233   variables:
234     NSS: "yes"
235   script:
236     - ./scripts/ci/ci-driver.sh
238 #####
239 # Debian packaging triggers for maintenance branches
240 debian-packaging-0.4.5:
241   stage: deploy
242   trigger:
243     project: tpo/core/debian/tor
244     branch: debian-0.4.5
245   rules:
246     - if: $CI_PROJECT_NAMESPACE == "tpo/core" &&
247           $CI_COMMIT_BRANCH == "maint-0.4.5"
248 debian-packaging-0.4.6:
249   stage: deploy
250   trigger:
251     project: tpo/core/debian/tor
252     branch: debian-0.4.6
253   rules:
254     - if: $CI_PROJECT_NAMESPACE == "tpo/core" &&
255           $CI_COMMIT_BRANCH == "maint-0.4.6"
257 #####
258 # Run tests written in Rust, and run clippy on all Rust code here.
259 rust-latest:
260   image: rust:latest
261   <<: *debian-template
262   script:
263     - apt-get install llvm-dev libclang-dev clang
264     - rustup show
265     - cargo build --locked --verbose
266     - cargo test --verbose
267     - rustup component add clippy
268     - rustup show
269     - cargo clippy --all-features --all-targets -- -D warnings
270   after_script:
271     - cargo clean