-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (102 loc) · 2.79 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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: ci
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
branches:
- main
path-ignore:
- '**.md'
jobs:
build-test:
name: Build & Test
runs-on: ${{ matrix.operating-system }}
env:
GO111MODULE: on
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./... -race -coverprofile="coverage.txt" -covermode=atomic
- name: Publish codecov report
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.txt
flags: unittests
name: ${{ env.GITHUB_REF }} (${{ matrix.operating-system }})
fail_ci_if_error: true
audit:
name: Security & Code Quality
runs-on: ubuntu-latest
needs: build-test
env:
GO111MODULE: on
permissions:
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: ./...
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: go
- name: CodeQL Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
version:
name: Version release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
outputs:
new_tag: ${{ steps.version.outputs.new_tag }}
changelog: ${{ steps.version.outputs.changelog }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Bump version and push tag
id: version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: main
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.RELEASE_APP_ID }}
private_key: ${{ secrets.RELEASE_APP_SECRET }}
- name: Create a GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
with:
tag_name: ${{ steps.version.outputs.new_tag }}
release_name: Release ${{ steps.version.outputs.new_tag }}
body: ${{ steps.version.outputs.changelog }}