summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 8ed615687b920c0531d08bab5c3dbe48b3014535 (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
####
# DO NOT EDIT THIS FILE IN MASTER.  ONLY EDIT IT IN THE OLDEST SUPPORTED
# BRANCH, THEN MERGE FORWARD.
####

# This file controls how gitlab validates Tor commits and merge requests.
#
# It is primarily based on a set of scripts and configurations by
# Hans-Christoph Steiner.  It only copies parts of those scripts and
# configurations for now.  If you want a new piece of functionality
# (more debians, more fedoras, android support) then you shouldn't
# start from scratch: have a look at the original ticket, at
# https://gitlab.torproject.org/tpo/core/tor/-/issues/32193 !
#
# The file to copy from is
# https://gitlab.torproject.org/tpo/core/tor/-/merge_requests/96/diffs#diff-content-587d266bb27a4dc3022bbed44dfa19849df3044c
#
# Having said that, if there is anything really stupid here, don't
# blame it on Hans-Christoph! Tor probably added it on their own.
#
# Copyright 2020, The Tor Project, Inc.
# See LICENSE for licence information.

# These variables are set everywhere, unconditionally.
variables:
  TERM: "ansi"
  DEBUG_CI: "yes"

# This template is for exporting ephemeral things from the scripts.  By
# convention we expect our scripts to copy stuff into artifacts/, rather than
# having a big list of files that be treated as artifacts.
.artifacts-template: &artifacts-template
  artifacts:
    name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}"
    expire_in: 1 week
    when: always
    paths:
      - artifacts/

.apt-template: &apt-template |
      export LC_ALL=C.UTF-8
      echo Etc/UTC > /etc/timezone
      mkdir -p apt-cache
      export APT_CACHE_DIR="$(pwd)/apt-cache"
      echo 'quiet "1";' \
           'APT::Install-Recommends "0";' \
           'APT::Install-Suggests "0";' \
           'APT::Acquire::Retries "20";' \
           'APT::Get::Assume-Yes "true";' \
           'Dpkg::Use-Pty "0";' \
           "Dir::Cache::Archives \"${APT_CACHE_DIR}\"; " \
        >> /etc/apt/apt.conf.d/99gitlab
      apt-get update -qq
      apt-get upgrade -qy

.debian-template: &debian-template
  <<: *artifacts-template
  variables:
    DEBIAN_FRONTEND: "noninteractive"
  cache:
    key: apt
    paths:
      - apt-cache
  before_script:
    - *apt-template
    - apt-get install
        automake
        build-essential
        ca-certificates
        git
        libevent-dev
        liblzma-dev
        libscrypt-dev
        libseccomp-dev
        libssl-dev
        pkg-config
        python3
        zlib1g-dev
    - if [ "$ASCIIDOC" = yes ]; then apt-get install asciidoc xmlto; fi
    - if [ "$DOXYGEN" = yes ]; then apt-get install doxygen; fi
    - if [ "$STEM" = yes ]; then apt-get install timelimit; fi
    - if [ "$CC" = clang ]; then apt-get install clang; fi
    - if [ "$STEM" = yes ]; then git clone --depth 1 https://git.torproject.org/stem.git ; export STEM_PATH="$(pwd)/stem"; fi
    - if [ "$CHUTNEY" = yes ]; then git clone --depth 1 https://git.torproject.org/chutney.git ;  export CHUTNEY_PATH="$(pwd)/chutney"; fi

debian-minimal:
  image: debian:stable
  <<: *debian-template
  script:
    - ./scripts/ci/ci-driver.sh


# TODO: This one just takes too long to finish right now!
# Maybe we need to divide the call to ./src/test/test into a few segments,
# that all end in similar amount of time?
debian-hardened:
  image: debian:testing
  <<: *debian-template
  variables:
    HARDENING: "yes"
    CC: "clang"
  script:
    - ./scripts/ci/ci-driver.sh

debian-distcheck:
  image: debian:stable
  <<: *debian-template
  variables:
    DISTCHECK: "yes"
    CHECK: "no"
  script:
    - ./scripts/ci/ci-driver.sh

debian-docs:
  image: debian:stable
  <<: *debian-template
  variables:
    DOXYGEN: "yes"
    ASCIIDOC: "yes"
    CHECK: "no"
    RUN_STAGE_BUILD: "no"
  script:
    - ./scripts/ci/ci-driver.sh

debian-integration:
  image: debian:stable
  <<: *debian-template
  variables:
    CHECK: "no"
    CHUTNEY: "yes"
    # STEM: "yes" -- currently failing on <044.
  script:
    - ./scripts/ci/ci-driver.sh