-
Notifications
You must be signed in to change notification settings - Fork 3
99 lines (82 loc) · 2.36 KB
/
release.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
name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-beta[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-alpha[0-9]+"
permissions:
contents: write
concurrency:
group: "lint-test"
cancel-in-progress: true
jobs:
# Lint go source code.
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Run Go linters
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout 5m
# Run unit tests.
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Install Docker (mac)
if: runner.os == 'macos'
run: |
brew install docker
colima start
# For testcontainers to find the Colima socket
# https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
- name: Run Tests
run: |
go test -mod=mod -shuffle=on -race -timeout 300s -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage report
if: runner.os == 'Linux'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
flags: unittests
release:
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Run GoReleaser for release
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --debug --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}