mirror of
https://github.com/GoTestTools/gotestfmt-action.git
synced 2026-02-08 00:37:27 +00:00
Extend selftest workflow to multiple runners (#9)
* Extend selftest workflow to multiple runners This should help catch errors like #4 and #8 by ensuring that gotestfmt can run on all the major OS runners for GitHub Actions. Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com> * 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> * Remove `/tmp` directory for artifacts On MacOS, this results in: ``` Error: Provided rootDirectory /tmp is not a valid directory ``` On Windows this results in: ``` Error: No files were found with the provided path: /tmp/gotest.windows.log. No artifacts will be uploaded. ``` Both seem to be unhappy with `/tmp`, since the workspace is implicitly cleaned up at the end of the workflow, there shouldn't be a need to specify `/tmp`. Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com> * Name each workflow run of the matrix Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com> * Fix artifact path Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com> * Simplify workflow by just using bash universally Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com> * Apply suggestions from code review Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com> Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com>
This commit is contained in:
parent
803214ad85
commit
07a236ddd6
1 changed files with 21 additions and 31 deletions
52
.github/workflows/selftest.yml
vendored
52
.github/workflows/selftest.yml
vendored
|
|
@ -1,52 +1,42 @@
|
|||
on:
|
||||
pull_request:
|
||||
|
||||
name: Self-test
|
||||
jobs:
|
||||
self-test-ubuntu:
|
||||
name: on Ubuntu
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
self-test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ['ubuntu', 'macos'] # TODO: add windows
|
||||
|
||||
name: on ${{ matrix.os }}
|
||||
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 }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Run gotestfmt
|
||||
working-directory: testdata
|
||||
run: go test -json -v ./... 2>&1 | tee /tmp/gotest.log | gotestfmt
|
||||
shell: bash
|
||||
run: |
|
||||
go test -json -v ./... 2>&1 | tee gotest.${{ matrix.os }}.log | gotestfmt
|
||||
|
||||
- name: Upload test log
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: test-log-ubuntu
|
||||
path: /tmp/gotest.log
|
||||
name: test-log-${{ matrix.os }}
|
||||
path: testdata/gotest.${{ matrix.os }}.log
|
||||
if-no-files-found: error
|
||||
self-test-macos:
|
||||
name: on MacOS
|
||||
runs-on: macos-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 }}
|
||||
- name: Run gotestfmt
|
||||
working-directory: testdata
|
||||
run: go test -json -v ./... 2>&1 | tee ./gotest.log | gotestfmt
|
||||
- name: Upload test log
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: test-log-macos
|
||||
path: ./testdata/gotest.log
|
||||
if-no-files-found: error
|
||||
Loading…
Reference in a new issue