This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
108 lines (94 loc) · 4.21 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
---
stages:
- 'validation'
default:
image: ruby:2.6
.setup_bundler_env: &setup_bundler_env
before_script:
# Diagnostic ruby & gem information
- 'which ruby && ruby --version || :'
- "[[ $- == *i* ]] && echo 'Interactive shell session' || echo 'Non-interactive shell session'"
- "shopt -q login_shell && echo 'Login shell' || echo 'Not a login shell'"
- 'rvm ls || :'
# If RVM is available, make SURE it's using the right Ruby:
# * Source rvm (to run in non-login shells)
- "command -v rvm && { if declare -p rvm_path &> /dev/null; then source \"${rvm_path}/scripts/rvm\"; else source \"$HOME/.rvm/scripts/rvm\" || source /etc/profile.d/rvm.sh; fi; }"
- 'ruby --version || :'
- 'gem list sync || :'
# Bundle gems (preferring cached > local > downloaded resources)
# * Try to use cached and local resources before downloading dependencies
- 'declare GEM_BUNDLER_VER=(-v "~> ${BUNDLER_VERSION:-1.17.1}")'
- 'declare GEM_INSTALL_CMD=(gem install --no-document)'
- 'declare BUNDLER_INSTALL_CMD=(bundle install --no-binstubs --jobs $(nproc) "${FLAGS[@]}")'
- 'mkdir -p ${GEM_HOME} ${BUNDLER_BIN}'
- 'gem list -ie "${GEM_BUNDLER_VER[@]}" --silent bundler || "${GEM_INSTALL_CMD[@]}" --local "${GEM_BUNDLER_VER[@]}" bundler || "${GEM_INSTALL_CMD[@]}" "${GEM_BUNDLER_VER[@]}" bundler'
- 'rm -rf pkg/ || :'
- 'bundle check || rm -f Gemfile.lock && ("${BUNDLER_INSTALL_CMD[@]}" --local || "${BUNDLER_INSTALL_CMD[@]}" || bundle pristine || "${BUNDLER_INSTALL_CMD[@]}") || { echo "PIPELINE: Bundler could not install everything (see log output above)" && exit 99 ; }'
# Diagnostic bundler, ruby, and gem checks:
- 'bundle exec rvm ls || :'
- 'bundle exec which ruby || :'
- 'bundle show sync || :'
- 'bundle exec gem list sync || :'
# Testing Environments
#-----------------------------------------------------------------------
json_lint:
stage: 'validation'
tags: ['docker']
<<: *setup_bundler_env
script:
- 'command -v jq || if command -v apt-get; then apt-get update; apt-get install -y jq; fi ||:'
- bash -c 'for json in $(find . -type f -name "*.json"); do echo "== $json" && jq . "$json"; done'
shell_lint:
stage: 'validation'
tags: ['docker']
<<: *setup_bundler_env
script:
- 'command -v shellcheck || if command -v apt-get; then apt-get update; apt-get install -y shellcheck; fi ||:'
- bash -c 'find . -type f -name "*.sh" | xargs shellcheck'
allow_failure: true
yaml_lint:
stage: 'validation'
tags: ['docker']
<<: *setup_bundler_env
script:
- 'gem install --conservative --minimal-deps yaml-lint'
- bash -c 'find . -type f -name "*.yaml" -o -name "*.yml" | xargs yaml-lint'
bolt_lint:
stage: 'validation'
tags: ['docker']
script:
- 'command -v dpkg && wget https://apt.puppet.com/puppet-tools-release-xenial.deb && dpkg -i puppet-tools-release-xenial.deb'
- 'command -v bolt || if command -v apt-get; then apt-get update; apt-get install -y puppet-bolt; fi ||:'
# At least some of gitlab.com's runners appear to clone while umask 000 >:\
- 'chmod o-w .'
- 'BOLT_DISABLE_ANALYTICS=yes bolt --version || :'
- 'BOLT_DISABLE_ANALYTICS=yes bolt plan show --inventory inventory--empty.yaml | grep releng::'
# Travis CI testing was disabled.
#-----------------------------------------------------------------------
#.lint_tests: &lint_tests
# stage: 'validation'
# tags: ['docker']
# <<: *setup_bundler_env
# script:
# - 'export PROJECT_DIR="set_travis_env_vars"'
# - 'rubocop --fail-level warning --display-only-fail-level-offenses $PROJECT_DIR'
rubocop_octokit_repo_puncher:
stage: 'validation'
tags: ['docker']
<<: *setup_bundler_env
script:
- 'gem install --conservative --minimal-deps rubocop'
- 'rubocop --version'
- 'export PROJECT_DIR="octokit_repo_puncher"'
- 'rubocop --fail-level warning --display-only-fail-level-offenses $PROJECT_DIR'
allow_failure: true
rubocop_bolt:
stage: 'validation'
tags: ['docker']
<<: *setup_bundler_env
script:
- 'gem install --conservative --minimal-deps rubocop'
- 'rubocop --version'
- 'export PROJECT_DIR="tasks"'
- 'rubocop --fail-level warning --display-only-fail-level-offenses $PROJECT_DIR'
allow_failure: true