summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 70de33b5ffaacd3ebc35d07894349cfd1eda376b (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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
---
stages:
  - test
  - e2e
  - functional
  - bundle
#  - test_bundle
  - build_ui
  - package

variables:
  DOCKER_DRIVER: overlay

# Cache gems in between stages for this pipeline only
cache:
  key: "$CI_PIPELINE_ID"
  paths:
    - .tox/py27-dev

linux_test:
  image: 0xacab.org:4567/leap/bitmask-dev:latest
  stage: test
  script:
    # In this first job, recreate the tox venv from scratch
    # on start of every pipeline
    - dpkg -l tox > /dev/null || apt-get -y --no-install-recommends install tox
    - tox --recreate -e py27-dev
  tags:
    - linux

osx_test:
  stage: test
  allow_failure: true
  script:
    - ls -la /usr/bin/gpg
    - /usr/local/bin/tox --recreate -e py27-dev
  tags:
    - yosemite
    - osx

bitmask_latest_bundle:
  image: 0xacab.org:4567/leap/bitmask-dev:latest
  stage: bundle
  script:
    - pkg/build_bundle_with_venv.sh
    - mv "dist/bitmask-`cat pkg/next-version`" .
  artifacts:
    paths:
      - "bitmask-`cat pkg/next-version`"
    name: "Bitmask_linux64_latest_${CI_BUILD_REF}"
    expire_in: 1 month
  tags:
    - linux

e2e_test_mail:
  image: 0xacab.org:4567/leap/bitmask-dev:latest
  stage: e2e
  allow_failure: true
  dependencies:
      - linux_test
  script:
    - dpkg -l tox gnupg1 haveged  > /dev/null || apt-get -y --no-install-recommends install tox gnupg1 haveged
    - tox -e py27-dev --notest
    - source .tox/py27-dev/bin/activate
    - make dev-latest-backend
    - mkdir -p /root/.config/leap/
    - make install_helpers
    - make test_e2e_mail
  tags:
    - linux

e2e_test_vpn:
  image: 0xacab.org:4567/leap/bitmask-dev:latest
  stage: e2e
  allow_failure: true
  dependencies:
      - linux_test
  script:
    - dpkg -l tox gnupg1 haveged  > /dev/null || apt-get -y --no-install-recommends install tox gnupg1 haveged
    - tox -e py27-dev --notest
    - source .tox/py27-dev/bin/activate
    - make dev-latest-backend
    - mkdir -p /root/.config/leap/
    - make install_helpers
    - make test_e2e_vpn
  tags:
    - linux

e2e_test_conditional_downloads:
  image: 0xacab.org:4567/leap/bitmask-dev:latest
  stage: e2e
  allow_failure: true
  dependencies:
      - linux_test
  script:
    - dpkg -l tox gnupg1 haveged  > /dev/null || apt-get -y --no-install-recommends install tox gnupg1 haveged
    - tox -e py27-dev --notest
    - source .tox/py27-dev/bin/activate
    - make dev-latest-backend
    - mkdir -p /root/.config/leap/
    - make install_helpers
    - make test_e2e_conditional_downloads
  tags:
    - linux

functional_tests:
  image: 0xacab.org:4567/leap/bitmask-dev:latest
  stage: functional
  before_script:
    - dpkg -l tox > /dev/null || apt-get -y --no-install-recommends install tox
    - tox -e py27-dev --notest
    - source .tox/py27-dev/bin/activate
    - make dev-latest-all
    - make test_functional_setup
  script:
    - make test_functional
  artifacts:
    when: on_failure
    paths:
      - failures
    name: "Bitmask_linux64_${CI_BUILD_REF}_e2e_screenshots"
    expire_in: 1 month
  tags:
    - linux

# This is Work In Progress
#functional_test_bundle:
#  image: 0xacab.org:4567/leap/bitmask-dev:latest
#  stage: test_bundle
#  allow_failure: true
#  dependencies:
#    - bitmask_latest_bundle
#  script:
#    - TEST_MODE='bundle_ci' make test_functional
#  artifacts:
#    when: on_failure
#    paths:
#      - failures
#    name: "Bitmask_linux64_${CI_BUILD_REF}_e2e_screenshots"
#    expire_in: 1 month
#  tags:
#    - linux

build_ui:
  image: 0xacab.org:4567/leap/bitmask-dev:latest
  stage: build_ui
  script:
    - cd ui && make dev-build
  tags:
    - linux
  cache:
    paths:
    - ui/node_modules/

build_docker_image:
  image: 0xacab.org:4567/leap/bitmask-dev:latest
  stage: test
  services:
    - docker:dind
  tags:
    - docker-in-docker
  only:
    - branches@leap/bitmask-dev
  before_script:
     - >
       export LAST_COMMIT=$(curl -s --header "PRIVATE-TOKEN: ${LEAP_CODE_O_MATIC_PRIVATE_TOKEN}" https://0xacab.org/api/v4/projects/574/pipelines |
       python -c "import sys, json; print json.load(sys.stdin)[1]['sha']")
  script:
    - >
      if git diff $LAST_COMMIT HEAD --name-only | egrep '(tests/docker|.gitlab)'; then
        if [ "$CI_COMMIT_REF_SLUG" == "master" ]
        then
          TAG='latest'
        else
          TAG="$CI_COMMIT_REF_SLUG"
        fi
        docker --version
        docker info
        docker login -u gitlab-ci-token -e sysdev@leap.se -p $CI_JOB_TOKEN $CI_REGISTRY
        docker build -t ${CI_REGISTRY_IMAGE}:${TAG} tests/docker
        docker push ${CI_REGISTRY_IMAGE}:${TAG}
      fi

.job_template: &job_definition
  stage: package
  image: "0xacab.org:4567/leap/gitlab-buildpackage:build_${DIST}_${ARCH}"
  script:
    - "pwd; git describe"
    - build-build-package
    # Test the package with lintian
    - build-test-lintian
    - upload-package
    # sleep 1h to allow debugging of running container
    #- sleep 3600
  artifacts:
    expire_in: 1w
    paths:
    - '*_*.xz'
    - '*_*.dsc'
    - '*_amd64.changes'
    - '*.deb'
    - 'results/*'

package:amd64_stretch:
  variables:
    ARCH: "amd64"
    DIST: "stretch"
    REPONAMES: "client"
    # Default is to fail on warnings, we disable it here
    # unless all lintian warnings are fixed (#9033)
    LINTIAN_OPTS: "-X filename-length, --suppress-tags newer-standards-version"
  <<: *job_definition

package:amd64_buster:
  variables:
    ARCH: "amd64"
    DIST: "buster"
    REPONAMES: "client"
    # Default is to fail on warnings, we disable it here
    # unless all lintian warnings are fixed (#9033)
    LINTIAN_OPTS: "-X filename-length"
  <<: *job_definition

package:amd64_sid:
  variables:
    ARCH: "amd64"
    DIST: "sid"
    REPONAMES: "client"
    # Default is to fail on warnings, we disable it here
    # unless all lintian warnings are fixed (#9033)
    LINTIAN_OPTS: "-X filename-length, --suppress-tags newer-standards-version"
  <<: *job_definition

package:amd64_zesty:
  variables:
    ARCH: "amd64"
    DIST: "zesty"
    REPONAMES: "client"
    # Default is to fail on warnings, we disable it here
    # unless all lintian warnings are fixed (#9033)
    LINTIAN_OPTS: "-X filename-length, --suppress-tags newer-standards-version"
  <<: *job_definition

package:amd64_artful:
  variables:
    ARCH: "amd64"
    DIST: "artful"
    REPONAMES: "client"
    # Default is to fail on warnings, we disable it here
    # unless all lintian warnings are fixed (#9033)
    LINTIAN_OPTS: "-X filename-length, --suppress-tags newer-standards-version"
  <<: *job_definition