summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 3b2f64493fed36cbba591bedf9fc81b5cdfb4b13 (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
---
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:
    - 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_tests:
  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
  tags:
    - linux

functional_tests:
  image: 0xacab.org:4567/leap/bitmask-dev:latest
  stage: functional
  dependencies:
      - e2e_tests
  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|grep tests/docker; then
        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}:latest tests/docker
        docker push ${CI_REGISTRY_IMAGE}:latest
      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