-
Notifications
You must be signed in to change notification settings - Fork 5
66 lines (63 loc) · 1.89 KB
/
build.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
name: Pull Request Build
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v2.1.5
with:
go-version: 1.16
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2.4.0
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2.8.1
with:
version: latest
args: release --skip-publish --rm-dist
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.2.1
if: github.event_name == 'pull_request'
with:
image-ref: 'ghcr.io/kubesphere-sigs/ks-releaser:latest'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
- name: Push image
if: github.ref == 'refs/heads/master'
run: |
docker login ghcr.io --username linuxsuren --password ${{secrets.GH_PUBLISH_SECRETS}}
docker tag ghcr.io/kubesphere-sigs/ks-releaser:latest ghcr.io/kubesphere-sigs/ks-releaser:master
docker push ghcr.io/kubesphere-sigs/ks-releaser:master
UnitTest:
name: Test
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v2.1.5
with:
go-version: 1.16
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2.4.0
- name: Test
run: |
go test ./... -coverprofile coverage.out
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.out
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true