-
Notifications
You must be signed in to change notification settings - Fork 23
83 lines (72 loc) · 2.15 KB
/
go.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
name: Go
on: # yamllint disable-line rule:truthy
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
outputs:
coverage: ${{ steps.coverage.outputs.coverage }}
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Test
run: make test
- name: Coverage
id: coverage
run: |
make test-create-coverage
COVERAGE=$(go tool cover --func=cover.out | grep total | grep -Eo '[0-9]+\.[0-9]+')
echo "coverage=${COVERAGE}" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v2
with:
name: test-coverage
path: coverage.html
- name: Checking generated files are up to date
run: |
if [[ $(git ls-files --others --exclude-standard) ]]; then git ls-files --others --exclude-standard; echo "These files are not tracked by git"; exit 1; fi
if [ -n "$(git status --porcelain)" ]; then echo "There are uncommitted changes:"; git status --short; exit 1; fi
Coverage:
needs: build
name: "Test Coverage ${{ needs.build.outputs.coverage }}"
runs-on: ubuntu-latest
steps:
- run: |
echo 'Coverage status: ${{ needs.build.outputs.coverage }}'
if [ "$TEST" -lt "80" ]; then echo "Min coverage failed"; exit 1; fi
Lint:
name: Lint code
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Run golangci-lint
uses: golangci/[email protected]
with:
args: --timeout=2m
YamlLint:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v2
- name: 🚀 Run yamllint
run: |
yamllint -f github -c .yamllint .
Security-Scanner:
name: Security Scanner
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Run Gosec Security Scanner
uses: securego/gosec@master
env:
GOFLAGS: -buildvcs=false
with:
args: '-exclude-generated ./...'