-
Notifications
You must be signed in to change notification settings - Fork 141
90 lines (88 loc) · 2.91 KB
/
go-ci.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
79
80
81
82
83
84
85
86
87
88
89
90
name: Validate PR - golang CI
on:
pull_request:
branches: [main]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
path:
- task-generator
- ta-generator
steps:
- uses: actions/checkout@2d7d9f7ff5b310f983d059b68785b3c74d8b8edd
- uses: actions/setup-go@b26d40294f8ad76fcc90b915dac85892322fe62d
with:
go-version-file: './${{matrix.path}}/go.mod'
cache-dependency-path: ./${{matrix.path}}/go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@c7bab6f874a90c53ecf7e5c027cf93430c8aac17
with:
working-directory: ${{matrix.path}}
args: "--timeout=10m --build-tags='normal periodic'"
go:
name: Check sources
runs-on: ubuntu-latest
strategy:
matrix:
path:
- task-generator
- ta-generator
steps:
- uses: actions/checkout@2d7d9f7ff5b310f983d059b68785b3c74d8b8edd
- name: Install Go
uses: actions/setup-go@b26d40294f8ad76fcc90b915dac85892322fe62d
with:
go-version-file: './${{matrix.path}}/go.mod'
cache-dependency-path: ./${{matrix.path}}/go.sum
- name: Check go mod status
working-directory: ${{matrix.path}}
run: |
go mod tidy
if [[ ! -z $(git status -s) ]]
then
echo "Go mod state is not clean:"
git --no-pager diff
exit 1
fi
- name: Check format
working-directory: ${{matrix.path}}
run: |
go fmt ./...
if [[ ! -z $(git status -s) ]]
then
echo "not all golang files properly gofmt'ed:"
git --no-pager diff
exit 1
fi
- name: Tests
working-directory: ${{matrix.path}}
run: |
go test ./...
security_scan:
name: Security scan
runs-on: ubuntu-latest
strategy:
matrix:
path:
- task-generator
- ta-generator
steps:
- uses: actions/checkout@2d7d9f7ff5b310f983d059b68785b3c74d8b8edd
- uses: actions/setup-go@b26d40294f8ad76fcc90b915dac85892322fe62d
with:
go-version-file: './${{matrix.path}}/go.mod'
cache-dependency-path: ./${{matrix.path}}/go.sum
# https://github.com/securego/gosec/blob/12be14859bc7d4b956b71bef0b443694aa519d8a/README.md#integrating-with-code-scanning
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
# we let the report trigger content trigger a failure using the GitHub Security features.
args: '-tags normal,periodic -no-fail -fmt sarif -out results.sarif ${{matrix.path}}/...'
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@4a01ec798636a8442fbe054c7795e139a5960d29
with:
# Path to SARIF file relative to the root of the repository
sarif_file: results.sarif