gotesttools-gotestfmt-action/.github/workflows/selftest.yml
Yuri Norwood 8476589e0d
Separate windows step from *nix runners
This allows `bash` and `pwsh` syntax to be used separately to avoid having to write the test as a polyglot 😬

Also added `secrets.GITHUB_TOKEN` as a fallback in case the repo secret `secrets.GH_TOKEN` is not set up, e.g. in a fork.

Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com>
2022-10-31 08:43:22 +13:00

47 lines
1.1 KiB
YAML

on:
pull_request:
name: Self-test
jobs:
self-test:
strategy:
fail-fast: false
matrix:
os: ['ubuntu', 'macos', 'windows']
runs-on: ${{ matrix.os }}-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Checkout
uses: actions/checkout@v2
- name: Install gotestfmt
uses: ./
with:
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
- name: Run gotestfmt
if: matrix.os != 'windows'
working-directory: testdata
run: |
go test -json -v ./... 2>&1 | tee /tmp/gotest.${{ matrix.os }}.log | gotestfmt
- name: Run gotestfmt (Windows)
if: matrix.os == 'windows'
working-directory: testdata
run: |
go test -json -v ./... 2>&1 | Tee-Object /tmp/gotest.${{ matrix.os }}.log | gotestfmt
- name: Upload test log
uses: actions/upload-artifact@v3
if: always()
with:
name: test-log-${{ matrix.os }}
path: /tmp/gotest.${{ matrix.os }}.log
if-no-files-found: error