|
8 | 8 | workflow_dispatch:
|
9 | 9 |
|
10 | 10 | jobs:
|
11 |
| - test-bash: |
12 |
| - strategy: |
13 |
| - fail-fast: false |
14 |
| - matrix: |
15 |
| - # Runs on all supported runners |
16 |
| - # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources |
17 |
| - os: [ ubuntu-22.04, ubuntu-20.04, ubuntu-18.04, windows-2022, windows-2019, macos-11, macos-10.15 ] |
18 |
| - runs-on: ${{ matrix.os }} |
| 11 | + runners: |
| 12 | + runs-on: ubuntu-latest |
19 | 13 | timeout-minutes: 5
|
20 |
| - defaults: |
21 |
| - run: |
22 |
| - shell: bash |
23 |
| - |
| 14 | + outputs: |
| 15 | + list: ${{ steps.list.outputs.all }} |
24 | 16 | steps:
|
25 | 17 | - uses: actions/checkout@v3
|
26 |
| - |
27 |
| - - id: without-parameters |
| 18 | + - id: list |
28 | 19 | uses: ./
|
29 |
| - - run: test "${GREET}" = "Hello World" |
30 |
| - env: |
31 |
| - GREET: ${{ steps.without-parameters.outputs.greet }} |
32 |
| - - run: test "$(cat greet.txt)" = "Hello World" |
33 | 20 |
|
34 |
| - - id: with-parameters |
35 |
| - uses: ./ |
36 |
| - with: |
37 |
| - who-to-greet: composite action |
38 |
| - - run: test "${GREET}" = "Hello composite action" |
39 |
| - env: |
40 |
| - GREET: ${{ steps.with-parameters.outputs.greet }} |
41 |
| - - run: test "$(cat greet.txt)" = "Hello composite action" |
42 |
| - |
43 |
| - test-powershell: |
| 21 | + test: |
| 22 | + needs: [ runners ] |
44 | 23 | strategy:
|
45 | 24 | fail-fast: false
|
46 | 25 | matrix:
|
47 |
| - os: [ windows-2022, windows-2019 ] |
48 |
| - runs-on: ${{ matrix.os }} |
| 26 | + runner: ${{ fromJSON(needs.runners.outputs.list) }} |
| 27 | + runs-on: ${{ matrix.runner }} |
49 | 28 | timeout-minutes: 5
|
50 |
| - |
51 | 29 | steps:
|
52 | 30 | - uses: actions/checkout@v3
|
53 |
| - |
54 |
| - - id: without-parameters |
| 31 | + - id: list |
55 | 32 | uses: ./
|
56 |
| - - run: test "${env:GREET}" = "Hello World" |
| 33 | + - run: echo "${json}" |
57 | 34 | env:
|
58 |
| - GREET: ${{ steps.without-parameters.outputs.greet }} |
59 |
| - - run: test "$(cat greet.txt)" = "Hello World" |
| 35 | + json: ${{ toJSON(steps.list.outputs) }} |
60 | 36 |
|
61 |
| - - id: with-parameters |
62 |
| - uses: ./ |
63 |
| - with: |
64 |
| - who-to-greet: composite action |
65 |
| - - run: test "${env:GREET}" = "Hello composite action" |
| 37 | + - name: All list length > 0 |
| 38 | + run: test $(echo ${list} | jq 'length') -gt 0 |
| 39 | + env: |
| 40 | + list: ${{ steps.list.outputs.all }} |
| 41 | + shell: bash |
| 42 | + - name: All list doesn't contain latest |
| 43 | + run: test $(echo ${list} | jq 'map(select(endswith("-latest"))) | length') -eq 0 |
66 | 44 | env:
|
67 |
| - GREET: ${{ steps.with-parameters.outputs.greet }} |
68 |
| - - run: test "$(cat greet.txt)" = "Hello composite action" |
| 45 | + list: ${{ steps.list.outputs.all }} |
| 46 | + shell: bash |
| 47 | + - name: Latest list length == 3 |
| 48 | + run: test $(echo ${list} | jq 'length') -eq 3 |
| 49 | + env: |
| 50 | + list: ${{ steps.list.outputs.latest }} |
| 51 | + shell: bash |
| 52 | + - name: Ubuntu list length > 0 |
| 53 | + run: test $(echo ${list} | jq 'length') -gt 0 |
| 54 | + env: |
| 55 | + list: ${{ steps.list.outputs.ubuntu }} |
| 56 | + shell: bash |
| 57 | + - name: Ubuntu list doesn't contain latest |
| 58 | + run: test $(echo ${list} | jq 'map(select(endswith("-latest"))) | length') -eq 0 |
| 59 | + env: |
| 60 | + list: ${{ steps.list.outputs.ubuntu }} |
| 61 | + shell: bash |
| 62 | + - name: Windows list length > 0 |
| 63 | + run: test $(echo ${list} | jq 'length') -gt 0 |
| 64 | + env: |
| 65 | + list: ${{ steps.list.outputs.windows }} |
| 66 | + shell: bash |
| 67 | + - name: Windows list doesn't contain latest |
| 68 | + run: test $(echo ${list} | jq 'map(select(endswith("-latest"))) | length') -eq 0 |
| 69 | + env: |
| 70 | + list: ${{ steps.list.outputs.windows }} |
| 71 | + shell: bash |
| 72 | + - name: macOS list length > 0 |
| 73 | + run: test $(echo ${list} | jq 'length') -gt 0 |
| 74 | + env: |
| 75 | + list: ${{ steps.list.outputs.macos }} |
| 76 | + shell: bash |
| 77 | + - name: macOS list doesn't contain latest |
| 78 | + run: test $(echo ${list} | jq 'map(select(endswith("-latest"))) | length') -eq 0 |
| 79 | + env: |
| 80 | + list: ${{ steps.list.outputs.macos }} |
| 81 | + shell: bash |
69 | 82 |
|
70 |
| - # Make up matrix statuses into a status for status checks in branch protection rules |
71 | 83 | test-passing:
|
72 |
| - needs: [ test-bash, test-powershell ] |
| 84 | + needs: [ test ] |
73 | 85 | runs-on: ubuntu-latest
|
74 |
| - timeout-minutes: 1 |
75 |
| - |
| 86 | + timeout-minutes: 5 |
76 | 87 | steps:
|
77 | 88 | - run: echo "All tests have passed."
|
0 commit comments