Merge branch 'maint-0.3.5' into release-0.3.5
[tor.git] / .gitlab-ci.yml
blob176c71f8f0a792ce0a85b8ec968ab42e116610b7
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
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 .debian-template: &debian-template
58   <<: *artifacts-template
59   variables:
60     DEBIAN_FRONTEND: "noninteractive"
61   # TODO: Using "cache" in this way speeds up our downloads.  It would be
62   # even better, though, to start with a pre-upgraded debian image.
63   #
64   # TODO: Will we have to do this differently once we have more than one
65   # debian version that we're using?
66   cache:
67     key: apt
68     paths:
69       - apt-cache
70   before_script:
71     - *apt-template
72     # Install patches unconditionally.
73     - apt-get install
74         automake
75         build-essential
76         ca-certificates
77         git
78         libevent-dev
79         liblzma-dev
80         libscrypt-dev
81         libseccomp-dev
82         libssl-dev
83         pkg-config
84         python3
85         zlib1g-dev
86     # Install patches that we only need for some use cases.
87     - if [ "$ASCIIDOC" = yes ]; then apt-get install asciidoc xmlto; fi
88     - if [ "$DOXYGEN" = yes ]; then apt-get install doxygen; fi
89     - if [ "$STEM" = yes ]; then apt-get install timelimit; fi
90     - if [ "$CC" = clang ]; then apt-get install clang; fi
91     # TODO: This next line should not be debian-only.
92     - if [ "$STEM" = yes ]; then git clone --depth 1 https://git.torproject.org/stem.git ; export STEM_PATH="$(pwd)/stem"; fi
93     # TODO: This next line should not be debian-only.
94     - if [ "$CHUTNEY" = yes ]; then git clone --depth 1 https://git.torproject.org/chutney.git ;  export CHUTNEY_PATH="$(pwd)/chutney"; fi
96 # Minmal check on debian: just make, make check.
98 debian-minimal:
99   image: debian:stable
100   <<: *debian-template
101   script:
102     - ./scripts/ci/ci-driver.sh
104 #####
105 # Run "make check" with a hardened clang on debian stable.  This takes
106 # care of a hardening check, and a compile-with-clang check.
108 # TODO: This will be faster once we merge #40098 and #40099.
109 debian-hardened:
110   image: debian:testing
111   <<: *debian-template
112   variables:
113     HARDENING: "yes"
114     CC: "clang"
115   script:
116     - ./scripts/ci/ci-driver.sh
118 #####
119 # Distcheck on debian stable
120 debian-distcheck:
121   image: debian:stable
122   <<: *debian-template
123   variables:
124     DISTCHECK: "yes"
125     CHECK: "no"
126   script:
127     - ./scripts/ci/ci-driver.sh
129 #####
130 # Documentation tests on debian stable: doxygen and asciidoc.
131 debian-docs:
132   image: debian:stable
133   <<: *debian-template
134   variables:
135     DOXYGEN: "yes"
136     ASCIIDOC: "yes"
137     CHECK: "no"
138     RUN_STAGE_BUILD: "no"
139   script:
140     - ./scripts/ci/ci-driver.sh
142 #####
143 # Integration tests on debian stable: chutney and stem.
145 # TODO: It would be cool if this target didn't have to re-build tor, and
146 #       could instead re-use Tor from debian-minimal.  That can be done
147 #       with the 'artifacts' mechanism, in theory, but it would be good to
148 #       avoid having to have a system with hundreds of artifacts.
149 debian-integration:
150   image: debian:stable
151   <<: *debian-template
152   variables:
153     CHECK: "no"
154     CHUTNEY: "yes"
155     STEM: "yes"
156   script:
157     - ./scripts/ci/ci-driver.sh