[bug] missing bytes conversion
[bitmask-dev.git] / .gitlab-ci.yml
1 ---
2 stages:
3   - test
4   - e2e
5   - publish
6
7 variables:
8   DOCKER_DRIVER: overlay
9
10 # Cache gems in between stages for this pipeline only
11 cache:
12   key: "$CI_RUNNER_TAGS-$CI_COMMIT_REF_SLUG"
13   paths:
14     - .tox/py27-dev
15
16 linux_test:
17   image: 0xacab.org:4567/leap/bitmask-dev:latest
18   stage: test
19   script:
20     # In this first job, recreate the tox venv from scratch
21     # on start of every pipeline
22     - dpkg -l tox > /dev/null || apt-get -y --no-install-recommends install tox
23     - tox --recreate -e py27-dev
24   tags:
25     - linux
26
27 osx_test:
28   stage: test
29   allow_failure: true
30   script:
31     - ls -la /usr/bin/gpg
32     - /usr/local/bin/tox --recreate -e py27-dev
33   tags:
34     - yosemite
35     - osx
36
37 # disabling latest builds for now. should enable them when I can test
38 # the new docker builder w/o virtualenvs.
39 # bitmask_latest_bundle:
40 # image: 0xacab.org:4567/leap/docker/bitmask-bundler:latest
41 #  stage: publish
42 #  script:
43 #    - pkg/build_bundle_with_venv.sh
44 #    - mv "dist/bitmask-`cat pkg/next-version`" .
45 #  artifacts:
46 #    paths:
47 #      - "bitmask-`cat pkg/next-version`"
48 #    name: "Bitmask_linux64_latest_${CI_BUILD_REF}"
49 #    expire_in: 1 month
50 #  tags:
51 #    - linux
52
53 e2e_test_mail:
54   image: 0xacab.org:4567/leap/bitmask-dev:latest
55   stage: e2e
56   script:
57     - dpkg -l tox gnupg1 haveged  > /dev/null || apt-get -y --no-install-recommends install tox gnupg1 haveged
58     - tox -e py27-dev --notest
59     - source .tox/py27-dev/bin/activate
60     - make dev-latest-backend
61     - mkdir -p /root/.config/leap/
62     - make install_helpers
63     - make test_e2e_mail
64   tags:
65     - linux
66
67 e2e_test_vpn:
68   image: 0xacab.org:4567/leap/bitmask-dev:latest
69   stage: e2e
70   script:
71     - dpkg -l tox gnupg1 haveged  > /dev/null || apt-get -y --no-install-recommends install tox gnupg1 haveged
72     - tox -e py27-dev --notest
73     - source .tox/py27-dev/bin/activate
74     - make dev-latest-backend
75     - mkdir -p /root/.config/leap/
76     - make install_helpers
77     - make test_e2e_vpn
78   tags:
79     - linux
80
81 e2e_test_conditional_downloads:
82   image: 0xacab.org:4567/leap/bitmask-dev:latest
83   stage: e2e
84   allow_failure: true
85   script:
86     - dpkg -l tox gnupg1 haveged  > /dev/null || apt-get -y --no-install-recommends install tox gnupg1 haveged
87     - tox -e py27-dev --notest
88     - source .tox/py27-dev/bin/activate
89     - make dev-latest-backend
90     - mkdir -p /root/.config/leap/
91     - make install_helpers
92     - make test_e2e_conditional_downloads
93   tags:
94     - linux
95
96 functional_tests:
97   image: 0xacab.org:4567/leap/bitmask-dev:latest
98   stage: e2e
99   before_script:
100     - dpkg -l tox > /dev/null || apt-get -y --no-install-recommends install tox
101     - tox -e py27-dev --notest
102     - source .tox/py27-dev/bin/activate
103     - make dev-latest-all
104     - make test_functional_setup
105   script:
106     - make test_functional
107   artifacts:
108     when: on_failure
109     paths:
110       - failures
111     name: "Bitmask_linux64_${CI_BUILD_REF}_e2e_screenshots"
112     expire_in: 1 month
113   tags:
114     - linux
115
116 # This is Work In Progress
117 #functional_test_bundle:
118 #  image: 0xacab.org:4567/leap/bitmask-dev:latest
119 #  stage: test_bundle
120 #  allow_failure: true
121 #  script:
122 #    - TEST_MODE='bundle_ci' make test_functional
123 #  artifacts:
124 #    when: on_failure
125 #    paths:
126 #      - failures
127 #    name: "Bitmask_linux64_${CI_BUILD_REF}_e2e_screenshots"
128 #    expire_in: 1 month
129 #  tags:
130 #    - linux
131
132 build_ui:
133   image: 0xacab.org:4567/leap/bitmask-dev:latest
134   stage: e2e
135   script:
136     - cd ui && make dev-build
137   tags:
138     - linux
139   cache:
140     paths:
141     - ui/node_modules/
142
143 build_docker_image:
144   image: 0xacab.org:4567/leap/bitmask-dev:latest
145   stage: publish
146   services:
147     - docker:dind
148   tags:
149     - docker-in-docker
150   only:
151     - branches@leap/bitmask-dev
152   before_script:
153      - >
154        export LAST_COMMIT=$(curl -s --header "PRIVATE-TOKEN: ${LEAP_CODE_O_MATIC_PRIVATE_TOKEN}" https://0xacab.org/api/v4/projects/574/pipelines |
155        python -c "import sys, json; print json.load(sys.stdin)[1]['sha']")
156   script:
157     - >
158       if git diff $LAST_COMMIT HEAD --name-only | egrep '(tests/docker|.gitlab)' || [ "$CI_JOB_MANUAL" == "true" ] ; then
159         if [ "$CI_COMMIT_REF_SLUG" == "master" ]
160         then
161           TAG='latest'
162         else
163           TAG="$CI_COMMIT_REF_SLUG"
164         fi
165         docker --version
166         docker info
167         docker login -u gitlab-ci-token -e sysdev@leap.se -p $CI_JOB_TOKEN $CI_REGISTRY
168         docker build -t ${CI_REGISTRY_IMAGE}:${TAG} tests/docker
169         docker push ${CI_REGISTRY_IMAGE}:${TAG}
170       fi
171
172 build_docker_bundle_image:
173   image: 0xacab.org:4567/leap/docker/bitmask-bundler:latest
174   stage: publish
175   services:
176     - docker:dind
177   tags:
178     - docker-in-docker
179   only:
180     - branches@leap/bitmask-dev
181   before_script:
182      - >
183        export LAST_COMMIT=$(curl -s --header "PRIVATE-TOKEN: ${LEAP_CODE_O_MATIC_PRIVATE_TOKEN}" https://0xacab.org/api/v4/projects/574/pipelines |
184        python -c "import sys, json; print json.load(sys.stdin)[1]['sha']")
185   script:
186     - >
187       if git diff $LAST_COMMIT HEAD --name-only | egrep '(pkg/docker_bundle|.gitlab)' || [ "$CI_JOB_MANUAL" == "true" ] ; then
188         if [ "$CI_COMMIT_REF_SLUG" == "master" ]
189         then
190           TAG='latest'
191         else
192           TAG="$CI_COMMIT_REF_SLUG"
193         fi
194         docker --version
195         docker info
196         docker login -u gitlab-ci-token -e sysdev@leap.se -p $CI_JOB_TOKEN $CI_REGISTRY
197         docker build -t ${CI_REGISTRY_IMAGE}:${TAG} pkg/docker_bundle
198         docker push ${CI_REGISTRY_IMAGE}:${TAG}
199       fi
200
201 .job_template: &job_definition
202   stage: publish
203   # Only build packages for https://0xacab.org/leap/bitmask-dev, not
204   # for forks
205   only:
206     - master@leap/bitmask-dev
207     - tags@leap/bitmask-dev
208   image: "0xacab.org:4567/leap/gitlab-buildpackage:build_${DIST}_${ARCH}"
209   script:
210     - "pwd; git describe"
211     - build-build-package
212     # Test the package with lintian
213     - build-test-lintian
214     - upload-package
215     # sleep 1h to allow debugging of running container
216     #- sleep 3600
217   artifacts:
218     expire_in: 1w
219     paths:
220     - '*_*.xz'
221     - '*_*.dsc'
222     - '*_amd64.changes'
223     - '*.deb'
224     - 'results/*'
225
226 package:amd64_stretch:
227   variables:
228     ARCH: "amd64"
229     DIST: "stretch"
230     REPONAMES: "client"
231     # Default is to fail on warnings, we disable it here
232     # unless all lintian warnings are fixed (#9033)
233     LINTIAN_OPTS: "-X filename-length, --suppress-tags newer-standards-version"
234   <<: *job_definition
235
236 package:amd64_buster:
237   variables:
238     ARCH: "amd64"
239     DIST: "buster"
240     REPONAMES: "client"
241     # Default is to fail on warnings, we disable it here
242     # unless all lintian warnings are fixed (#9033)
243     LINTIAN_OPTS: "-X filename-length"
244   <<: *job_definition
245
246 package:amd64_sid:
247   variables:
248     ARCH: "amd64"
249     DIST: "sid"
250     REPONAMES: "client"
251     # Default is to fail on warnings, we disable it here
252     # unless all lintian warnings are fixed (#9033)
253     LINTIAN_OPTS: "-X filename-length, --suppress-tags newer-standards-version"
254   <<: *job_definition
255
256 package:amd64_artful:
257   variables:
258     ARCH: "amd64"
259     DIST: "artful"
260     REPONAMES: "client"
261     # Default is to fail on warnings, we disable it here
262     # unless all lintian warnings are fixed (#9033)
263     LINTIAN_OPTS: "-X filename-length, --suppress-tags newer-standards-version"
264   <<: *job_definition
265
266 package:amd64_bionic:
267   variables:
268     ARCH: "amd64"
269     DIST: "bionic"
270     REPONAMES: "client"
271     # Default is to fail on warnings, we disable it here
272     # unless all lintian warnings are fixed (#9033)
273     LINTIAN_OPTS: "-X filename-length, --suppress-tags newer-standards-version"
274   <<: *job_definition
275