-
Notifications
You must be signed in to change notification settings - Fork 170
99 lines (78 loc) · 2.11 KB
/
build.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Test & Build
on:
push:
branches:
- master
pull_request:
jobs:
install-go-modules:
strategy:
matrix:
go: ["1.22.x", "1.21.x", "1.20.x"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Test install Go modules for v${{ matrix.go }}
run: go install -v . && chamber version
test:
strategy:
matrix:
go: ["1.22.x", "1.21.x", "1.20.x"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Test
run: make test
- name: Check modules are tidy and checked in
run: |
export GO111MODULE=on
go mod tidy
if [ "$(git status --porcelain)" != "" ]; then
echo "git tree is dirty after tidying modules"
echo "ensure go.mod and go.sum are tidy"
git status
exit 1
fi
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.22.x"
- name: Run coverage
run: make coverage
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: segmentio/chamber
dist:
strategy:
matrix:
go: ["1.22.x", "1.21.x", "1.20.x"]
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Install nfpm, rpmbuild
run: sudo make -f Makefile.tools nfpm-debian rpmbuild-debian
- name: Make distributables
run: make -f Makefile.release dist
- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.go }}
path: "dist/*"