summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: eb22efab6e3954b2a9e13491fb53a65215d79441 (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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
---
stages:
  - code-check
  - build
  - tests
  - package
  - benchmarks


variables:
  DOCKER_DRIVER: overlay

# Cache a folder between builds.
# Tox sets it to be our pip cache.
cache:
  untracked: true
  key: soledad-shared-pip-cache
  paths:
    - .cache/

before_script:
  - echo "Running on ${HOST_HOSTNAME:=$(hostname)}"


#
# "code-check" stage
#

code-check:
  stage: code-check
  except:
    - schedules
  image: 0xacab.org:4567/leap/soledad:latest
  script:
    - tox -e code-check


#
# "build" stage
#

build_docker_image:
  stage: build
  except:
    - schedules
  image: 0xacab.org:4567/leap/soledad:latest
  services:
    - docker:dind
  tags:
    - docker-in-docker
  script:
    - scripts/docker/build-docker-image.sh


#
# "tests" stage
#

tests:
  stage: tests
  except:
    - schedules
  image: 0xacab.org:4567/leap/soledad:latest
  services:
    - couchdb
  script:
    - tox -- --couch-url http://couchdb:5984

e2e:
  stage: tests
  except:
    - schedules
  image: 0xacab.org:4567/leap/soledad:latest
  script:
    - tox -e e2e


#
# "package" stage
#

.job_template: &package
  stage: package
  except:
    - schedules
  image: "0xacab.org:4567/leap/gitlab-buildpackage:build_${DIST}_${ARCH}"
  script:
    - /usr/bin/unbuffer scripts/packaging/run-packaging-ci-job.sh | /usr/bin/ts -s
    # sleep 1h to allow debugging of running container
    # - sleep 3600
  artifacts:
    expire_in: 1w
    paths:
      - '*_*.xz'
      - '*_*.dsc'
      - '*_amd64.changes'
      - '*.deb'
      - 'results/*'

package:amd64_jessie:
  variables:
    ARCH: "amd64"
    DIST: "jessie"
    REPONAMES: "platform,client"
    # Default is to fail on warnings, we disable it here
    # unless a manpage is included (see #8895)
    LINTIAN_OPTS: "--fail-on-warnings -X filename-length,manpages"
  <<: *package


package:amd64_stretch:
  variables:
    ARCH: "amd64"
    DIST: "stretch"
    REPONAMES: "platform,client"
    # Default is to fail on warnings, we disable it here
    # unless a manpage is included (see #8895)
    LINTIAN_OPTS: "--fail-on-warnings -X filename-length,manpages"
  <<: *package

package:amd64_buster:
  variables:
    ARCH: "amd64"
    DIST: "buster"
    REPONAMES: "platform,client"
    # Default is to fail on warnings, we disable it here
    # unless a manpage is included (see #8895)
    # Also, ignore the `build-depends-on-obsolete-package` tag
    # until we can deprecate jessie and take out the dh-systemd
    # build-depends (see #8963)
    LINTIAN_OPTS: "--fail-on-warnings -X filename-length,manpages --suppress-tags build-depends-on-obsolete-package"
  <<: *package

package:amd64_zesty:
  variables:
    ARCH: "amd64"
    DIST: "zesty"
    REPONAMES: "platform,client"
    # Default is to fail on warnings, we disable it here
    # unless a manpage is included (see #8895)
    LINTIAN_OPTS: "--fail-on-warnings -X filename-length,manpages"
  <<: *package

package:amd64_artful:
  variables:
    ARCH: "amd64"
    DIST: "artful"
    REPONAMES: "platform,client"
    # Default is to fail on warnings, we disable it here
    # unless a manpage is included (see #8895)
    LINTIAN_OPTS: "--fail-on-warnings -X filename-length,manpages"
  <<: *package


#
# "benchmarks" stage
#

.job_template: &benchmark
  stage: benchmarks
  only:
    - schedules
  image: 0xacab.org:4567/leap/soledad:latest
  tags:
    - benchmark
  services:
    - couchdb
  before_script:
    - git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA"
    - '[ -n "${BENCHMARK_ALL_COMMITS}" ] && git checkout origin/master scripts/benchmark/setup-all-commits-env.sh'
    - '[ -n "${BENCHMARK_ALL_COMMITS}" ] && ./scripts/benchmark/setup-all-commits-env.sh'
    - curl -s couchdb:5984
    # You can provide a $NETRC variable containing the creds for your
    # elasticsearch instance so it's protected from being leaked in the
    # CI console
    # We can't get it working inside docker for unknown reasons.
    # - echo "$NETRC" > /root/.netrc && chmod 600 /root/.netrc
    #
    # Add $PYTEST_OPTS to pytest.ini to allow posting benchmark tests
    # to an elasticsearch instance
    - echo "addopts=$PYTEST_OPTS" >> pytest.ini && chmod 600 pytest.ini
  after_script:
    # Output locally saved benchmarks if they exist
    - 'if [ -d .benchmarks ]; then find .benchmarks -type f -exec cat {} \; ; fi'

time-cpu:
  <<: *benchmark
  script:
    - scripts/benchmark/run-benchmarks-ci-job.sh benchmark-time-cpu

memory:
  <<: *benchmark
  script:
    - scripts/benchmark/run-benchmarks-ci-job.sh benchmark-memory

responsiveness:
  <<: *benchmark
  script:
    - scripts/benchmark/run-benchmarks-ci-job.sh responsiveness