CI: Disable global caching and use default caching
[leap_platform.git] / .gitlab-ci.yml
1 ---
2 image: 0xacab.org:4567/leap/docker/ruby:latest
3
4 cache:
5   untracked: true
6   paths:
7     # Cache gems
8     - tests/platform-ci/vendor/
9
10 before_script:
11   - cd tests/platform-ci
12   # Check if running locally ($CI_PROJECT_ID is 0 then) and run setup.sh in
13   # this case
14   - if [ "$CI_PROJECT_ID" = "0" ]; then ./setup.sh; fi
15
16 stages:
17   - setup
18   - syntax
19   - deploy
20
21 setup:
22   stage: setup
23   script:
24     - ./setup.sh
25
26 lint:
27   stage: syntax
28   script:
29     - su -c '/usr/local/bin/bundle exec rake lint' cirunner
30
31 syntax:
32   stage: syntax
33   script:
34     - su -c '/usr/local/bin/bundle exec rake syntax' cirunner
35
36 validate:
37   stage: syntax
38   script:
39     - su -c '/usr/local/bin/bundle exec rake validate' cirunner
40
41 templates:
42   stage: syntax
43   script:
44     - su -c '/usr/local/bin/bundle exec rake templates' cirunner
45
46 catalog:
47   stage: syntax
48   script:
49     - su -c '/usr/local/bin/bundle exec rake catalog' cirunner
50
51 deploy_test:master:
52   stage: deploy
53   except:
54     - master
55   script:
56     - su -c 'set -o pipefail; stdbuf -oL -eL ./ci-build.sh | ts' cirunner
57
58 deploy_test:staging:
59   stage: deploy
60   variables:
61     COMPONENT: "staging"
62   script:
63     - su -c 'set -o pipefail; stdbuf -oL -eL ./ci-build.sh | ts' cirunner
64
65 # However, sometimes it's important to have a way of triggering a deploy
66 # from scratch manually even from the master branch, when i.e. new packages
67 # got uploaded to the master component of the platform deb repo.
68 deploy_test:manual:
69   stage: deploy
70   only:
71     - master
72   when: manual
73   allow_failure: false
74   script:
75     - su -c 'set -o pipefail; stdbuf -oL -eL ./ci-build.sh | ts' cirunner
76
77 # Test upgrades from the latetest release to latest HEAD
78 upgrade_test:
79   stage: deploy
80   script:
81     # Allow unpriviledged user to checkout last release of leap_platform
82     - chown cirunner:cirunner -R ../..
83     - su -c 'set -o pipefail; stdbuf -oL -eL ./ci-build.sh | ts' cirunner
84
85 # Latest job will only run on the master branch, which means all merge requests
86 # that are created from branches don't get to deploy to the latest-ci server.
87 # When a merge request is merged, then the latest job will deploy the code to
88 # the latest provider, and the deployment will be recorded in an environment
89 # named 'latest'
90 ci.leap.se:
91   stage: deploy
92   environment:
93     name: staging
94   only:
95     - master@leap/platform
96   script:
97     - >
98       su -c '/usr/bin/unbuffer /bin/bash -o pipefail ./ci-build.sh |
99       /usr/bin/ts' cirunner
100
101 demo.bitmask.net:
102   stage: deploy
103   environment:
104     name: production/demo/vpn
105   only:
106     - master
107   when: manual
108   script:
109     - >
110       su -c '/usr/bin/unbuffer /bin/bash -o pipefail ./ci-build.sh |
111       /usr/bin/ts' cirunner
112
113 mail.bitmask.net:
114   stage: deploy
115   environment:
116     name: production/demo/mail
117   only:
118     - master
119   when: manual
120   script:
121     - >
122       su -c '/usr/bin/unbuffer /bin/bash -o pipefail ./ci-build.sh |
123       /usr/bin/ts' cirunner