Add stream ID to ADDRMAP control event
[tor.git] / .gitlab-ci.yml
blob8afd090a58aea1cf573e40ceceee4a5ceca26762
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/
40 # This template should be usable on any system that's based on apt.
41 .apt-template: &apt-template |
42       export LC_ALL=C.UTF-8
43       echo Etc/UTC > /etc/timezone
44       mkdir -p apt-cache
45       export APT_CACHE_DIR="$(pwd)/apt-cache"
46       echo 'quiet "1";' \
47            'APT::Install-Recommends "0";' \
48            'APT::Install-Suggests "0";' \
49            'APT::Acquire::Retries "20";' \
50            'APT::Get::Assume-Yes "true";' \
51            'Dpkg::Use-Pty "0";' \
52            "Dir::Cache::Archives \"${APT_CACHE_DIR}\"; " \
53         >> /etc/apt/apt.conf.d/99gitlab
54       apt-get update -qq
55       apt-get upgrade -qy
57 # This template sets us up for Debian system in particular.
58 .debian-template: &debian-template
59   <<: *artifacts-template
60   variables:
61     DEBIAN_FRONTEND: "noninteractive"
62   # TODO: Using "cache" in this way speeds up our downloads.  It would be
63   # even better, though, to start with a pre-upgraded debian image.
64   #
65   # TODO: Will we have to do this differently once we have more than one
66   # debian version that we're using?
67   cache:
68     key: apt
69     paths:
70       - apt-cache
71   before_script:
72     - *apt-template
73     # Install patches unconditionally.
74     - apt-get install
75         automake
76         build-essential
77         ca-certificates
78         git
79         libevent-dev
80         liblzma-dev
81         libscrypt-dev
82         libseccomp-dev
83         libssl-dev
84         pkg-config
85         python3
86         zlib1g-dev
87     # Install patches that we only need for some use cases.
88     - if [ "$ASCIIDOC" = yes ]; then apt-get install asciidoc xmlto; fi
89     - if [ "$DOXYGEN" = yes ]; then apt-get install doxygen; fi
90     - if [ "$STEM" = yes ]; then apt-get install timelimit; fi
91     - if [ "$CC" = clang ]; then apt-get install clang; fi
92     - if [ "$NSS" = yes ]; then apt-get install libnss3 libnss3-dev; fi
93     # TODO: This next line should not be debian-only.
94     - if [ "$STEM" = yes ]; then git clone --depth 1 https://git.torproject.org/stem.git ; export STEM_PATH="$(pwd)/stem"; fi
95     # TODO: This next line should not be debian-only.
96     - if [ "$CHUTNEY" = yes ]; then git clone --depth 1 https://git.torproject.org/chutney.git ;  export CHUTNEY_PATH="$(pwd)/chutney"; fi
97     - if [ "$TRACING" = yes ]; then apt install liblttng-ust-dev; fi
99 # Minimal check on debian: just make, make check.
101 debian-minimal:
102   image: debian:stable
103   <<: *debian-template
104   script:
105     - ./scripts/ci/ci-driver.sh
107 #####
108 # Run "make check" with a hardened clang on debian stable.  This takes
109 # care of a hardening check, and a compile-with-clang check.
111 # TODO: This will be faster once we merge #40098 and #40099.
112 debian-hardened:
113   image: debian:testing
114   <<: *debian-template
115   variables:
116     ALL_BUGS_ARE_FATAL: "yes"
117     HARDENING: "yes"
118     CC: "clang"
119   script:
120     - ./scripts/ci/ci-driver.sh
122 #####
123 # Distcheck on debian stable
124 debian-distcheck:
125   image: debian:stable
126   <<: *debian-template
127   variables:
128     DISTCHECK: "yes"
129     CHECK: "no"
130   script:
131     - ./scripts/ci/ci-driver.sh
133 #####
134 # Documentation tests on debian stable: doxygen and asciidoc.
135 debian-docs:
136   image: debian:stable
137   <<: *debian-template
138   variables:
139     DOXYGEN: "yes"
140     ASCIIDOC: "yes"
141     CHECK: "no"
142     RUN_STAGE_BUILD: "no"
143   script:
144     - ./scripts/ci/ci-driver.sh
146 #####
147 # Integration tests on debian stable: chutney and stem.
149 # TODO: It would be cool if this target didn't have to re-build tor, and
150 #       could instead re-use Tor from debian-minimal.  That can be done
151 #       with the 'artifacts' mechanism, in theory, but it would be good to
152 #       avoid having to have a system with hundreds of artifacts.
153 debian-integration:
154   image: debian:stable
155   <<: *debian-template
156   variables:
157     CHECK: "no"
158     CHUTNEY: "yes"
159     CHUTNEY_MAKE_TARGET: "test-network-all"
160     STEM: "yes"
161     ALL_BUGS_ARE_FATAL: "yes"
162   script:
163     - ./scripts/ci/ci-driver.sh
165 #####
166 # Tracing build on Debian stable.
167 debian-tracing:
168   image: debian:stable
169   <<: *debian-template
170   variables:
171     TRACING: "yes"
172     CHECK: "no"
173     DISTCHECK: "yes"
174   script:
175     - ./scripts/ci/ci-driver.sh
176   # Ensure that we only run tracing when it's implemented.
177   #
178   # Once versions before 0.4.5 are obsolete, we can remove this test.
179   rules:
180     # This first "if" check prevents us from running a duplicate version of
181     # this pipeline whenever we push and create an MR.  I don't understand why
182     # it is necessary, though the following URL purports to explain:
183     #
184     # https://docs.gitlab.com/ee/ci/yaml/#prevent-duplicate-pipelines
185     - if: '$CI_PIPELINE_SOURCE == "push"'
186       exists:
187         - src/lib/trace/trace_sys.c
189 #####
190 # No-authority mode
191 debian-disable-dirauth:
192   image: debian:stable
193   <<: *debian-template
194   variables:
195     DISABLE_DIRAUTH: "yes"
196   script:
197     - ./scripts/ci/ci-driver.sh
199 #####
200 # No-relay mode
201 debian-disable-relay:
202   image: debian:stable
203   <<: *debian-template
204   variables:
205     DISABLE_RELAY: "yes"
206   script:
207     - ./scripts/ci/ci-driver.sh
208   # Ensure that we only run tracing when it's implemented.
209   #
210   # Once versions before 0.4.3 are obsolete, we can remove this test.
211   rules:
212     # This first "if" check prevents us from running a duplicate version of
213     # this pipeline whenever we push and create an MR.  I don't understand why
214     # it is necessary, though the following URL purports to explain:
215     #
216     # https://docs.gitlab.com/ee/ci/yaml/#prevent-duplicate-pipelines
217     - if: '$CI_PIPELINE_SOURCE == "push"'
218       exists:
219         - src/feature/relay/relay_stub.c
221 #####
222 # NSS check on debian
223 debian-nss:
224   image: debian:stable
225   <<: *debian-template
226   variables:
227     NSS: "yes"
228   script:
229     - ./scripts/ci/ci-driver.sh