-
Notifications
You must be signed in to change notification settings - Fork 11
236 lines (235 loc) · 8.35 KB
/
test.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
name: Test
on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- v*
schedule:
- cron: 6 22 * * FRI
jobs:
check-format:
name: Check Format
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Check
run: scripts/github/check-format
check-lint:
name: Check Lint
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Lint
run: scripts/github/lint
unit-test:
strategy:
matrix:
sanitizer: ["none", "asan"]
include:
- sanitizer: asan
name_suffix: " (ASAN)"
name: Unit Test${{ matrix.name_suffix }}
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Unit Test
env:
SANITIZER: ${{ matrix.sanitizer }}
run: scripts/github/unit-test
build-integration-test-images:
strategy:
matrix:
target:
- name: "Latest"
libmpdclient_version: "latest"
mpd_version: "latest"
- name: "Noble"
libmpdclient_version: "2.22"
mpd_version: "0.23.14"
- name: "Jammy"
libmpdclient_version: "2.20"
mpd_version: "0.23.5"
- name: "Focal"
libmpdclient_version: "2.18"
mpd_version: "0.21.20"
name: "Build ${{ matrix.target.name }} Integration Test Container"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 'stable'
cache-dependency-path: tools/meta/go.sum
- uses: docker/setup-buildx-action@v3
# This whole little song and dance is pretty annoying. Ideally I could
# just use ./scripts/run-integration and be done with it, but to get
# caching, I need to use the build-push-action. This is because gha
# only exposes the necessary values to the node runtime, not via a script
# consumable mechanism. There is a bug out for this, so hopefully this
# can all be deleted eventually: https://github.com/actions/runner/issues/3046
#
# We still need to run "build-test-image" here to do the little tarring
# step. Maybe I can delete that, and just go straight to build-push-action?
- name: Stage Build
id: stage
env:
MPD_VERSION: ${{ matrix.target.mpd_version }}
LIBMPDCLIENT_VERSION: ${{ matrix.target.libmpdclient_version }}
run: |
git submodule update --init --recursive
# produces the outputs used in the subseqent step
scripts/github/resolve-versions
- name: Build Integration Test Container
uses: docker/build-push-action@v6
with:
context: .
file: t/docker/Dockerfile.ubuntu
build-args: |
LIBMPDCLIENT_VERSION=${{ steps.stage.outputs.LIBMPDCLIENT_VERSION }}
MPD_VERSION=${{ steps.stage.outputs.MPD_VERSION }}
tags: test/ashuffle:latest
cache-from: type=gha,scope=${{ matrix.target.name }}
cache-to: type=gha,mode=max,scope=${{ matrix.target.name }}
integration-test:
strategy:
matrix:
target:
- name: "Latest"
libmpdclient_version: "latest"
mpd_version: "latest"
- name: "Noble"
libmpdclient_version: "2.22"
mpd_version: "0.23.14"
- name: "Jammy"
libmpdclient_version: "2.20"
mpd_version: "0.23.5"
- name: "Focal"
libmpdclient_version: "2.18"
mpd_version: "0.21.20"
test_group:
- name: "Short"
args: "-short"
- name: "Memory (Massive)"
args: "-run 'TestMaxMemoryUsage/massive'"
- name: "Memory (Worst Case)"
args: "-run 'TestMaxMemoryUsage/worst.case'"
- name: "Startup (From MPD)"
args: "-run 'TestFastStartup/from.mpd'"
- name: "Startup (From File)"
args: "-run 'TestFastStartup/from.file'"
- name: "Startup (From File, With Filter)"
args: "-run 'TestFastStartup/from.file,.with.filter'"
- name: "Startup (From MPD, Group By)"
args: "-run 'TestFastStartup/from.mpd,.group-by'"
name: "Integration Test (${{ matrix.target.name }}): ${{ matrix.test_group.name }}"
runs-on: ubuntu-latest
needs: [check-format, check-lint, unit-test, build-integration-test-images]
steps:
# this is a replay of the build-container steps, but since those ran
# previously, this should be fully cached.
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 'stable'
cache-dependency-path: tools/meta/go.sum
- uses: docker/setup-buildx-action@v3
# This whole little song and dance is pretty annoying. Ideally I could
# just use ./scripts/run-integration and be done with it, but to get
# caching, I need to use the build-push-action. This is because gha
# only exposes the necessary values to the node runtime, not via a script
# consumable mechanism. There is a bug out for this, so hopefully this
# can all be deleted eventually: https://github.com/actions/runner/issues/3046
#
# We still need to run "build-test-image" here to do the little tarring
# step. Maybe I can delete that, and just go straight to build-push-action?
- name: Stage Build
id: stage
env:
MPD_VERSION: ${{ matrix.target.mpd_version }}
LIBMPDCLIENT_VERSION: ${{ matrix.target.libmpdclient_version }}
run: |
git submodule update --init --recursive
# produces the outputs used in the subseqent step
scripts/github/resolve-versions
- name: Build Integration Test Container
uses: docker/build-push-action@v6
with:
context: .
file: t/docker/Dockerfile.ubuntu
build-args: |
LIBMPDCLIENT_VERSION=${{ steps.stage.outputs.LIBMPDCLIENT_VERSION }}
MPD_VERSION=${{ steps.stage.outputs.MPD_VERSION }}
tags: test/ashuffle:latest
cache-from: type=gha,scope=${{ matrix.target.name }}
load: true
# This is the actual new work, running the actual test.
- name: Run Test
run: |
scripts/run-integration \
--no_build_use_image=test/ashuffle:latest \
--no_tty ${{ matrix.test_group.args }}
release-build:
name: Release Build (${{ matrix.target.arch }})
runs-on: ubuntu-latest
needs: [check-format, check-lint, unit-test]
strategy:
matrix:
target:
- arch: "x86_64"
triple: "x86_64-linux-gnu"
- arch: "aarch64"
triple: "aarch64-linux-gnu"
- arch: "armv6h"
triple: "armv6h-linux-gnueabihf"
- arch: "armv7h"
triple: "armv7h-linux-gnueabihf"
steps:
- name: Clone
uses: actions/checkout@v4
- name: Release Build
run: scripts/github/release ashuffle.${{ matrix.target.triple }} ${{ matrix.target.arch }}
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ashuffle.${{ matrix.target.triple }}
path: ashuffle.${{ matrix.target.triple }}
if-no-files-found: error
retention-days: 7
release:
name: Release
runs-on: ubuntu-latest
needs: [release-build, integration-test]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Clone
uses: actions/checkout@v4
- name: Download Builds
uses: actions/download-artifact@v4
with:
pattern: "ashuffle.*"
# Download files into the destination path, not separate directories.
merge-multiple: true
- name: Deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ github.ref }}
run: |
find .
# Cut off the "refs/tags" prefix.
tag="${RELEASE_TAG#"refs/tags/"}"
gh release create \
--draft \
--title "${tag}" \
--generate-notes \
"${tag}" \
ashuffle.x86_64-linux-gnu \
ashuffle.aarch64-linux-gnu \
ashuffle.armv7h-linux-gnueabihf \
ashuffle.armv6h-linux-gnueabihf