2020-07-29 12:07:21 +02:00
|
|
|
name: build
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags: [v*]
|
|
|
|
branches: [master]
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
# See https://github.com/mvdan/github-actions-golang
|
|
|
|
test:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-03-18 12:14:52 +01:00
|
|
|
os: [ubuntu-latest,macos-latest,windows-latest]
|
|
|
|
go-version: [1.14.x, 1.15.x, 1.17.x, 1.18.x]
|
2020-07-29 12:07:21 +02:00
|
|
|
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-new-combinations
|
2022-03-18 12:14:52 +01:00
|
|
|
exclude:
|
2020-07-29 12:07:21 +02:00
|
|
|
- os: windows-latest
|
2022-03-18 12:14:52 +01:00
|
|
|
go-version: 1.14.x
|
2020-07-29 12:07:21 +02:00
|
|
|
- os: macos-latest
|
2022-03-18 12:14:52 +01:00
|
|
|
go-version: 1.14.x
|
2020-07-29 12:07:21 +02:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Install Go
|
2023-03-15 15:57:15 +01:00
|
|
|
uses: actions/setup-go@v4
|
2020-07-29 12:07:21 +02:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
|
|
|
|
- name: Checkout code
|
2022-10-26 19:51:08 +02:00
|
|
|
uses: actions/checkout@v3
|
2020-07-29 12:07:21 +02:00
|
|
|
|
|
|
|
# See https://github.com/actions/cache/blob/master/examples.md#go---modules
|
|
|
|
- name: Cache Go Modules
|
2022-10-26 19:51:08 +02:00
|
|
|
uses: actions/cache@v3
|
2020-07-29 12:07:21 +02:00
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
|
|
|
|
- name: Go install moq
|
|
|
|
run: go install -mod=readonly
|
|
|
|
|
|
|
|
- name: Run vet
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
run: go vet -mod=readonly ./...
|
|
|
|
|
|
|
|
- name: Lint
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
run: |
|
|
|
|
GO111MODULE=off go get -u golang.org/x/lint/golint
|
|
|
|
golint ./...
|
|
|
|
|
|
|
|
- name: Test
|
|
|
|
run: go test -mod=readonly ./...
|