mirror of
https://github.com/GoTestTools/gotestfmt-action.git
synced 2026-02-09 09:17:29 +00:00
GitHub Action for gotestfmt
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> |
||
|---|---|---|
| .github | ||
| node_modules | ||
| testdata | ||
| .gitignore | ||
| action.yml | ||
| index.js | ||
| LICENSE.md | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
gotestfmt: go test output for humans
⚠️ Action required: gotestfmt has moved to the
GoTestToolsorganization and you need to update your references. Please see the announcement. The old repository will be deleted on January 1, 2023.
This action uses gotestfmt to create a beautifully formatted test output in GitHub Actions.
Usage
You can use gotestfmt with the following configuration:
jobs:
build:
name: Test
runs-on: ubuntu-latest
steps:
# Checkout your project with git
- name: Checkout
uses: actions/checkout@v2
# Install Go on the VM running the action.
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
# Install gotestfmt on the VM running the action.
- name: Set up gotestfmt
uses: GoTestTools/gotestfmt-action@v2
with:
# Optional: pass GITHUB_TOKEN to avoid rate limiting.
token: ${{ secrets.GITHUB_TOKEN }}
# Optional: pass the gotestfmt version you want to run.
version: v2.0.0
# Optional: pass an organization name and repo to use a fork
org: GoTestTools
repo: gotestfmt
# Run tests with nice formatting. Save the original log in /tmp/gotest.log
- name: Run tests
run: |
set -euo pipefail
go test -json -v ./... 2>&1 | tee /tmp/gotest.log | gotestfmt
# Upload the original go test log as an artifact for later review.
- name: Upload test log
uses: actions/upload-artifact@v2
if: always()
with:
name: test-log
path: /tmp/gotest.log
if-no-files-found: error
For more information about gotestfmt please see the gotestfmt repository.