-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (92 loc) · 2.33 KB
/
ci.yml
File metadata and controls
111 lines (92 loc) · 2.33 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
100
101
102
103
104
105
106
107
108
109
110
111
name: CI
on:
push:
branches: [main, 'release-please--branches--main']
pull_request:
paths-ignore:
- CHANGELOG.md
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.ref }}
sha: ${{ github.sha }}
- name: Set up Go 1.25
uses: actions/setup-go@v6
with:
go-version: '1.25'
- name: Install dependencies
run: go mod download
- name: Run tests
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.txt
flags: unittests
name: codecov-umbrella
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.ref }}
sha: ${{ github.sha }}
- name: Run linting using Makefile
run: make lint-only
build:
name: Build
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.ref }}
sha: ${{ github.sha }}
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25'
- name: Build
run: |
go build -v -ldflags="-s -w" -o ghcr-exporter ./cmd
- name: Upload build artifacts
uses: actions/upload-artifact@v5
with:
name: ghcr-exporter
path: ghcr-exporter
retention-days: 30
security:
name: Security Scan
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.ref }}
sha: ${{ github.sha }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
scan-ref: '.'
format: 'table'
exit-code: '1'
severity: 'CRITICAL,HIGH'