-
Notifications
You must be signed in to change notification settings - Fork 0
563 lines (487 loc) · 17.3 KB
/
test.yml
File metadata and controls
563 lines (487 loc) · 17.3 KB
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
test:
name: Unit Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Build
run: go build -v ./...
- name: Run tests with coverage
run: |
PACKAGES=$(go list ./... | grep -v internal/gui | grep -v /cmd/)
COVERPKG=$(go list ./... | grep -v testutil | grep -v /e2e | grep -v internal/gui | grep -v /cmd/ | tr '\n' ',')
go test -v -race -coverprofile=coverage.txt -covermode=atomic -coverpkg=$COVERPKG $PACKAGES
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.txt
flags: unittests
name: codecov-suve-unit
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
continue-on-error: true
gui-go-test:
name: GUI Go Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Install Wails dependencies (CGO)
run: |
for i in {1..5}; do sudo apt-get update && break || sleep $((i * 5)); done
for i in {1..5}; do sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev build-essential pkg-config && break || sleep $((i * 5)); done
- name: Create dummy frontend dist
run: mkdir -p internal/gui/frontend/dist && touch internal/gui/frontend/dist/index.html
- name: Run GUI Go tests
run: |
CGO_ENABLED=1 go test -v -race -tags=production,webkit2_41 ./internal/gui/...
e2e:
name: E2E Test
runs-on: ubuntu-latest
services:
localstack:
image: localstack/localstack:4
ports:
- 4566:4566
env:
SERVICES: ssm,secretsmanager,events
DEBUG: 0
options: >-
--health-cmd "curl -f http://localhost:4566/_localstack/health"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Wait for localstack
run: |
timeout 60 bash -c 'until curl -sf http://localhost:4566/_localstack/health; do sleep 2; done'
- name: Run e2e tests with coverage
run: |
COVERPKG=$(go list ./... | grep -v testutil | grep -v /e2e | grep -v internal/gui | grep -v /cmd/ | tr '\n' ',')
go test -v -race -tags e2e -coverprofile=coverage-e2e.txt -covermode=atomic -coverpkg=$COVERPKG ./e2e/...
env:
SUVE_LOCALSTACK_EXTERNAL_PORT: 4566
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage-e2e.txt
flags: e2e
name: codecov-suve-e2e
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
continue-on-error: true
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.24'
- name: Run golangci-lint (default build)
uses: golangci/golangci-lint-action@v9
with:
args: --timeout=5m
- name: Create dummy frontend dist for production lint
run: mkdir -p internal/gui/frontend/dist && touch internal/gui/frontend/dist/index.html
- name: Install Wails dependencies (CGO)
run: |
for i in {1..5}; do sudo apt-get update && break || sleep $((i * 5)); done
for i in {1..5}; do sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev build-essential pkg-config && break || sleep $((i * 5)); done
- name: Run golangci-lint (production build)
uses: golangci/golangci-lint-action@v9
with:
args: --timeout=5m --build-tags=production,webkit2_41
- name: Run goroutinectx
run: go run github.com/mpyw/goroutinectx/cmd/goroutinectx@v0.7.5 ./...
frontend-lint:
name: Frontend Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: internal/gui/frontend
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: internal/gui/frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Run Biome and svelte-check
run: npm run ci
gui-test:
name: GUI Test (Playwright)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
defaults:
run:
working-directory: internal/gui/frontend
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: internal/gui/frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Run Playwright tests
run: npm test
- name: Upload Playwright report
uses: actions/upload-artifact@v6
if: ${{ !cancelled() }}
with:
name: playwright-report-${{ matrix.os }}
path: internal/gui/frontend/playwright-report/
retention-days: 30
linux-cli-package:
name: Linux CLI Package Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Build CLI binary
run: |
CGO_ENABLED=0 go build -o suve-cli ./cmd/suve
file suve-cli
- name: Verify binary runs correctly
run: |
./suve-cli --help
./suve-cli --version
- name: Install nfpm
run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.41.1
- name: Install lintian and rpmlint
run: |
for i in {1..5}; do sudo apt-get update && break || sleep $((i * 5)); done
for i in {1..5}; do sudo apt-get install -y lintian rpm rpmlint && break || sleep $((i * 5)); done
- name: Generate CLI packages
env:
VERSION: "0.0.0-test"
GOARCH: amd64
run: |
nfpm pkg --config .github/templates/nfpm.yaml --packager deb --target "suve-cli_test_amd64.deb"
nfpm pkg --config .github/templates/nfpm.yaml --packager rpm --target "suve-cli-test.x86_64.rpm"
ls -la *.deb *.rpm
- name: Lint CLI packages
run: |
lintian --tag-display-limit 0 \
--suppress-tags no-changelog,no-manual-page,unknown-field,hardening-no-pie,hardening-no-relro,unstripped-binary-or-object,undeclared-elf-prerequisites,extended-description-contains-empty-paragraph,statically-linked-binary \
"suve-cli_test_amd64.deb"
- name: Test .deb installation
run: |
sudo dpkg -i "suve-cli_test_amd64.deb"
command -v suve
suve --version
suve --help
sudo dpkg -r suve-cli
- name: Test .rpm installation (Fedora container)
run: |
docker run --rm -v "$PWD:/work" -w /work fedora:latest bash -c '
set -e
dnf install -y "./suve-cli-test.x86_64.rpm"
command -v suve
suve --version
suve --help
'
linux-gui-package:
name: Linux GUI Package Test (${{ matrix.arch }}, webkit2gtk-${{ matrix.webkit }})
runs-on: ubuntu-${{ matrix.ubuntu }}${{ matrix.arch == 'arm64' && '-arm' || '' }}
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
webkit: ["4.0", "4.1"]
include:
- arch: amd64
deb_arch: amd64
rpm_arch: x86_64
- arch: arm64
deb_arch: arm64
rpm_arch: aarch64
- webkit: "4.0"
ubuntu: "22.04"
fedora: "39"
webkit_deb: libwebkit2gtk-4.0-37
webkit_rpm: webkit2gtk4.0
pkg_suffix: ""
- webkit: "4.1"
ubuntu: "24.04"
fedora: "latest"
webkit_deb: libwebkit2gtk-4.1-0
webkit_rpm: webkit2gtk4.1
pkg_suffix: "_webkit2_41"
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Install build dependencies
run: |
for i in {1..5}; do sudo apt-get update && break || sleep $((i * 5)); done
for i in {1..5}; do sudo apt-get install -y libgtk-3-dev libwebkit2gtk-${{ matrix.webkit }}-dev && break || sleep $((i * 5)); done
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: internal/gui/frontend/package-lock.json
- name: Build frontend
run: |
cd internal/gui/frontend
npm ci
npm run build
- name: Build GUI binary
run: |
TAGS="production"
if [[ "${{ matrix.webkit }}" == "4.1" ]]; then
TAGS="production,webkit2_41"
fi
CGO_ENABLED=1 go build -tags "$TAGS" -o suve ./cmd/suve
file suve
- name: Verify binary runs correctly
run: |
./suve --help | grep -q '\-\-gui' && echo "GUI flag found" || { echo "ERROR: --gui flag missing!"; exit 1; }
./suve --version
- name: Install nfpm
run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.41.1
- name: Install lintian and rpmlint
run: for i in {1..5}; do sudo apt-get install -y lintian rpm rpmlint && break || sleep $((i * 5)); done
- name: Generate GUI packages
env:
VERSION: "0.0.0-test"
GOARCH: ${{ matrix.arch }}
GTK_DEB: "libgtk-3-0"
GTK_RPM: "gtk3"
WEBKIT_DEB: ${{ matrix.webkit_deb }}
WEBKIT_RPM: ${{ matrix.webkit_rpm }}
run: |
nfpm pkg --config .github/templates/nfpm-gui.yaml --packager deb --target "suve${{ matrix.pkg_suffix }}_test_${{ matrix.deb_arch }}.deb"
nfpm pkg --config .github/templates/nfpm-gui.yaml --packager rpm --target "suve${{ matrix.pkg_suffix }}-test.${{ matrix.rpm_arch }}.rpm"
ls -la *.deb *.rpm
- name: Lint GUI packages
run: |
echo "=== lintian check (.deb) ==="
lintian --tag-display-limit 0 \
--suppress-tags no-changelog,no-manual-page,unknown-field,hardening-no-pie,hardening-no-relro,unstripped-binary-or-object,undeclared-elf-prerequisites,extended-description-contains-empty-paragraph \
"suve${{ matrix.pkg_suffix }}_test_${{ matrix.deb_arch }}.deb"
echo "=== rpmlint check (.rpm) ==="
rpmlint "suve${{ matrix.pkg_suffix }}-test.${{ matrix.rpm_arch }}.rpm" || true
- name: Test .deb installation
run: |
for i in {1..5}; do sudo apt-get update && break || sleep $((i * 5)); done
for i in {1..5}; do sudo apt-get install -y libgtk-3-0 ${{ matrix.webkit_deb }} && break || sleep $((i * 5)); done
sudo dpkg -i "suve${{ matrix.pkg_suffix }}_test_${{ matrix.deb_arch }}.deb"
command -v suve
suve --version
suve --help
sudo dpkg -r suve
- name: Test .rpm installation (Fedora container)
run: |
docker run --rm -v "$PWD:/work" -w /work fedora:${{ matrix.fedora }} bash -c '
set -e
dnf install -y "./suve${{ matrix.pkg_suffix }}-test.${{ matrix.rpm_arch }}.rpm"
command -v suve
suve --version
suve --help
'
gui-test-windows:
name: GUI Test (Playwright) (Windows)
runs-on: windows-latest
if: >-
github.ref == 'refs/heads/main' ||
contains(github.event.head_commit.message, '[CI: windows]')
defaults:
run:
working-directory: internal/gui/frontend
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: internal/gui/frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Run Playwright tests
run: npm test
- name: Upload Playwright report
uses: actions/upload-artifact@v6
if: ${{ !cancelled() }}
with:
name: playwright-report-windows-latest
path: internal/gui/frontend/playwright-report/
retention-days: 30
platform-test:
name: Platform Test (${{ matrix.os }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- os: linux
runner: ubuntu-latest
- os: darwin
runner: macos-latest
- os: windows
runner: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Find platform-specific packages
id: packages
shell: bash
run: |
# Find packages with platform-specific build tags (excluding gui and test files)
PACKAGES=$(grep -rl "//go:build" --include="*.go" . \
| grep -v "_test.go" \
| grep -v "/gui/" \
| grep -v "vendor" \
| xargs -I{} dirname {} \
| sort -u \
| sed 's|^\./|./|' \
| tr '\n' ' ')
echo "packages=$PACKAGES"
echo "packages=$PACKAGES" >> "$GITHUB_OUTPUT"
- name: Run platform-specific tests with coverage
shell: bash
run: |
COVERPKG=""
for pkg in ${{ steps.packages.outputs.packages }}; do
if [ -n "$COVERPKG" ]; then
COVERPKG="$COVERPKG,"
fi
COVERPKG="$COVERPKG$pkg/..."
done
echo "Coverage packages: $COVERPKG"
go test -v -race -coverprofile=coverage-platform-${{ matrix.os }}.txt -covermode=atomic -coverpkg="$COVERPKG" ${{ steps.packages.outputs.packages }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage-platform-${{ matrix.os }}.txt
flags: platform-${{ matrix.os }}
name: codecov-suve-platform-${{ matrix.os }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
continue-on-error: true
platform-lint:
name: Platform Lint (${{ matrix.os }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- os: linux
runner: ubuntu-latest
- os: darwin
runner: macos-latest
# Note: Windows excluded due to gci formatter false positives.
# Main Lint job (Linux) covers all essential checks.
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.24'
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
args: --timeout=5m
platform-build:
name: Platform Build (${{ matrix.goos }}/${{ matrix.goarch }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: freebsd
goarch: amd64
- goos: freebsd
goarch: arm64
- goos: openbsd
goarch: amd64
- goos: netbsd
goarch: amd64
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Find platform-specific packages
id: packages
run: |
# Find packages with platform-specific build tags (excluding gui and test files)
PACKAGES=$(grep -rl "//go:build" --include="*.go" . \
| grep -v "_test.go" \
| grep -v "/gui/" \
| grep -v "vendor" \
| xargs -I{} dirname {} \
| sort -u \
| sed 's|^\./|./|' \
| tr '\n' ' ')
echo "packages=$PACKAGES"
echo "packages=$PACKAGES" >> "$GITHUB_OUTPUT"
- name: Build for ${{ matrix.goos }}/${{ matrix.goarch }}
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: |
echo "Building for $GOOS/$GOARCH..."
for pkg in ${{ steps.packages.outputs.packages }}; do
echo "Building $pkg..."
go build -v "$pkg/..."
done
echo "Build successful for $GOOS/$GOARCH"