-
Notifications
You must be signed in to change notification settings - Fork 3
97 lines (88 loc) · 2.44 KB
/
10-linters-tests.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
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
# This workflow run linters and tests.
# It is supposed to be run on each push to main branch, as well as for each push in pull request.
name: Linters
on:
pull_request:
branches: [ '*' ]
env:
GO_VERSION: "1.21"
IMAGE: linode/linode-cosi-driver
permissions:
contents: read
jobs:
commitlint:
name: Lint commit messages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
golangci-lint:
name: Run golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- uses: golangci/golangci-lint-action@v3
with:
version: latest
skip-cache: true
shell-linter:
name: Run Shellcheck, Checkmake
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Install Checkmake
run: go install github.com/mrtazz/checkmake/cmd/checkmake@latest
- name: Run Checkmake
run: checkmake Makefile
- name: Run Checkmake on tests
run: checkmake test/Makefile
tests:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- run: |
make test
docker:
name: Build dev image and run scans
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build image
uses: docker/build-push-action@v5
with:
push: false
load: true
tags: ${{ env.IMAGE }}:${{ github.sha }}
build-args: |
VERSION=${{ github.sha }}
target: runtime
- name: Scan image using Grype
uses: anchore/scan-action@v3
with:
image: ${{ env.IMAGE }}:${{ github.sha }}
output-format: table
- name: Scan image using Trivy
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ env.IMAGE }}:${{ github.sha }}
format: table
exit-code: '1'
severity: 'CRITICAL,HIGH,MEDIUM'