-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (80 loc) · 2.64 KB
/
Copy pathtest.yaml
File metadata and controls
86 lines (80 loc) · 2.64 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
name: test
on:
push:
branches: [main, "release/**"]
pull_request:
# 供 release 工作流复用:打 tag 发布前跑同一套门禁,避免两边规则漂移。
workflow_call:
workflow_dispatch:
permissions:
contents: read
concurrency:
# PR 上新提交会取消上一次运行;main / release 分支保留每次运行。
group: test-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
lint:
name: lint
runs-on: ubuntu-latest
env:
# 与本地开发保持同一版本,避免"本地过 CI 挂"。升级时同步改 docs/development.md。
GOLANGCI_LINT_VERSION: v2.12.2
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- uses: golangci/golangci-lint-action@v9
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
test:
name: test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- run: go build ./...
- run: go vet ./...
- run: go test -race ./...
protocol-schema:
name: protocol schema and ScriptCat mirror
runs-on: ubuntu-latest
env:
SCRIPTCAT_REF: e32bb5a43d3061aa1d380f62328bd249fdf55ac8
steps:
- uses: actions/checkout@v5
with:
path: sctl
- uses: actions/checkout@v5
with:
repository: scriptscat/scriptcat
ref: ${{ env.SCRIPTCAT_REF }}
path: scriptcat
- uses: actions/setup-go@v6
with:
go-version-file: sctl/go.mod
cache-dependency-path: sctl/go.sum
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Check generated artifacts and exact paired mirror
working-directory: sctl
run: |
make protocol-check
mkdir -p ../formatted
cp internal/pkg/protocol/generated/*.ts ../formatted/
npx --yes prettier@3.6.2 --config ../scriptcat/.prettierrc --write ../formatted/*.ts
cmp ../formatted/protocol.generated.ts ../scriptcat/src/app/service/service_worker/external_access/generated/protocol.generated.ts
cmp ../formatted/validators.generated.ts ../scriptcat/src/app/service/service_worker/external_access/generated/validators.generated.ts
{
echo "ScriptCat ref: $SCRIPTCAT_REF"
sha256sum ../formatted/*.ts
} >> "$GITHUB_STEP_SUMMARY"