-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (108 loc) · 2.94 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
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:
workflow_dispatch:
push:
pull_request:
permissions:
contents: read
jobs:
lint-go:
name: Lint go code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: "1.18"
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.57.2
- name: Run goreleaser check
uses: goreleaser/goreleaser-action@v5
with:
args: check
lint-dockerfile:
name: Lint dockerfile
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install hadolint
env:
HADOLINT_VERSION: "2.12.0"
run: |
curl -SL "https://github.com/hadolint/hadolint/releases/download/v${HADOLINT_VERSION}/hadolint-Linux-$(uname -m)" \
-o /usr/local/bin/hadolint \
&& chmod +x /usr/local/bin/hadolint
- name: Run hadolint
run: hadolint Dockerfile
lint-commit:
name: Lint commit messages
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install commitlint
env:
COMMITLINT_CLI_VERSION: "19.2.2"
COMMITLINT_CONFIG_CONVENTIONAL_VERSION: "19.2.2"
run: |
npm install -g \
"@commitlint/cli@${COMMITLINT_CLI_VERSION}" \
"@commitlint/config-conventional@${COMMITLINT_CONFIG_CONVENTIONAL_VERSION}"
- name: Run commitlint
run: |
commitlint --verbose \
--from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} \
--to ${{ github.event.pull_request.head.sha }}
test:
name: Test
strategy:
matrix:
go-version:
- "1.20"
- "1.19"
- "1.18"
platform:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Run gotestsum
run: |
go clean -testcache
gotestsum ./... -- --race
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: "1.20"
- name: Run goreleaser
uses: goreleaser/goreleaser-action@v5
with:
args: release --clean --snapshot