Skip to content

Commit

Permalink
use matrix in tests and always check test results
Browse files Browse the repository at this point in the history
  • Loading branch information
zachgoncalves committed Aug 26, 2023
1 parent 619482e commit 20de062
Showing 1 changed file with 10 additions and 92 deletions.
102 changes: 10 additions & 92 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ on:
- master

jobs:
test-unix:
test:
name: Test Unix
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: 'tag-exists-action: true'
Expand Down Expand Up @@ -42,102 +45,17 @@ jobs:
repo: 'fakeRepo/fakerepo'

- name: Result of checkTag
if: always()
run: test "true" = "${{ steps.checkTag.outputs.exists }}"
- name: Result of notExist
if: always()
run: test "false" = "${{ steps.notExist.outputs.notExist }}"
- name: Result of externalRepoTagExists
if: always()
run: test "true" = "${{ steps.checkTag.outputs.externalRepoTagExists }}"
- name: Result of externalRepoTagNotExists
if: always()
run: test "true" = "${{ steps.checkTag.outputs.externalRepoTagNotExists }}"
- name: Result of externalRepoNotExists
if: always()
run: test "true" = "${{ steps.checkTag.outputs.externalRepoNotExists }}"

test-windows:
name: Test Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: 'tag-exists-action: true'
id: checkTag
uses: ./
with:
tag: 'v1.0.0'
- name: 'tag-exists-action: false'
id: notExist
uses: ./
with:
tag: 'not-exist-tag-for-testing'
- name: 'tag-exists-action: external repo - true'
id: externalRepoTagExists
uses: ./
with:
tag: 'v3.6.0'
repo: 'actions/checkout'
- name: 'tag-exists-action: external repo - false'
id: externalRepoTagNotExists
uses: ./
with:
tag: 'not-exist-tag-for-testing'
repo: 'actions/checkout'
- name: 'tag-exists-action: external repo exists - false'
id: externalRepoNotExists
uses: ./
with:
tag: 'not-exist-tag-for-testing'
repo: 'fakeRepo/fakerepo'

- name: Result of checkTag
run: test "true" = "${{ steps.checkTag.outputs.exists }}"
- name: Result of notExist
run: test "false" = "${{ steps.notExist.outputs.notExist }}"
- name: Result of externalRepoTagExists
run: test "true" = "${{ steps.checkTag.outputs.externalRepoTagExists }}"
- name: Result of externalRepoTagNotExists
run: test "true" = "${{ steps.checkTag.outputs.externalRepoTagNotExists }}"
- name: Result of externalRepoNotExists
run: test "true" = "${{ steps.checkTag.outputs.externalRepoNotExists }}"

test-macos:
name: Test MacOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: 'tag-exists-action: true'
id: checkTag
uses: ./
with:
tag: 'v1.0.0'
- name: 'tag-exists-action: false'
id: notExist
uses: ./
with:
tag: 'not-exist-tag-for-testing'
- name: 'tag-exists-action: external repo - true'
id: externalRepoTagExists
uses: ./
with:
tag: 'v3.6.0'
repo: 'actions/checkout'
- name: 'tag-exists-action: external repo - false'
id: externalRepoTagNotExists
uses: ./
with:
tag: 'not-exist-tag-for-testing'
repo: 'actions/checkout'
- name: 'tag-exists-action: external repo exists - false'
id: externalRepoNotExists
uses: ./
with:
tag: 'not-exist-tag-for-testing'
repo: 'fakeRepo/fakerepo'

- name: Result of checkTag
run: test "true" = "${{ steps.checkTag.outputs.exists }}"
- name: Result of notExist
run: test "false" = "${{ steps.notExist.outputs.notExist }}"
- name: Result of externalRepoTagExists
run: test "true" = "${{ steps.checkTag.outputs.externalRepoTagExists }}"
- name: Result of externalRepoTagNotExists
run: test "true" = "${{ steps.checkTag.outputs.externalRepoTagNotExists }}"
- name: Result of externalRepoNotExists
run: test "true" = "${{ steps.checkTag.outputs.externalRepoNotExists }}"

0 comments on commit 20de062

Please sign in to comment.