Skip to content

Commit f507ae1

Browse files
committed
Caching: matrix into individual jobs
Windows is quite slow. This ensures that some linux jobs don't have to wait for the windows cache job.
1 parent 317c8b8 commit f507ae1

File tree

1 file changed

+37
-17
lines changed

1 file changed

+37
-17
lines changed

.github/workflows/tests.yaml

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,12 @@ jobs:
3535
- id: ruby
3636
uses: voxpupuli/ruby-version@v1
3737

38-
cache_modules:
39-
name: 'Run r10k and update module cache'
40-
strategy:
41-
fail-fast: false
42-
matrix:
43-
os: [ubuntu-24.04, windows-2025]
44-
runs-on: ${{ matrix.os }}
38+
cache_modules_linux:
39+
name: 'Linux: Generate module cache'
40+
runs-on: ubuntu-24.04
4541
steps:
4642
- uses: actions/checkout@v5
47-
- name: Install Ruby ${{ matrix.ruby }}
43+
- name: Install Ruby
4844
uses: ruby/setup-ruby@v1
4945
with:
5046
ruby-version: "3.4"
@@ -59,10 +55,30 @@ jobs:
5955
if: steps.modules.outputs.cache-hit != 'true'
6056
run: bundle exec r10k puppetfile install
6157

58+
cache_modules_windows:
59+
name: 'Windows: Generate module cache'
60+
runs-on: 'windows-2025'
61+
steps:
62+
- uses: actions/checkout@v5
63+
- name: Install Ruby
64+
uses: ruby/setup-ruby@v1
65+
with:
66+
ruby-version: "3.4"
67+
bundler-cache: true
68+
- name: Cache modules
69+
id: modules
70+
uses: actions/cache@v4
71+
with:
72+
path: modules
73+
key: ${{ runner.os }}-modules-${{ hashFiles('**/Puppetfile') }}
74+
- name: Install modules
75+
if: steps.modules.outputs.cache-hit != 'true'
76+
run: bundle exec r10k puppetfile install
6277
unit:
6378
needs:
6479
- rubocop_and_matrix
65-
- cache_modules
80+
- cache_modules_linux
81+
- cache_modules_windows
6682
name: "Unit tests ${{ matrix.ruby }} ${{ matrix.os }}"
6783
strategy:
6884
fail-fast: false
@@ -111,7 +127,8 @@ jobs:
111127
name: "local transport ${{ matrix.ruby }} ${{ matrix.os }}"
112128
needs:
113129
- rubocop_and_matrix
114-
- cache_modules
130+
- cache_modules_linux
131+
- cache_modules_windows
115132
strategy:
116133
fail-fast: false
117134
matrix:
@@ -146,7 +163,7 @@ jobs:
146163
winrm_transport:
147164
needs:
148165
- rubocop_and_matrix
149-
- cache_modules
166+
- cache_modules_windows
150167
name: WinRM Transport
151168
runs-on: windows-latest
152169
strategy:
@@ -179,7 +196,8 @@ jobs:
179196
name: bolt apply
180197
needs:
181198
- rubocop_and_matrix
182-
- cache_modules
199+
- cache_modules_linux
200+
- cache_modules_windows
183201
strategy:
184202
fail-fast: false
185203
matrix:
@@ -215,7 +233,8 @@ jobs:
215233
name: BoltSpec
216234
needs:
217235
- rubocop_and_matrix
218-
- cache_modules
236+
- cache_modules_windows
237+
- cache_modules_linux
219238
strategy:
220239
fail-fast: false
221240
matrix:
@@ -252,7 +271,7 @@ jobs:
252271
check_dependencies:
253272
name: Check mod deps
254273
needs:
255-
- cache_modules
274+
- cache_modules_linux
256275
runs-on: ubuntu-24.04
257276
steps:
258277
- name: Checkout repository
@@ -274,7 +293,7 @@ jobs:
274293
integration:
275294
needs:
276295
- rubocop_and_matrix
277-
- cache_modules
296+
- cache_modules_windows
278297
name: Windows Integration
279298
runs-on: windows-2025
280299
strategy:
@@ -303,7 +322,7 @@ jobs:
303322
agentless:
304323
needs:
305324
- rubocop_and_matrix
306-
- cache_modules
325+
- cache_modules_windows
307326
name: Windows Agentless
308327
runs-on: windows-2025
309328
strategy:
@@ -333,7 +352,8 @@ jobs:
333352
if: always()
334353
needs:
335354
- rubocop_and_matrix
336-
- cache_modules
355+
- cache_modules_linux
356+
- cache_modules_windows
337357
- unit
338358
- run-dita
339359
- local_transports

0 commit comments

Comments
 (0)