-
-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (140 loc) · 4.29 KB
/
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
138
139
140
141
142
143
144
145
146
147
148
---
name: CI
on: pull_request
defaults:
run:
working-directory: ./site/profiles
concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true
jobs:
setup_matrix:
name: 'Setup Test Matrix'
runs-on: ubuntu-latest
timeout-minutes: 40
outputs:
puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }}
github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }}
env:
BUNDLE_WITHOUT: development:system_tests:release
steps:
- uses: actions/checkout@v4
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
working-directory: ./site/profiles
- name: Run static validations
run: bundle exec rake validate lint check
- name: Run rake rubocop
run: bundle exec rake rubocop
- name: Setup Test Matrix
id: get-outputs
run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false
unit:
needs: setup_matrix
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}}
env:
BUNDLE_WITHOUT: development:system_tests:release
PUPPET_VERSION: "~> ${{ matrix.puppet }}.0"
name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }})
steps:
- uses: actions/checkout@v4
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
working-directory: ./site/profiles
- name: Run tests
run: bundle exec rake parallel_spec
acceptance:
needs: setup_matrix
runs-on: ubuntu-latest
env:
BUNDLE_WITHOUT: development:release
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}}
name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }}
steps:
- uses: actions/checkout@v4
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
working-directory: ./site/profiles
- name: Prepare fixtures
run: bundle exec rake spec_prep
- name: Run tests
run: bundle exec rake beaker
env:
LANG: en_US
LC_ALL: en_US.UTF-8
BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }}
BEAKER_setfile: ${{ matrix.setfile.value }}
puppetfile:
defaults:
run:
working-directory: .
runs-on: ubuntu-latest
name: Validate Puppetfile + all modules
steps:
- uses: actions/checkout@v4
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
bundler-cache: true
- name: Check for puppetfile syntax correctness
run: bundle exec rake r10k:syntax
- name: validate URLs in Puppetfile
run: bundle exec rake r10k:validate
- name: Check for puppetfile duplicates
run: bundle exec rake r10k:duplicates
- name: Check for puppetfile module deprecations
run: bundle exec rake r10k:deprecation
- name: Check for outdated modules
run: bundle exec rake r10k:dependencies
- name: Validate all dependencies in metadata.json
run: bundle exec rake metadata_deps
- name: validate all dependencies
run: bundle exec puppet module list --modulepath site
Hiera:
defaults:
run:
working-directory: .
runs-on: ubuntu-latest
name: Validate Hiera
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install --upgrade wheel setuptools pip
pip install yamllint
- name: Run yamllint
run: yamllint --format github --strict data/
tests:
needs:
- unit
- acceptance
- puppetfile
- Hiera
runs-on: ubuntu-latest
name: Test suite
steps:
- run: echo Test suite completed
# overwrite global working-directory because this step does not checkout the git repo
working-directory: .