18642: ruby-bundler should not be installed
[arvados-formula.git] / .gitlab-ci.yml
1 # -*- coding: utf-8 -*-
2 # vim: ft=yaml
3
4 # Copyright (C) The Arvados Authors. All rights reserved.
5 #
6 # SPDX-License-Identifier: Apache-2.0
7 ---
8 ###############################################################################
9 # Define all YAML node anchors
10 ###############################################################################
11 .node_anchors:
12   # `only` (also used for `except` where applicable)
13   only_branch_main_parent_repo: &only_branch_main_parent_repo
14     - 'main@git.arvados.org/arvados-formula'
15   # `stage`
16   stage_lint: &stage_lint 'lint'
17   stage_release: &stage_release 'release'
18   stage_test: &stage_test 'test'
19   # `image`
20   image_commitlint: &image_commitlint 'myii/ssf-commitlint:11'
21   image_dindruby: &image_dindruby 'myii/ssf-dind-ruby:2.7.1-r3'
22   image_precommit: &image_precommit
23     name: 'myii/ssf-pre-commit:2.9.2'
24     entrypoint: ['/bin/bash', '-c']
25   image_rubocop: &image_rubocop 'pipelinecomponents/rubocop:latest'
26   image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release:15.14'
27   # `services`
28   services_docker_dind: &services_docker_dind
29     - 'docker:dind'
30   # `variables`
31   # https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3
32   # https://bundler.io/v1.16/bundle_config.html
33   variables_bundler: &variables_bundler
34     BUNDLE_CACHE_PATH: '${CI_PROJECT_DIR}/.cache/bundler'
35     BUNDLE_WITHOUT: 'production'
36   # `cache`
37   cache_bundler: &cache_bundler
38     key: '${CI_JOB_STAGE}'
39     paths:
40       - '${BUNDLE_CACHE_PATH}'
41
42 ###############################################################################
43 # Define stages and global variables
44 ###############################################################################
45 stages:
46   - *stage_lint
47   - *stage_test
48   - *stage_release
49 variables:
50   DOCKER_DRIVER: 'overlay2'
51
52 ###############################################################################
53 # `lint` stage: `commitlint`, `pre-commit` & `rubocop` (latest, failure allowed)
54 ###############################################################################
55 # Disable commitlint because Arvados does not follow this standard, it has
56 # its own, see https://dev.arvados.org/projects/arvados/wiki/Coding_Standards
57 # commitlint:
58 #   stage: *stage_lint
59 #   image: *image_commitlint
60 #   script:
61 #     # Add `upstream` remote to get access to `upstream/main`
62 #     - 'git remote add upstream
63 #        https://git.arvados.org/arvados-formula.git'
64 #     - 'git fetch --all'
65 #     # Set default commit hashes for `--from` and `--to`
66 #     - 'export COMMITLINT_FROM="$(git merge-base upstream/main HEAD)"'
67 #     - 'export COMMITLINT_TO="${CI_COMMIT_SHA}"'
68 #     # `coqbot` adds a merge commit to test PRs on top of the latest commit in
69 #     # the repo; amend this merge commit message to avoid failure
70 #     - |
71 #       if [ "${GITLAB_USER_LOGIN}" = "coqbot" ] \
72 #       && [ "${CI_COMMIT_BRANCH}" != "main" ]; then
73 #         git commit --amend -m \
74 #           'chore: reword coqbot merge commit message for commitlint'
75 #         export COMMITLINT_TO=HEAD
76 #       fi
77 #     # Run `commitlint`
78 #     - 'commitlint --from "${COMMITLINT_FROM}"
79 #                   --to   "${COMMITLINT_TO}"
80 #                   --verbose'
81
82 pre-commit:
83   stage: *stage_lint
84   image: *image_precommit
85   # https://pre-commit.com/#gitlab-ci-example
86   variables:
87     PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit'
88   cache:
89     key: '${CI_JOB_NAME}'
90     paths:
91       - '${PRE_COMMIT_HOME}'
92   script:
93     - 'pre-commit run --all-files --color always --verbose'
94
95 # Use a separate job for `rubocop` other than the one potentially run by `pre-commit`
96 # - The `pre-commit` check will only be available for formulas that pass the default
97 #   `rubocop` check -- and must continue to do so
98 # - This job is allowed to fail, so can be used for all formulas
99 # - Furthermore, this job uses all of the latest `rubocop` features & cops,
100 #   which will help when upgrading the `rubocop` linter used in `pre-commit`
101 rubocop:
102   allow_failure: true
103   stage: *stage_lint
104   image: *image_rubocop
105   script:
106     - 'rubocop -d -P -S --enable-pending-cops'
107
108 ###############################################################################
109 # Define `test` template
110 ###############################################################################
111 .test_instance:
112   stage: *stage_test
113   image: *image_dindruby
114   services: *services_docker_dind
115   variables: *variables_bundler
116   cache: *cache_bundler
117   before_script:
118     # TODO: This should work from the env vars above automatically
119     - 'bundle config set path "${BUNDLE_CACHE_PATH}"'
120     - 'bundle config set without "${BUNDLE_WITHOUT}"'
121     - 'bundle install'
122   script:
123     # Alternative value to consider: `${CI_JOB_NAME}`
124     - 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"'
125
126 ###############################################################################
127 # `test` stage: each instance below uses the `test` template above
128 ###############################################################################
129 ## Define the rest of the matrix based on Kitchen testing
130 # Make sure the instances listed below match up with
131 # the `platforms` defined in `kitchen.yml`
132 # Get this list with
133 # kitchen list |awk '{print $1": {extends: '.test_instance'}"}' |sort -r
134
135 workbench-ubuntu-2004-tiamat-py3: {extends: .test_instance}
136 # workbench-ubuntu-2004-master-py3: {extends: .test_instance}
137 # workbench-ubuntu-2004-3003.3-py3: {extends: .test_instance}
138 # workbench-ubuntu-2004-3002.7-py3: {extends: .test_instance}
139 # workbench-ubuntu-2004-3001.8-py3: {extends: .test_instance}
140 # workbench-ubuntu-1804-tiamat-py3: {extends: .test_instance}
141 workbench-ubuntu-1804-master-py3: {extends: .test_instance}
142 # workbench-ubuntu-1804-3003.3-py3: {extends: .test_instance}
143 # workbench-ubuntu-1804-3002.7-py3: {extends: .test_instance}
144 # workbench-ubuntu-1804-3001.8-py3: {extends: .test_instance}
145 # workbench-debian-11-tiamat-py3: {extends: .test_instance}
146 # workbench-debian-11-master-py3: {extends: .test_instance}
147 workbench-debian-11-3003.3-py3: {extends: .test_instance}
148 # workbench-debian-11-3002.7-py3: {extends: .test_instance}
149 # workbench-debian-10-tiamat-py3: {extends: .test_instance}
150 # workbench-debian-10-master-py3: {extends: .test_instance}
151 # workbench-debian-10-3003.3-py3: {extends: .test_instance}
152 workbench-debian-10-3002.7-py3: {extends: .test_instance}
153 # workbench-debian-10-3001.8-py3: {extends: .test_instance}
154 # workbench-centos-7-tiamat-py3: {extends: .test_instance}
155 # workbench-centos-7-master-py3: {extends: .test_instance}
156 # workbench-centos-7-3003.3-py3: {extends: .test_instance}
157 # workbench-centos-7-3002.7-py3: {extends: .test_instance}
158 workbench-centos-7-3001.8-py3: {extends: .test_instance}
159
160 # shell-ubuntu-2004-tiamat-py3: {extends: .test_instance}
161 shell-ubuntu-2004-master-py3: {extends: .test_instance}
162 # shell-ubuntu-2004-3003.3-py3: {extends: .test_instance}
163 # shell-ubuntu-2004-3002.7-py3: {extends: .test_instance}
164 # shell-ubuntu-2004-3001.8-py3: {extends: .test_instance}
165 # shell-ubuntu-1804-tiamat-py3: {extends: .test_instance}
166 # shell-ubuntu-1804-master-py3: {extends: .test_instance}
167 shell-ubuntu-1804-3003.3-py3: {extends: .test_instance}
168 # shell-ubuntu-1804-3002.7-py3: {extends: .test_instance}
169 # shell-ubuntu-1804-3001.8-py3: {extends: .test_instance}
170 # shell-debian-11-tiamat-py3: {extends: .test_instance}
171 # shell-debian-11-master-py3: {extends: .test_instance}
172 # shell-debian-11-3003.3-py3: {extends: .test_instance}
173 shell-debian-11-3002.7-py3: {extends: .test_instance}
174 # shell-debian-10-tiamat-py3: {extends: .test_instance}
175 # shell-debian-10-master-py3: {extends: .test_instance}
176 # shell-debian-10-3003.3-py3: {extends: .test_instance}
177 # shell-debian-10-3002.7-py3: {extends: .test_instance}
178 shell-debian-10-3001.8-py3: {extends: .test_instance}
179 shell-centos-7-tiamat-py3: {extends: .test_instance}
180 # shell-centos-7-master-py3: {extends: .test_instance}
181 # shell-centos-7-3003.3-py3: {extends: .test_instance}
182 # shell-centos-7-3002.7-py3: {extends: .test_instance}
183 # shell-centos-7-3001.8-py3: {extends: .test_instance}
184
185 # keepstore-ubuntu-2004-tiamat-py3: {extends: .test_instance}
186 # keepstore-ubuntu-2004-master-py3: {extends: .test_instance}
187 keepstore-ubuntu-2004-3003.3-py3: {extends: .test_instance}
188 # keepstore-ubuntu-2004-3002.7-py3: {extends: .test_instance}
189 # keepstore-ubuntu-2004-3001.8-py3: {extends: .test_instance}
190 # keepstore-ubuntu-1804-tiamat-py3: {extends: .test_instance}
191 # keepstore-ubuntu-1804-master-py3: {extends: .test_instance}
192 # keepstore-ubuntu-1804-3003.3-py3: {extends: .test_instance}
193 keepstore-ubuntu-1804-3002.7-py3: {extends: .test_instance}
194 # keepstore-ubuntu-1804-3001.8-py3: {extends: .test_instance}
195 keepstore-debian-11-tiamat-py3: {extends: .test_instance}
196 # keepstore-debian-11-master-py3: {extends: .test_instance}
197 # keepstore-debian-11-3003.3-py3: {extends: .test_instance}
198 # keepstore-debian-11-3002.7-py3: {extends: .test_instance}
199 # keepstore-debian-10-tiamat-py3: {extends: .test_instance}
200 # keepstore-debian-10-master-py3: {extends: .test_instance}
201 # keepstore-debian-10-3003.3-py3: {extends: .test_instance}
202 # keepstore-debian-10-3002.7-py3: {extends: .test_instance}
203 keepstore-debian-10-3001.8-py3: {extends: .test_instance}
204 # keepstore-centos-7-tiamat-py3: {extends: .test_instance}
205 # keepstore-centos-7-master-py3: {extends: .test_instance}
206 # keepstore-centos-7-3003.3-py3: {extends: .test_instance}
207 # keepstore-centos-7-3002.7-py3: {extends: .test_instance}
208 # keepstore-centos-7-3001.8-py3: {extends: .test_instance}
209
210 # api-ubuntu-2004-tiamat-py3: {extends: .test_instance}
211 # api-ubuntu-2004-master-py3: {extends: .test_instance}
212 # api-ubuntu-2004-3003.3-py3: {extends: .test_instance}
213 api-ubuntu-2004-3002.7-py3: {extends: .test_instance}
214 # api-ubuntu-2004-3001.8-py3: {extends: .test_instance}
215 # api-ubuntu-1804-tiamat-py3: {extends: .test_instance}
216 # api-ubuntu-1804-master-py3: {extends: .test_instance}
217 # api-ubuntu-1804-3003.3-py3: {extends: .test_instance}
218 # api-ubuntu-1804-3002.7-py3: {extends: .test_instance}
219 api-ubuntu-1804-3001.8-py3: {extends: .test_instance}
220 # api-debian-11-tiamat-py3: {extends: .test_instance}
221 # api-debian-11-master-py3: {extends: .test_instance}
222 api-debian-11-3003.3-py3: {extends: .test_instance}
223 # api-debian-11-3002.7-py3: {extends: .test_instance}
224 # api-debian-10-tiamat-py3: {extends: .test_instance}
225 # api-debian-10-master-py3: {extends: .test_instance}
226 # api-debian-10-3003.3-py3: {extends: .test_instance}
227 # api-debian-10-3002.7-py3: {extends: .test_instance}
228 # api-debian-10-3001.8-py3: {extends: .test_instance}
229 api-centos-7-tiamat-py3: {extends: .test_instance}
230 # api-centos-7-master-py3: {extends: .test_instance}
231 # api-centos-7-3003.3-py3: {extends: .test_instance}
232 # api-centos-7-3002.7-py3: {extends: .test_instance}
233 # api-centos-7-3001.8-py3: {extends: .test_instance}
234
235 ###############################################################################
236 # `release` stage: `semantic-release`
237 ###############################################################################
238 semantic-release:
239   only: *only_branch_main_parent_repo
240   stage: *stage_release
241   image: *image_semanticrelease
242   variables:
243     MAINTAINER_TOKEN: '${GH_TOKEN}'
244   script:
245     # Update `AUTHORS.md`
246     - '${HOME}/go/bin/maintainer contributor'
247     # Run `semantic-release`
248     - 'semantic-release'