2727 - id : ruby
2828 uses : voxpupuli/ruby-version@v1
2929
30+ cache_modules :
31+ runs-on : ubuntu-24.04
32+ name : ' Run r10k and update module cache'
33+ steps :
34+ - uses : actions/checkout@v5
35+ - name : Install Ruby ${{ matrix.ruby }}
36+ uses : ruby/setup-ruby@v1
37+ with :
38+ ruby-version : " 3.4"
39+ bundler-cache : true
40+ - name : Cache modules
41+ id : modules
42+ uses : actions/cache@v4
43+ with :
44+ path : modules
45+ key : ${{ runner.os }}-modules-${{ hashFiles('**/Puppetfile') }}
46+ - name : Install modules
47+ if : steps.modules.outputs.cache-hit != 'true'
48+ run : bundle exec r10k puppetfile install
49+
3050 unit :
31- needs : rubocop_and_matrix
51+ needs :
52+ - rubocop_and_matrix
53+ - cache_modules
3254 name : " Unit tests ${{ matrix.ruby }} ${{ matrix.os }}"
3355 strategy :
3456 fail-fast : false
5274 with :
5375 path : modules
5476 key : ${{ runner.os }}-modules-${{ hashFiles('**/Puppetfile') }}
55- - name : Install modules
56- if : steps.modules.outputs.cache-hit != 'true'
57- run : bundle exec r10k puppetfile install
5877 - name : Unit tests
5978 run : bundle exec rake tests:unit
6079
7897
7998 local_transports :
8099 name : " local transport ${{ matrix.ruby }} ${{ matrix.os }}"
81- needs : rubocop_and_matrix
100+ needs :
101+ - rubocop_and_matrix
102+ - cache_modules
82103 env :
83104 BOLT_WINRM_USER : roddypiper
84105 BOLT_WINRM_HOST : localhost
@@ -105,9 +126,6 @@ jobs:
105126 with :
106127 path : modules
107128 key : ${{ runner.os }}-modules-${{ hashFiles('**/Puppetfile') }}
108- - name : Install modules
109- if : steps.modules.outputs.cache-hit != 'true'
110- run : bundle exec r10k puppetfile install
111129 - if : matrix.os == 'ubuntu-24.04'
112130 uses : ./.github/actions/sudo_setup
113131 - if : matrix.os == 'windows-2025'
@@ -120,7 +138,9 @@ jobs:
120138 run : bundle exec rake ci:local_transport:windows
121139
122140 winrm_transport :
123- needs : rubocop_and_matrix
141+ needs :
142+ - rubocop_and_matrix
143+ - cache_modules
124144 env :
125145 BOLT_WINRM_USER : roddypiper
126146 BOLT_WINRM_HOST : localhost
@@ -146,9 +166,6 @@ jobs:
146166 with :
147167 path : modules
148168 key : ${{ runner.os }}-modules-${{ hashFiles('**/Puppetfile') }}
149- - name : Install modules
150- if : steps.modules.outputs.cache-hit != 'true'
151- run : bundle exec r10k puppetfile install
152169 - name : Configure WinRM and use Puppet's Ruby
153170 shell : powershell
154171 run : |
@@ -159,6 +176,7 @@ jobs:
159176 tests :
160177 needs :
161178 - rubocop_and_matrix
179+ - cache_modules
162180 - unit
163181 - run-dita
164182 - local_transports
0 commit comments