summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: c1182f07c45847fd42b73c948631ef6b04bee4e5 (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
stages:
  - test
  - e2e
  - bundle
  - build_ui

variables:
  DOCKER_DRIVER: overlay

linux_test:
  image: 0xacab.org:4567/leap/soledad:latest
  stage: test
  script:
    - tox --recreate -e py27-dev
  tags:
    - linux

# Currently, our only OSX gitlab runner is unavailable too often
# and the tests fail in CI anyway so we disable it for now until
# we fix both.
#osx_test:
#  stage: test
#  allow_failure: true
#  script:
#    - tox --recreate -e py27-dev
#  tags:
#    - 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

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

e2e_tests:
  image: 0xacab.org:4567/leap/bitmask-dev:latest
  stage: e2e
  allow_failure: true
  script:
    - virtualenv venv
    - source venv/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: e2e
  before_script:
    - virtualenv venv
    - source venv/bin/activate
    - make dev-latest-all
    - make test_functional_setup
  script:
    - make test_functional
  artifacts:
    when: on_failure
    paths:
      - "/tmp/bitmask-test/artifacts/*"
    name: "Bitmask_linux64_${CI_BUILD_REF}_e2e_screenshots"
    expire_in: 1 month
  tags:
    - linux

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