|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 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 }} |
| 19 | + timeout-minutes: 5 |
| 20 | + defaults: |
| 21 | + run: |
| 22 | + shell: bash |
| 23 | + |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v3 |
| 26 | + |
| 27 | + - id: without-parameters |
| 28 | + 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 | + |
| 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: |
| 44 | + strategy: |
| 45 | + fail-fast: false |
| 46 | + matrix: |
| 47 | + os: [ windows-2022, windows-2019 ] |
| 48 | + runs-on: ${{ matrix.os }} |
| 49 | + timeout-minutes: 5 |
| 50 | + |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v3 |
| 53 | + |
| 54 | + - id: without-parameters |
| 55 | + uses: ./ |
| 56 | + - run: test "${env:GREET}" = "Hello World" |
| 57 | + env: |
| 58 | + GREET: ${{ steps.without-parameters.outputs.greet }} |
| 59 | + - run: test "$(cat greet.txt)" = "Hello World" |
| 60 | + |
| 61 | + - id: with-parameters |
| 62 | + uses: ./ |
| 63 | + with: |
| 64 | + who-to-greet: composite action |
| 65 | + - run: test "${env:GREET}" = "Hello composite action" |
| 66 | + env: |
| 67 | + GREET: ${{ steps.with-parameters.outputs.greet }} |
| 68 | + - run: test "$(cat greet.txt)" = "Hello composite action" |
| 69 | + |
| 70 | + # Make up matrix statuses into a status for status checks in branch protection rules |
| 71 | + test-passing: |
| 72 | + needs: [ test-bash, test-powershell ] |
| 73 | + runs-on: ubuntu-latest |
| 74 | + timeout-minutes: 1 |
| 75 | + |
| 76 | + steps: |
| 77 | + - run: echo "All tests have passed." |
0 commit comments