-
Notifications
You must be signed in to change notification settings - Fork 24
160 lines (151 loc) · 5.12 KB
/
pr_tests.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
149
150
151
152
153
154
155
156
157
158
159
160
# Run Puppet checks and test matrix on Pull Requests
# ------------------------------------------------------------------------------
# NOTICE: **This file is maintained with puppetsync**
#
# This file is updated automatically as part of a puppet module baseline.
#
# The next baseline sync will overwrite any local changes to this file!
#
# ==============================================================================
#
# The testing matrix considers ruby/puppet versions supported by SIMP and PE:
# ------------------------------------------------------------------------------
# Release Puppet Ruby EOL
# PE 2019.8 6.22 2.5 2022-12 (LTS)
# PE 2021.Y 7.x 2.7 Quarterly updates
#
# https://puppet.com/docs/pe/latest/component_versions_in_recent_pe_releases.html
# https://puppet.com/misc/puppet-enterprise-lifecycle
# ==============================================================================
#
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows
#
name: PR Tests
on:
pull_request:
types: [opened, reopened, synchronize]
env:
PUPPET_VERSION: '~> 7'
jobs:
puppet-syntax:
name: 'Puppet Syntax'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Install Ruby ${{matrix.puppet.ruby_version}}"
uses: ruby/setup-ruby@v1 # ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
with:
ruby-version: 2.7
bundler-cache: true
- run: "bundle exec rake syntax"
puppet-style:
name: 'Puppet Style'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Install Ruby ${{matrix.puppet.ruby_version}}"
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- run: "bundle exec rake lint"
- run: "bundle exec rake metadata_lint"
ruby-style:
if: false # TODO Modules will need: rubocop in Gemfile, .rubocop.yml
name: 'Ruby Style (experimental)'
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: "Install Ruby ${{matrix.puppet.ruby_version}}"
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- run: |
bundle show
bundle exec rake rubocop
file-checks:
name: 'File checks'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Install Ruby 2.7'
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- run: bundle exec rake check:dot_underscore
- run: bundle exec rake check:test_file
releng-checks:
name: 'RELENG checks'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Install Ruby ${{matrix.puppet.ruby_version}}'
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: 'Tags and changelogs'
run: |
bundle exec rake pkg:check_version
bundle exec rake pkg:compare_latest_tag[,true]
bundle exec rake pkg:create_tag_changelog
- name: 'Test-build the Puppet module'
run: 'bundle exec pdk build --force'
spec-tests:
name: 'Spec (${{matrix.test_suite.label}}, ${{matrix.puppet.label}})'
needs: [puppet-syntax]
runs-on: ubuntu-latest
strategy:
matrix:
puppet:
- label: 'Puppet 7.x [SIMP 6.6/PE 2021.7]'
puppet_version: '~> 7.0'
ruby_version: '2.7'
experimental: false
- label: 'Puppet 8.x'
puppet_version: '~> 8.0'
ruby_version: '3.2'
experimental: false
test_suite:
- label: classes 01
run: bundle exec rspec spec/classes/01_classes
- label: classes 10
run: bundle exec rspec spec/classes/10_classes
- label: classes 20
run: bundle exec rspec spec/classes/20_classes
- label: classes 00
run: bundle exec rspec spec/classes/00_classes
- label: facter
run: bundle exec rspec spec/facter
- label: functions
run: bundle exec rspec spec/functions
- label: aliases
run: bundle exec rspec spec/type_aliases
- label: unit
run: bundle exec rspec spec/unit
fail-fast: false
env:
PUPPET_VERSION: ${{matrix.puppet.puppet_version}}
steps:
- uses: actions/checkout@v3
- name: 'Install Ruby ${{matrix.puppet.ruby_version}}'
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.puppet.ruby_version}}
bundler-cache: true
- run: 'command -v rpm || if command -v apt-get; then sudo apt-get update; sudo apt-get install -y rpm; fi ||:'
- run: 'bundle exec rake spec_prep'
- run: ${{matrix.test_suite.run}}
continue-on-error: ${{matrix.puppet.experimental}}
# dump_contexts:
# name: 'Examine Context contents'
# runs-on: ubuntu-latest
# steps:
# - name: Dump contexts
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# run: echo "$GITHUB_CONTEXT"
#