Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Test

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
go:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.17"]
path: ["", "examples"]
name: Go ${{ matrix.go }} ${{ matrix.path }}
steps:
- name: Setup go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Checkout
uses: actions/checkout@v2

- name: Setup Go modules cache
id: cache-go-module
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-gomod-${{ matrix.path }}-${{ hashFiles('go.sum') }}-
restore-keys: |
${{ runner.os }}-gomod-

- name: Setup Go build cache
id: cache-go-build
uses: actions/cache@v2
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-gobuild-${{ matrix.path }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-gobuild-

- name: Download dependencies
working-directory: ${{ matrix.path }}
if: steps.cache-go-module.outputs.cache-hit != 'true'
run: go mod download

- name: Verify go modules up to date
working-directory: ${{ matrix.path }}
run: |
set -ex
go mod tidy
[ -z "$(git diff -- go.{mod,sum})" ] # Check there are no changes!

- name: Test
working-directory: ${{ matrix.path }}
run: go test ./...

- name: Lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.41
skip-go-installation: true
github-token: ${{ secrets.GITHUB_TOKEN }}
only-new-issues: false
skip-pkg-cache: true
skip-build-cache: true
args: --timeout=10m
working-directory: ${{ matrix.path }}