Repository navigation
99 lines (78 loc) · 2.18 KB
/
Copy pathmain.yml
File metadata and controls
99 lines (78 loc) · 2.18 KB
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
name: Test
on:
push:
branches:
- master
pull_request:
branches:
- master
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup Go
uses: actions/setup-go@v7
with:
go-version-file: 'go.mod'
- name: Install dependencies
run: go mod download
- name: Build
run: go build -v ./...
- name: Test
run: go test -v -race ./...
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup Go
uses: actions/setup-go@v7
with:
go-version-file: 'go.mod'
- name: Check go.mod and go.sum are tidy
run: go mod tidy -diff
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.15.0
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup Go
uses: actions/setup-go@v7
with:
go-version-file: 'go.mod'
cache: false
# Matches the Go version selected by release-version.sh
- name: Get Go Version
id: get-go-version
run: |
echo "version=$(go mod edit -json | jq -r '.Toolchain // .Go' | sed 's/go//')" >> $GITHUB_OUTPUT
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build image
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64
load: true
tags: github-exporter:ci
build-args: |
GOLANG_VERSION=${{ steps.get-go-version.outputs.version }}
- name: Run Trivy
uses: aquasecurity/trivy-action@8f28faec26515256b6d22074d1d2a8986f4cbd87 # master
env:
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db
with:
scan-type: image
image-ref: github-exporter:ci
format: table
exit-code: '1'
ignore-unfixed: true
severity: CRITICAL,HIGH