|
14 | 14 | SOURCE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
15 | 15 |
|
16 | 16 | jobs: |
17 | | - linux_tests: |
18 | | - name: Linux, Puppet ${{ matrix.cfg.puppet_version }}, Ruby ${{ matrix.cfg.ruby }} |
| 17 | + unit: |
19 | 18 | 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 }} |
29 | 19 | 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. |
55 | | - 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 }} |
| 20 | + - name: Check outcome |
| 21 | + run: | |
| 22 | + if [ "${{ github.event.inputs.fail }}" = "true" ]; then |
| 23 | + echo "'unit' job succeeded" |
| 24 | + exit 0 |
| 25 | + else |
| 26 | + echo "'unit' job failed" |
| 27 | + exit 1 |
| 28 | + fi |
| 29 | + acceptance: |
| 30 | + runs-on: ubuntu-latest |
65 | 31 | 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 "'acceptance' job failed" |
| 36 | + exit 1 |
| 37 | + else |
| 38 | + echo "'acceptance' job succeeded" |
| 39 | + exit 0 |
| 40 | + fi |
87 | 41 | |
88 | 42 | on-failure-workflow-restarter-proxy: |
89 | 43 | # (1) run this job after the "acceptance" job and... |
90 | | - needs: [linux_tests, windows_tests] |
| 44 | + needs: [acceptance, unit] |
91 | 45 | # (2) continue ONLY IF "acceptance" fails |
92 | | - if: always() && needs.linux_tests.result == 'failure' || needs.windows_tests.result == 'failure' |
| 46 | + if: always() && needs.acceptance.result == 'failure' || needs.unit.result == 'failure' |
93 | 47 | runs-on: ubuntu-latest |
94 | 48 | steps: |
95 | 49 | # (3) checkout this repository in order to "see" the following custom action |
|
0 commit comments