-
Notifications
You must be signed in to change notification settings - Fork 8
68 lines (57 loc) · 1.55 KB
/
ci.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
67
68
name: Continuous Integration
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build:
name: Build and Test
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "~1.22.6"
check-latest: true
cache-dependency-path: internal/tools/go.sum
- name: Cache tools
id: cache-tools
uses: actions/cache@v4
with:
path: .tools
key: ci-tools-${{ runner.os }}-${{ hashFiles('internal/tools/go.sum') }}
- name: Install tools
if: steps.cache-tools.outputs.cache-hit != 'true'
run: |
mkdir -p .tools
touch .tools/*
make install-tools
- name: Generate source files
run: make generate
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ci-mods-${{ runner.os }}-${{ hashFiles('build/go.sum') }}
- name: Build
run: make build
- name: Print components
run: make components
- name: Verify
run: make test
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/golang@master
if: github.ref == 'refs/heads/main'
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: monitor
args: --file=build/go.mod