forked from yano3/puppet-cerebro
-
Notifications
You must be signed in to change notification settings - Fork 3
138 lines (134 loc) · 5.07 KB
/
build.yaml
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
name: build
on:
push:
branches: ['*']
tags:
- v*
pull_request:
type: [opened, reopened, edited]
schedule:
# run every night at midnight
- cron: '0 0 * * *'
jobs:
unit:
name: '${{matrix.name}} - puppet (${{matrix.puppet}})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# note: actions/setup-ruby only allows using a major.minor release of ruby
- ruby: '2.7'
puppet: "6.0"
check: "check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
name: 'static'
- ruby: '2.7'
puppet: "5.0"
check: "parallel_spec"
name: 'spec'
- ruby: '2.7'
puppet: "6.0"
check: "parallel_spec"
name: 'spec'
- ruby: '2.7'
puppet: "7.0"
check: "parallel_spec"
name: 'spec'
env:
CHECK: '${{ matrix.check }}'
PUPPET_GEM_VERSION: '~> ${{ matrix.puppet }}'
# lock to 2.1.0 because 2.2.0 is causing issues during builds
BUNDLER_GEM_VERSION: '2.4.2'
RUBYGEMS_VERSION: '3.2.3'
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '${{ matrix.ruby }}'
- name: Bundle prep
run: |
gem install bundler -v "$BUNDLER_GEM_VERSION"
bundle -v
rm -f Gemfile.lock
# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used"
# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION
gem --version
bundle -v
bundle config path vendor/bundle
bundle config without 'system_tests'
bundle lock
# restore cache AFTER doing 'bundle lock' so that Gemfile.lock exists
- uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-${{ matrix.puppet }}-${{ matrix.ruby }}-gems-test-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.puppet }}-${{ matrix.ruby }}-gems-test-
- name: Bundle install
run: |
bundle install --jobs $(nproc) --retry 3
- name: Test
run: 'bundle exec rake $CHECK'
deploy:
name: 'deploy to forge'
needs: unit
runs-on: ubuntu-latest
# only run deploy on tags that start with 'v'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# define a "strategy" here so we can use ruby/puppet as variables below
strategy:
fail-fast: false
matrix:
include:
# note: actions/setup-ruby only allows using a major.minor release of ruby
- ruby: '2.5'
puppet: "6.0"
env:
PUPPET_GEM_VERSION: '~> ${{ matrix.puppet }}'
# lock to 2.1.0 because 2.2.0 is causing issues during builds
BUNDLER_GEM_VERSION: '2.4.2'
RUBYGEMS_VERSION: '3.2.3'
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '${{ matrix.ruby }}'
- name: Bundle prep
run: |
gem install bundler -v "$BUNDLER_GEM_VERSION"
bundle -v
rm -f Gemfile.lock
# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used"
# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION
gem --version
bundle -v
bundle config path vendor/bundle
bundle config without 'system_tests'
bundle lock
# restore cache AFTER doing 'bundle lock' so that Gemfile.lock exists
- uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-${{ matrix.puppet }}-${{ matrix.ruby }}-gems-test-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.puppet }}-${{ matrix.ruby }}-gems-test-
- name: Bundle install
run: |
bundle install --jobs $(nproc) --retry 3
- name: Build and Deploy
env:
# TODO configure secrets here:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets
BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}'
BLACKSMITH_FORGE_PASSWORD: '${{ secrets.PUPPET_FORGE_PASSWORD }}'
run: |
bundle exec rake module:build
bundle exec rake module:push