This repository has been archived by the owner on Dec 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
112 lines (90 loc) · 3.03 KB
/
ci.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
name: CI
on: pull_request
jobs:
setup_matrix:
name: "Setup Test Matrix"
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.get-outputs.outputs.matrix }}
spec_matrix: ${{ steps.get-outputs.outputs.spec_matrix }}
env:
BUNDLE_WITHOUT: development:test:release
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
bundler-cache: true
- name: Run rake validate
run: bundle exec rake validate
- name: Setup Test Matrix
id: get-outputs
run: bundle exec matrix_from_metadata_v2
unit:
needs: setup_matrix
runs-on: ubuntu-20.04
if: ${{ needs.setup_matrix.outputs.spec_matrix != '{}' }}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.setup_matrix.outputs.spec_matrix)}}
env:
PUPPET_GEM_VERSION: ${{ matrix.puppet_version }}
FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main'
name: "Spec: puppet ${{ matrix.puppet_version }} (ruby ${{ matrix.ruby_version }})"
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- name: Print bundle environment
run: |
bundle env
- name: Run Static & Syntax Tests
run: |
bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
- name: Run parallel_spec tests
run: |
bundle exec rake parallel_spec
acceptance:
needs: setup_matrix
runs-on: ubuntu-20.04
if: ${{ needs.setup_matrix.outputs.matrix != '{}' }}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}
name: "Acceptance: ${{matrix.platforms.label}}, ${{matrix.collection}}"
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: Print bundle environment
run: |
bundle env
- name: Provision test environment
run: |
bundle exec rake 'litmus:provision[docker,${{ matrix.platforms.image }}]'
- name: Install agent
run: |
bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
- name: Install module
run: |
bundle exec rake 'litmus:install_module'
# - name: Display sysctl settings
# run: |
# bundle exec bolt command run 'sysctl -a' --targets localhost:2222 -i spec/fixtures/litmus_inventory.yaml
- name: Run acceptance tests
run: |
bundle exec rake 'litmus:acceptance:parallel'
- name: Remove test environment
if: ${{ always() }}
continue-on-error: true
run: |
if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then
bundle exec rake 'litmus:tear_down'
fi