-
-
Notifications
You must be signed in to change notification settings - Fork 10
247 lines (202 loc) · 5.89 KB
/
build.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
name: build
on:
pull_request:
branches:
- main
- v*
push:
branches:
- main
- v*
tags:
- v*
repository_dispatch:
workflow_dispatch:
schedule:
- cron: '0 0 * * 1'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: Linux - Go 1.13
go: '1.13'
build: yes
test: yes
lint: no
coverage: no
- name: Linux - Go 1.x
go: '1.x'
build: yes
test: yes
lint: no
coverage: no
- name: Linters
go: '1.x'
build: no
test: no
lint: yes
coverage: no
- name: Coverage
go: '1.x'
build: yes
test: yes
lint: no
coverage: yes
name: ${{ matrix.name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get -y install g++ pkg-config scons ragel gengetopt \
libuv1-dev libunwind-dev libspeexdsp-dev libsox-dev libpulse-dev \
libtool intltool autoconf automake make cmake meson
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Build Roc
run: |
git clone https://github.com/roc-streaming/roc-toolkit.git /tmp/roc
scons -C /tmp/roc -Q --build-3rdparty=openfec
sudo scons -C /tmp/roc -Q --build-3rdparty=openfec install
- name: Build bindings
if: ${{ matrix.build == 'yes' }}
run: |
cd roc
go list -f {{.IgnoredGoFiles}} .
go get -v .
- name: Run tests
if: ${{ matrix.test == 'yes' }}
run: |
cd roc
go build && go test -count=1 -covermode=count -coverprofile=coverage.out
- name: Run tests under race detector
if: ${{ matrix.test == 'yes' }}
run: |
cd roc
go build && go test -count=1 -race
- name: Run tests with cgocheck
if: ${{ matrix.test == 'yes' }}
run: |
cd roc
GOEXPERIMENT=cgocheck2 go build && go test -count=1 .
- name: Run linters
if: ${{ matrix.lint == 'yes' }}
uses: golangci/golangci-lint-action@v3
with:
version: v1.59.0
working-directory: roc
- name: Prepare coverage report
if: ${{ matrix.coverage == 'yes' }}
uses: jandelgado/[email protected]
with:
working-directory: roc
- name: Send coverage report
if: ${{ matrix.coverage == 'yes' }}
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: roc/coverage.lcov
macos:
runs-on: macos-latest
name: macOS
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install system dependencies
run: |
brew install scons ragel gengetopt libuv speexdsp sox cpputest
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.x'
- name: Build Roc
run: |
git clone https://github.com/roc-streaming/roc-toolkit.git /tmp/roc
scons -C /tmp/roc -Q --build-3rdparty=openfec
sudo scons -C /tmp/roc -Q --build-3rdparty=openfec install
- name: Build bindings
run: |
cd roc
go list -f {{.IgnoredGoFiles}} .
go get -v .
- name: Run tests
run: |
cd roc
go build && go test -count=1
- name: Run tests under race detector
run: |
cd roc
go build && go test -count=1 -race
- name: Run tests with cgocheck
run: |
cd roc
GOEXPERIMENT=cgocheck2 go build && go test -count=1 .
formatting:
runs-on: ubuntu-latest
name: Code formatting
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run gofmt
uses: Jerome1337/[email protected]
with:
gofmt-path: './roc'
gofmt-flags: '-s -l -d'
generation:
runs-on: ubuntu-latest
name: Code generation
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.x
- name: Install stringer
run: go install golang.org/x/tools/cmd/stringer@latest
- name: Run go generate
run: |
cd roc
go generate
- name: Check for git changes
shell: bash -e {0}
run: |
if [[ $(git status --porcelain | grep -E "^\s*[MARCD?].*\.go$") ]]; then
echo "please run 'go generate' and commit generated files"
exit 1
fi
release:
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: [linux, macos, formatting, generation]
name: Release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Check version
shell: bash
run: |
version_git="$(git describe --tags --abbrev=0 | sed s/v//g)"
version_src="$(sed -rn 's,.*bindingsVersion\s*=\s*"(\S+)".*,\1,p' ./roc/version.go)"
if [[ "$version_git" != "$version_src" ]]; then
echo "please update hardcoded version to current git version \"$version_git\"" \
>> "$GITHUB_OUTPUT"
exit 1
fi
- name: Create release
uses: softprops/action-gh-release@v1
with:
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}