-
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (74 loc) · 2.26 KB
/
ci-go.yaml
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Copyright (c) 2020-present Sven Greb <[email protected]>
# This source code is licensed under the MIT license found in the LICENSE file.
# GitHub Action Workflow for continuous integration jobs.
# See https://docs.github.com/en/actions and https://github.com/features/actions for more details.
name: ci-go
on:
push:
paths:
- "**.go"
branches:
- main
tags:
- v*
pull_request:
paths:
- "**.go"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Print metadata and context information
run: |
echo "Git SHA: $GITHUB_SHA"
echo "Git Ref: $GITHUB_REF"
echo "Workflow Actor: $GITHUB_ACTOR"
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Go 1.17
uses: actions/setup-go@v2
with:
go-version: "1.17.x"
- name: "Run golangci-lint"
# The official golangci-lint action created and maintained by the golangci-lint project.
# See https://github.com/golangci/golangci-lint-action for more details.
uses: golangci/[email protected]
with:
version: v1.43
test:
runs-on: ubuntu-latest
needs:
- lint
steps:
- name: Print metadata and context information
run: |
echo "Git SHA: $GITHUB_SHA"
echo "Git Ref: $GITHUB_REF"
echo "Workflow Actor: $GITHUB_ACTOR"
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Go 1.17
uses: actions/setup-go@v2
with:
go-version: "1.17.x"
- name: Run tests with coverage and race detector
run: go test -cover -race -v ./...
post-tasks:
runs-on: ubuntu-latest
steps:
- name: Print metadata and context information
run: |
echo "Git SHA: $GITHUB_SHA"
echo "Git Ref: $GITHUB_REF"
echo "Workflow Actor: $GITHUB_ACTOR"
- name: Checkout repository
uses: actions/checkout@v2
- name: Cache Go dependencies and build outputs
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-