Skip to content

Add prettier test results #2745

Add prettier test results

Add prettier test results #2745

Workflow file for this run

name: Test
on:
push:
branches:
- master
pull_request:
types: [ opened, synchronize ]
# When a new revision is pushed to a PR, cancel all in-progress CI runs for that
# PR. See https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
go: ["1.21", "1.22"]
runs-on: ${{ matrix.os }}
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
# Install gotestfmt on the VM running the action.
- name: Core tests
uses: nick-fields/retry@v3
with:
shell: bash
max_attempts: 3
timeout_minutes: 20
command: |
set -euo pipefail
go mod download
go test -json -race ./... -trimpath 2>&1 > gotest.json
- name: Annotate tests
if: ${{ failure() }}
uses: guyarb/[email protected]
with:
test-results: gotest.json
- name: Convert test output to junit
shell: bash
if: always()
run: |
go install gotest.tools/gotestsum@latest
export GOBIN="$(go env GOPATH)"
"${GOBIN}/bin/gotestsum" --raw-command cat gotest.json
- name: Example tests
uses: nick-fields/retry@v3
with:
shell: bash
max_attempts: 3
timeout_minutes: 20
command: |
cd _examples
go mod download
go test -json -race ./... -trimpath 2>&1 > ../go_examples_test.json
# gotestsum \
# --junitfile .results/results.xml \
# --jsonfile .results/results.json \
# --format testname \
# -- -coverprofile=.results/cover.out ./...
- name: Convert example test output to junit
shell: bash
if: always()
run: |
go install gotest.tools/gotestsum@latest
export GOBIN="$(go env GOPATH)"
"${GOBIN}/bin/gotestsum" --raw-command cat go_examples_test.json