blob: 3447da940a436a24236f61b5d6e4c23b7bb6ea24 [file] [log] [blame]
name: Test
on:
push:
branches:
- '*'
tags-ignore:
- 'v*'
pull_request:
defaults:
run:
shell: bash
jobs:
test:
strategy:
fail-fast: false
matrix:
# Use a stable version of 1.14.x for the go generate step below
go-version: [1.13.x, 1.14.3]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
- name: Generate
# The Go version corresponds to the precise 1.14.x version specified in
# the matrix. Skip windows for now until we work out why re-gen is flaky
if: matrix.go-version == "1.14.3" && matrix.platform != "windows-latest"
run: go generate ./...
- name: Test
run: go test ./...
- name: Test with -race
run: go test -race ./...
- name: gorelease check
run: go run golang.org/x/exp/cmd/gorelease
- name: Check that git is clean post generate and tests
run: test -z "$(git status --porcelain)" || (git status; git diff; false)
- name: Pull this commit through the proxy on master
if: github.ref == 'refs/heads/master'
run: |
v=$(git rev-parse HEAD)
cd $(mktemp -d)
go mod init mod.com
GOPROXY=https://proxy.golang.org go get -d cuelang.org/go@$v