Repository navigation
75 lines (69 loc) · 2.23 KB
/
Copy pathci.yml
File metadata and controls
75 lines (69 loc) · 2.23 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
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
workflow_call:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CGO_ENABLED: '0'
jobs:
checks:
name: Source and build checks
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- uses: actions/setup-node@v6
with:
node-version: '22'
- name: Validate workflows
run: go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.7 -color
- name: Check Go dependencies and code
run: |
go mod verify
go vet ./...
- name: Check JavaScript syntax
shell: bash
run: |
shopt -s globstar nullglob
for file in src/web/*.js internal/server/**/*.cjs scripts/*.cjs; do
node --check "$file"
done
- name: Build executable
run: go build -trimpath -ldflags "-X main.version=ci" -o bin/zcode2api .
- name: Run integration tests without a browser
env:
ZCODE2API_TEST_BINARY: ${{ github.workspace }}/bin/zcode2api
run: go test -v -count=1 -timeout=5m ./test
scheduled-claim:
name: Scheduled claim with Chromium
# Playwright 1.58.2 provides a headless shell for Ubuntu 24.04 x64.
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- uses: actions/setup-node@v6
with:
node-version: '22'
- name: Install headless Chromium for scheduled claims
run: |
npm install --prefix "$RUNNER_TEMP/claim-browser" --ignore-scripts --no-audit --no-fund playwright-core@1.58.2
"$RUNNER_TEMP/claim-browser/node_modules/.bin/playwright-core" install --with-deps --only-shell chromium
- name: Test scheduled daily card claim
env:
NODE_PATH: ${{ runner.temp }}/claim-browser/node_modules
run: go test -v -tags=browser -run '^TestScheduledDailyCardClaim$' -count=1 -timeout=5m ./test