Skip to content

Commit fe44ff1

Browse files
committed
ci: add dependency hygiene workflow
1 parent c58d314 commit fe44ff1

3 files changed

Lines changed: 94 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
env:
14+
GOWORK: off
15+
GO_TEST_PACKAGES: ./internal/device ./internal/mbim ./internal/qmi ./internal/backend ./internal/esim ./internal/cscall ./internal/proxy/traffic ./internal/notify ./internal/qqbot/...
16+
17+
jobs:
18+
go:
19+
name: Go, Web Assets, And Dependency Hygiene
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 30
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Go
28+
uses: actions/setup-go@v5
29+
with:
30+
go-version-file: go.mod
31+
cache: true
32+
cache-dependency-path: |
33+
go.mod
34+
go.sum
35+
36+
- name: Set up Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: '20'
40+
cache: 'npm'
41+
cache-dependency-path: web/package-lock.json
42+
43+
- name: Verify dependency hygiene
44+
shell: bash
45+
run: |
46+
set -euo pipefail
47+
48+
test ! -f go.work
49+
50+
forbidden_refs="$(
51+
{
52+
git grep -nE 'github[.]com/iniwex5|github[.]com/boa-z/qqbot|vohive[-]release|GO[.]?PRIVATE|GO[.]?NOSUMDB|GH[_]PAT' -- \
53+
go.mod go.sum .github Dockerfile Dockerfile.github docker-compose.yml Makefile internal cmd pkg web/src \
54+
':!internal/web/dist/**' ':!web/dist/**' || true
55+
git grep -nE 'replace[[:space:]].*=>[[:space:]]*(\.{1,2}/|/|~)' -- \
56+
go.mod go.sum .github Dockerfile Dockerfile.github docker-compose.yml Makefile internal cmd pkg web/src \
57+
':!internal/web/dist/**' ':!web/dist/**' || true
58+
} | sed '/^$/d'
59+
)"
60+
61+
if [[ -n "${forbidden_refs}" ]]; then
62+
printf 'forbidden dependency or local-path references found:\n%s\n' "${forbidden_refs}" >&2
63+
exit 1
64+
fi
65+
66+
if go list -m all | grep -E 'github[.]com/iniwex5|github[.]com/boa-z/qqbot'; then
67+
printf 'forbidden modules resolved by go list -m all\n' >&2
68+
exit 1
69+
fi
70+
71+
- name: Build frontend assets
72+
shell: bash
73+
run: |
74+
npm ci --prefix web
75+
npm run build --prefix web
76+
rm -rf internal/web/dist
77+
mkdir -p internal/web
78+
cp -R web/dist internal/web/dist
79+
80+
- name: Check go.mod tidiness
81+
run: go mod tidy -diff
82+
83+
- name: Run Go tests
84+
shell: bash
85+
run: |
86+
read -r -a packages <<< "${GO_TEST_PACKAGES}"
87+
go test "${packages[@]}"
88+
89+
- name: Build VoHive binary
90+
run: |
91+
CGO_ENABLED=0 GOOS=linux go build -trimpath -buildvcs=false -tags "with_utls nomsgpack" -o /tmp/vohive ./cmd/vohive

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.26.3
44

55
require (
66
github.com/boa-z/quectel-qmi-go v0.0.0-20260707165359-f491bb1251c4
7-
github.com/boa-z/vowifi-go v0.0.0-20260707165519-8211ef707365
7+
github.com/boa-z/vowifi-go v0.0.0-20260707171538-74d27d344bbf
88
github.com/damonto/euicc-go v1.1.3-0.20260628013808-8d873a2dfc98
99
github.com/emiago/sipgo v1.4.0
1010
github.com/gin-gonic/gin v1.11.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ aead.dev/minisign v0.2.0 h1:kAWrq/hBRu4AARY6AlciO83xhNnW9UaC8YipS2uhLPk=
22
aead.dev/minisign v0.2.0/go.mod h1:zdq6LdSd9TbuSxchxwhpA9zEb9YXcVGoE8JakuiGaIQ=
33
github.com/boa-z/quectel-qmi-go v0.0.0-20260707165359-f491bb1251c4 h1:BhHt8zmw+hl9jBKEQU/7TjZkFfy0T9jOCWzsr9KefoY=
44
github.com/boa-z/quectel-qmi-go v0.0.0-20260707165359-f491bb1251c4/go.mod h1:uUTxDgqoRDy4Wt4FACPzoG1AKUWU+7sdk+Jg2MYjpMA=
5-
github.com/boa-z/vowifi-go v0.0.0-20260707165519-8211ef707365 h1:y5AE0nq8+3JdouRwN8xefA0TQeBBReeEhUkqjezezbI=
6-
github.com/boa-z/vowifi-go v0.0.0-20260707165519-8211ef707365/go.mod h1:idvGWFg/NN3Pc0qjvMWMdbxeMEbRTBFXsTT+WiPyyDA=
5+
github.com/boa-z/vowifi-go v0.0.0-20260707171538-74d27d344bbf h1:ytV67OLs8996lyxubktuHcRFvqAlXFTPP3qbCSX9l14=
6+
github.com/boa-z/vowifi-go v0.0.0-20260707171538-74d27d344bbf/go.mod h1:idvGWFg/NN3Pc0qjvMWMdbxeMEbRTBFXsTT+WiPyyDA=
77
github.com/bytedance/sonic v1.14.0 h1:/OfKt8HFw0kh2rj8N0F6C/qPGRESq0BbaNZgcNXXzQQ=
88
github.com/bytedance/sonic v1.14.0/go.mod h1:WoEbx8WTcFJfzCe0hbmyTGrfjt8PzNEBdxlNUO24NhA=
99
github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA=

0 commit comments

Comments
 (0)