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-12-06 16:30:39 +01:00
|
|
|
uses: actions/setup-go@v5
|
2020-07-29 12:07:21 +02:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
|
|
|
|
- name: Checkout code
|
2023-09-04 14:45:28 +02:00
|
|
|
uses: actions/checkout@v4
|
2020-07-29 12:07:21 +02:00
|
|
|
|
|
|
|
# See https://github.com/actions/cache/blob/master/examples.md#go---modules
|
|
|
|
- name: Cache Go Modules
|
2024-01-17 17:19:47 +01:00
|
|
|
uses: actions/cache@v4
|
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 ./...
|