-
Notifications
You must be signed in to change notification settings - Fork 15
60 lines (52 loc) · 1.87 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
name: Test
strategy:
matrix:
golang: ["1.16"]
os: ["ubuntu-latest", "macos-latest"]
runs-on: ${{ matrix.os }}
steps:
- name: Remove previous jobs
uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
# NOTE: Don't stop master or tags jobs since they might be uploading assets and result into a partial release
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && matrix.os == 'ubuntu-latest'"
- name: Set up Go ${{ matrix.golang }}
uses: actions/setup-go@v2.1.3
with:
go-version: ${{ matrix.golang }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2.3.4
- name: Download golangci-lint
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.38.0
if: "matrix.os == 'ubuntu-latest'"
- name: Lint
run: $(go env GOPATH)/bin/golangci-lint run --timeout=10m
if: "matrix.os == 'ubuntu-latest'"
- uses: actions/cache@v2.1.6
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test that it's buildable
run: go build
- name: Test docker works
run: docker run --rm hello-world
# NOTE: Currently Github Action MacOS agents don't have docker installed
if: "matrix.os == 'ubuntu-latest'"
- name: Test
run: go run mage.go -v test
# NOTE: Currently Github Action MacOS agents don't have docker installed
if: "matrix.os == 'ubuntu-latest'"