forked from solacecommunity/solace-prometheus-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (93 loc) · 2.79 KB
/
build-test.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
106
107
108
109
110
111
112
name: Build and Test
on:
push:
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
- name: Check out code
uses: actions/checkout@v4
- name: Lint Go Code
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.55.2
make lint
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
- name: Check out code
uses: actions/checkout@v2
- name: Run Unit tests.
run: |
mkdir reports
make test-coverage
- name: Uploads reports
if: ${{ !startsWith(github.ref_name, '1.') }}
uses: actions/upload-artifact@v2
with:
path: |
./reports/cover.out
./reports/cover.html
build:
name: Build & push image
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
- name: Check out code
uses: actions/checkout@v2
- name: Build
run: make build
- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build image and push GitHub Container Registry
uses: docker/build-push-action@v5
with:
context: ./
tags: |
ghcr.io/solacedev/pubsubplus-prometheus-exporter:1.0.2-dev
push: true
platforms: linux/amd64,linux/arm64
- name: Run Whitesource Action
uses: SolaceDev/[email protected]
with:
wssURL: https://saas.whitesourcesoftware.com/agent
apiKey: ${{ secrets.WSS_API_KEY }}
productName: 'pubsubplus-prometheus-exporter'
projectName: 'pubsubplus-prometheus-exporter'
configFile: 'ci/whitesource/whitesource-agent.config'
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: ghcr.io/solacedev/pubsubplus-prometheus-exporter:1.0.2-dev
format: 'sarif'
severity: 'CRITICAL,HIGH'
output: 'trivy-results.sarif'
- name: Uploads Trivy Scan Reports
if: ${{ !startsWith(github.ref_name, '1.') }}
uses: actions/upload-artifact@v2
with:
path: |
trivy-results.sarif