blob: b2506476d594a6ff59a881939b1b1ec1577d7397 [file] [log] [blame]
name: go_tests
on:
workflow_call:
inputs:
ref:
description: "The git ref to checkout"
required: false
type: string
default: ""
push:
branches-ignore:
- "queue-main-*"
- "queue-dev-*"
pull_request:
jobs:
test:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
- name: Cache Go 1.24.2
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
key: ${{ runner.os }}-go1.24.2-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go1.24.2-
- name: Install tools
run: |
go install golang.org/x/tools/gopls@latest
go install gotest.tools/gotestsum@latest
go install mvdan.cc/gofumpt@latest
go install golang.org/x/tools/cmd/goimports@latest
sudo apt-get update && sudo apt-get -y install chromium
- name: Go generate
run: |
go generate ./...
# if go generate created a diff
if ! git diff --exit-code; then
echo "go generate created a diff"
git diff
exit 1
fi
- name: Run tests
run: |
GOEXPERIMENT=synctest gotestsum --format testname -- ./...
GOEXPERIMENT=synctest gotestsum --format testname -- -race ./...