forked from saltstack-formulas/consul-formula
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
137 lines (132 loc) · 5.72 KB
/
.gitlab-ci.yml
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
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
###############################################################################
# Define all YAML node anchors
###############################################################################
.node_anchors:
# `stage`
stage_lint: &stage_lint 'lint'
stage_release: &stage_release 'release'
stage_test: &stage_test 'test'
# `image`
image_commitlint: &image_commitlint 'myii/ssf-commitlint:11'
image_dindruby: &image_dindruby 'myii/ssf-dind-ruby:2.7.1-r3'
image_precommit: &image_precommit
name: 'myii/ssf-pre-commit:2.9.2'
entrypoint: ['/bin/bash', '-c']
image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release:15.14'
# `only` (also used for `except` where applicable)
only_branch_master: &only_branch_master ['master']
###############################################################################
# Define stages and global variables
###############################################################################
stages:
# - *stage_lint
# - *stage_test
- *stage_release
variables:
DOCKER_DRIVER: 'overlay2'
###############################################################################
# `lint` stage: `commitlint` & `pre-commit`
###############################################################################
# commitlint:
# stage: *stage_lint
# image: *image_commitlint
# script:
# # Add `upstream` remote to get access to `upstream/master`
# - 'git remote add upstream ${CI_PROJECT_URL}.git'
# - 'git fetch --all'
# # Run `commitlint`
# - 'commitlint --from "$(git merge-base upstream/master HEAD)"
# --to "${CI_COMMIT_SHA}"
# --verbose'
#
# pre-commit:
# stage: *stage_lint
# image: *image_precommit
# # https://pre-commit.com/#gitlab-ci-example
# variables:
# PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit'
# cache:
# key: '${CI_JOB_NAME}'
# paths:
# - '${PRE_COMMIT_HOME}'
# script:
# - 'pre-commit run --all-files --color always --verbose'
###############################################################################
# Define `test` template
###############################################################################
# .test_instance:
# stage: *stage_test
# image: *image_dindruby
# services:
# - 'docker:dind'
# # https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3
# # https://bundler.io/v1.16/bundle_config.html
# variables:
# BUNDLE_CACHE_PATH: '${CI_PROJECT_DIR}/.cache/bundler'
# BUNDLE_WITHOUT: 'production'
# cache:
# key: '${CI_JOB_STAGE}'
# paths:
# - '${BUNDLE_CACHE_PATH}'
# before_script:
# # TODO: This should work from the env vars above automatically
# - 'bundle config set path "${BUNDLE_CACHE_PATH}"'
# - 'bundle config set without "${BUNDLE_WITHOUT}"'
# - 'bundle install'
# script:
# # Alternative value to consider: `${CI_JOB_NAME}`
# - 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"'
###############################################################################
# `test` stage: each instance below uses the `test` template above
###############################################################################
# ## Define the rest of the matrix based on Kitchen testing
# # Make sure the instances listed below match up with
# # the `platforms` defined in `kitchen.yml`
# default-debian-10-master-py3: {extends: '.test_instance'}
# default-ubuntu-2004-master-py3: {extends: '.test_instance'}
# # default-ubuntu-1804-master-py3: {extends: '.test_instance'}
# default-centos-8-master-py3: {extends: '.test_instance'}
# default-fedora-32-master-py3: {extends: '.test_instance'}
# # default-fedora-31-master-py3: {extends: '.test_instance'}
# # default-opensuse-leap-152-master-py3: {extends: '.test_instance'}
# # default-amazonlinux-2-master-py3: {extends: '.test_instance'}
# # default-debian-10-3000-3-py3: {extends: '.test_instance'}
# # default-debian-9-3000-3-py3: {extends: '.test_instance'}
# # default-ubuntu-1804-3000-3-py3: {extends: '.test_instance'}
# # default-centos-8-3000-3-py3: {extends: '.test_instance'}
# # default-centos-7-3000-3-py3: {extends: '.test_instance'}
# # default-fedora-31-3000-3-py3: {extends: '.test_instance'}
# default-opensuse-leap-152-3000-3-py3: {extends: '.test_instance'}
# default-amazonlinux-2-3000-3-py3: {extends: '.test_instance'}
# # default-ubuntu-1804-3000-3-py2: {extends: '.test_instance'}
# # default-ubuntu-1604-3000-3-py2: {extends: '.test_instance'}
# # default-arch-base-latest-3000-3-py2: {extends: '.test_instance'}
# # default-debian-10-2019-2-py3: {extends: '.test_instance'}
# # default-debian-9-2019-2-py3: {extends: '.test_instance'}
# # default-ubuntu-1804-2019-2-py3: {extends: '.test_instance'}
# # default-ubuntu-1604-2019-2-py3: {extends: '.test_instance'}
# # default-centos-8-2019-2-py3: {extends: '.test_instance'}
# # default-centos-7-2019-2-py3: {extends: '.test_instance'}
# # default-fedora-31-2019-2-py3: {extends: '.test_instance'}
# # default-opensuse-leap-152-2019-2-py3: {extends: '.test_instance'}
# # default-amazonlinux-2-2019-2-py3: {extends: '.test_instance'}
# # default-centos-6-2019-2-py2: {extends: '.test_instance'}
# # default-amazonlinux-1-2019-2-py2: {extends: '.test_instance'}
# default-arch-base-latest-2019-2-py2: {extends: '.test_instance'}
###############################################################################
# `release` stage: `semantic-release`
###############################################################################
semantic-release:
only: *only_branch_master
stage: *stage_release
image: *image_semanticrelease
variables:
MAINTAINER_TOKEN: '${GH_TOKEN}'
script:
# Update `AUTHORS.md`
- '${HOME}/go/bin/maintainer contributor'
# Run `semantic-release`
- 'semantic-release'