Skip to content

Commit 98e1eae

Browse files
authored
fix: CI with nightly flag (#8)
* fix: CI with nightly flag Signed-off-by: Jeremy HERGAULT <jeremy@hergault.fr>
1 parent 10dc0a1 commit 98e1eae

2 files changed

Lines changed: 175 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 87 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,90 @@ jobs:
1212
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
1313
secrets: "inherit"
1414

15-
Acceptance:
16-
needs: Spec
17-
uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@4dee504a6623266617ce7b47ae3ecbc1939788ad"
18-
secrets: "inherit"
15+
setup_matrix:
16+
name: "Setup Test Matrix"
17+
runs-on: ubuntu-latest
18+
outputs:
19+
acceptance_matrix: ${{ steps.get-matrix.outputs.matrix }}
20+
21+
env:
22+
BUNDLE_WITHOUT: release_prep
23+
24+
steps:
25+
- name: "Checkout"
26+
uses: "actions/checkout@v4"
27+
28+
- name: "Setup ruby"
29+
uses: "ruby/setup-ruby@v1"
30+
with:
31+
ruby-version: "3.1"
32+
bundler-cache: true
33+
34+
- name: "Bundle environment"
35+
run: |
36+
echo ::group::bundler environment
37+
bundle env
38+
echo ::endgroup::
39+
40+
- name: Setup Test Matrix
41+
id: get-matrix
42+
run: |
43+
bundle exec matrix_from_metadata_v3 --puppet-exclude 7
44+
45+
acceptance:
46+
name: "Acceptance tests (${{matrix.platforms.label}}, ${{matrix.collection}})"
47+
needs: "setup_matrix"
48+
runs-on: ${{ inputs.runs_on || matrix.platforms.runner }}
49+
timeout-minutes: 180
50+
strategy:
51+
fail-fast: false
52+
matrix: ${{ fromJson( needs.setup_matrix.outputs.acceptance_matrix ) }}
53+
54+
env:
55+
BUNDLE_WITHOUT: release_prep
56+
PUPPET_GEM_VERSION: '~> 8.9'
57+
FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' # why is this set?
58+
59+
steps:
60+
- name: "Checkout"
61+
uses: "actions/checkout@v4"
62+
63+
- name: "Setup ruby"
64+
uses: "ruby/setup-ruby@v1"
65+
with:
66+
ruby-version: "3.1"
67+
bundler-cache: true
68+
69+
- name: "Bundle environment"
70+
run: |
71+
echo ::group::bundler environment
72+
bundle env
73+
echo ::endgroup::
74+
75+
- name: "Provision environment"
76+
run: |
77+
DOCKER_RUN_OPTS=''
78+
bundle exec rake "litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }},$DOCKER_RUN_OPTS]"
79+
# Redact password
80+
FILE='spec/fixtures/litmus_inventory.yaml'
81+
sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true
82+
83+
- name: "Install Puppet agent"
84+
run: |
85+
bundle exec rake 'litmus:install_agent'
86+
87+
- name: "Install module"
88+
run: |
89+
bundle exec rake 'litmus:install_module'
90+
91+
- name: "Run acceptance tests"
92+
run: |
93+
bundle exec rake 'litmus:acceptance:parallel'
94+
95+
- name: "Remove test environment"
96+
if: ${{ always() }}
97+
continue-on-error: true
98+
run: |
99+
if [[ -f spec/fixtures/litmus_inventory.yaml ]]; then
100+
bundle exec rake 'litmus:tear_down'
101+
fi

.github/workflows/nightly.yml

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,91 @@ jobs:
99
Spec:
1010
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
1111
secrets: "inherit"
12-
Acceptance:
13-
needs: Spec
14-
uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@4dee504a6623266617ce7b47ae3ecbc1939788ad"
15-
secrets: "inherit"
12+
13+
setup_matrix:
14+
name: "Setup Test Matrix"
15+
runs-on: ubuntu-latest
16+
outputs:
17+
acceptance_matrix: ${{ steps.get-matrix.outputs.matrix }}
18+
19+
env:
20+
BUNDLE_WITHOUT: release_prep
21+
22+
steps:
23+
- name: "Checkout"
24+
uses: "actions/checkout@v4"
25+
26+
- name: "Setup ruby"
27+
uses: "ruby/setup-ruby@v1"
28+
with:
29+
ruby-version: "3.1"
30+
bundler-cache: true
31+
32+
- name: "Bundle environment"
33+
run: |
34+
echo ::group::bundler environment
35+
bundle env
36+
echo ::endgroup::
37+
38+
- name: Setup Test Matrix
39+
id: get-matrix
40+
run: |
41+
bundle exec matrix_from_metadata_v3 --puppet-exclude 7
42+
43+
acceptance:
44+
name: "Acceptance tests (${{matrix.platforms.label}}, ${{matrix.collection}})"
45+
needs: "setup_matrix"
46+
runs-on: ${{ inputs.runs_on || matrix.platforms.runner }}
47+
timeout-minutes: 180
48+
strategy:
49+
fail-fast: false
50+
matrix: ${{ fromJson( needs.setup_matrix.outputs.acceptance_matrix ) }}
51+
52+
env:
53+
BUNDLE_WITHOUT: release_prep
54+
PUPPET_GEM_VERSION: '~> 8.9'
55+
FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' # why is this set?
56+
57+
steps:
58+
- name: "Checkout"
59+
uses: "actions/checkout@v4"
60+
61+
- name: "Setup ruby"
62+
uses: "ruby/setup-ruby@v1"
63+
with:
64+
ruby-version: "3.1"
65+
bundler-cache: true
66+
67+
- name: "Bundle environment"
68+
run: |
69+
echo ::group::bundler environment
70+
bundle env
71+
echo ::endgroup::
72+
73+
- name: "Provision environment"
74+
run: |
75+
DOCKER_RUN_OPTS=''
76+
bundle exec rake "litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }},$DOCKER_RUN_OPTS]"
77+
# Redact password
78+
FILE='spec/fixtures/litmus_inventory.yaml'
79+
sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true
80+
81+
- name: "Install Puppet agent"
82+
run: |
83+
bundle exec rake 'litmus:install_agent'
84+
85+
- name: "Install module"
86+
run: |
87+
bundle exec rake 'litmus:install_module'
88+
89+
- name: "Run acceptance tests"
90+
run: |
91+
bundle exec rake 'litmus:acceptance:parallel'
92+
93+
- name: "Remove test environment"
94+
if: ${{ always() }}
95+
continue-on-error: true
96+
run: |
97+
if [[ -f spec/fixtures/litmus_inventory.yaml ]]; then
98+
bundle exec rake 'litmus:tear_down'
99+
fi

0 commit comments

Comments
 (0)