-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (73 loc) · 1.81 KB
/
code-quality.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
name: code quality
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: ensure go mod tidy
run: go mod tidy && git diff --exit-code go.mod go.sum
- name: get linter version
id: linter-version
run: echo "version=$(grep 'LINTER_VERSION :=' Makefile | awk '{print $3}')" > $GITHUB_OUTPUT
- name: lint
uses: golangci/golangci-lint-action@v3
with:
version: v${{ steps.linter-version.outputs.version }}
args: --timeout=15m
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: test
run: go test -race -cover -short ./...
test-docker:
runs-on: ubuntu-latest
needs: [test]
services:
dind:
image: docker:24.0-dind-rootless
ports:
- 2375:2375
steps:
- uses: actions/checkout@v3
- name: set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: test
run: go test -race -cover ./...
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: build
run: make build
build-docker:
runs-on: ubuntu-latest
steps:
- name: set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: build
uses: docker/build-push-action@v4
with:
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest