55 inputs :
66 fail :
77 description : >
8- For (acceptance, unit ) jobs:
8+ For (windows_tests, linux_tests ) jobs:
99 'true' = (fail, succeed) and
1010 'false' = (succeed, fail)
1111 required : true
1515
1616jobs :
1717 linux_tests :
18- name : Linux, Puppet ${{ matrix.cfg.puppet_version }}, Ruby ${{ matrix.cfg.ruby }}
1918 runs-on : ubuntu-latest
20- strategy :
21- matrix :
22- cfg :
23- - {puppet_version: '7', ruby: '2.7'}
24- - {puppet_version: '7', ruby: 'jruby-9.3.7.0'}
25- - {puppet_version: '8', ruby: '3.2'}
26- - {puppet_version: '8', ruby: 'jruby-9.4.2.0'}
27- env :
28- PUPPET_GEM_VERSION : ~> ${{ matrix.cfg.puppet_version }}
2919 steps :
30- - name : Checkout current PR
31- uses : actions/checkout@v4
32- with :
33- fetch-depth : 0
34- - name : Install Ruby version ${{ matrix.cfg.ruby }}
35- uses : ruby/setup-ruby@v1
36- with :
37- ruby-version : ${{ matrix.cfg.ruby }}
38- - name : Update rubygems and install gems
39- run : |
40- bundle config set without development
41- bundle install --jobs 4 --retry 3
42-
43- - name : Rubocop
44- run : |
45- bundle exec rake rubocop
46-
47- - name : Run tests
48- run : |
49- bundle exec rake spec
50-
51- # Starting with version 3.2, Ruby no longer bundles libffi, which is necessary for tests on Windows. Due to a discrepancy between the C
52- # library the Windows Puppet gem is built against and what GitHub runners use (MinGW and ucrt, respectively) we can't install the
53- # Windows-specific Puppet gem that includes libffi. To work around these issues, we have a separate "integration" group that we include
54- # when testing Puppet 8 / Ruby 3.2 on Windows. See PA-5406 for more.
20+ - name : Check outcome
21+ run : |
22+ if [ "${{ github.event.inputs.fail }}" = "true" ]; then
23+ echo "'linux_tests' job succeeded"
24+ exit 0
25+ else
26+ echo "'linux_tests' job failed"
27+ exit 1
28+ fi
5529 windows_tests :
56- name : Windows, Puppet ${{ matrix.cfg.puppet_version }}, Ruby ${{ matrix.cfg.ruby }}
57- runs-on : windows-latest
58- strategy :
59- matrix :
60- cfg :
61- - {puppet_version: '7', ruby: '2.7'}
62- - {puppet_version: '8', ruby: '3.2', extra: 'bundle config set with integration'}
63- env :
64- PUPPET_GEM_VERSION : ~> ${{ matrix.cfg.puppet_version }}
30+ runs-on : ubuntu-latest
6531 steps :
66- - name : Checkout current PR
67- uses : actions/checkout@v4
68- with :
69- fetch-depth : 0
70- - name : Install Ruby version ${{ matrix.cfg.ruby }}
71- uses : ruby/setup-ruby@v1
72- with :
73- ruby-version : ${{ matrix.cfg.ruby }}
74- - name : Update rubygems and install gems
75- run : |
76- bundle config set without development
77- ${{ matrix.cfg.extra }}
78- bundle install --jobs 4 --retry 3
79-
80- - name : Rubocop
81- run : |
82- bundle exec rake rubocop
83-
84- - name : Run tests
85- run : |
86- bundle exec rake spec
32+ - name : Check outcome
33+ run : |
34+ if [ "${{ github.event.inputs.fail }}" = "true" ]; then
35+ echo "'windows_tests' job failed"
36+ exit 1
37+ else
38+ echo "'windows_tests' job succeeded"
39+ exit 0
40+ fi
8741
8842 on-failure-workflow-restarter-proxy :
89- # (1) run this job after the "acceptance " job and...
90- needs : [linux_tests, windows_tests ]
91- # (2) continue ONLY IF "acceptance " fails
92- if : always() && needs.linux_tests .result == 'failure' || needs.windows_tests .result == 'failure'
43+ # (1) run this job after the "windows_tests " job and...
44+ needs : [windows_tests, linux_tests ]
45+ # (2) continue ONLY IF "windows_tests " fails
46+ if : always() && needs.windows_tests .result == 'failure' || needs.linux_tests .result == 'failure'
9347 runs-on : ubuntu-latest
9448 steps :
9549 # (3) checkout this repository in order to "see" the following custom action
9650 - name : Checkout repository
9751 uses : actions/checkout@v4
9852
99- # (4) "use" the custom action to retrigger the failed "acceptance job" above
53+ # (4) "use" the custom action to retrigger the failed "windows_tests job" above
10054 # NOTE: pass the SOURCE_GITHUB_TOKEN to the custom action because (a) it must have
10155 # this to trigger the reusable workflow that restarts the failed job; and
10256 # (b) custom actions do not have access to the calling workflow's secrets
10660 SOURCE_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
10761 with :
10862 repository : ${{ github.repository }}
109- run_id : ${{ github.run_id }}
63+ run_id : ${{ github.run_id }}
0 commit comments