-
Notifications
You must be signed in to change notification settings - Fork 0
220 lines (211 loc) · 7.28 KB
/
Copy pathci.yml
File metadata and controls
220 lines (211 loc) · 7.28 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
name: ci
# 依据 dev_docs/design-modules/13-testing-ci.md 的 9 阶段流水线。
# stage 1 lint / 2 unit / 3 contract 已落地;4 integ(并入 unit) / 5 raft / 6 sdk / 7 e2e / 8 bench / 9 release+SBOM。
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: protoc (apt, 避开 GitHub API 限流)
run: sudo apt-get update -qq && sudo apt-get install -y -qq protobuf-compiler
- name: fmt
working-directory: server
run: cargo fmt --all -- --check
- name: clippy
working-directory: server
run: cargo clippy --all-targets --all-features -- -D warnings
- name: deny
working-directory: server
run: cargo install cargo-deny --locked && cargo deny check
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: protoc (apt, 避开 GitHub API 限流)
run: sudo apt-get update -qq && sudo apt-get install -y -qq protobuf-compiler
- name: cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-${{ hashFiles('server/Cargo.lock') }}
- name: test
working-directory: server
run: cargo test --workspace
contract:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: protoc (apt, 避开 GitHub API 限流)
run: sudo apt-get update -qq && sudo apt-get install -y -qq protobuf-compiler
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: pyyaml
run: pip install pyyaml
- name: check contracts
run: ./scripts/check-contracts.sh
# stage 5: Raft 集群 + 快照持久化 + 转发契约(进程内集群测试)
raft:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: protoc (apt, 避开 GitHub API 限流)
run: sudo apt-get update -qq && sudo apt-get install -y -qq protobuf-compiler
- name: cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-${{ hashFiles('server/Cargo.lock') }}
- name: raft cluster tests
working-directory: server
run: cargo test -p dsh-raft --test cluster --test snapshot_persist --test forward_hint
# stage 6: 三语言 SDK 契约对拍(同一 dev-single 服务)
sdk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: protoc (apt, 避开 GitHub API 限流)
run: sudo apt-get update -qq && sudo apt-get install -y -qq protobuf-compiler
- uses: actions/setup-node@v4
with:
node-version: "22"
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-${{ hashFiles('server/Cargo.lock') }}
- name: build defing
working-directory: server
run: cargo build -p dsh-cli
- name: sdk contract test (HTTP/SSE)
env:
BIN: ${{ github.workspace }}/server/target/debug/defing
run: ./scripts/sdk-contract-test.sh
- name: sdk contract test (gRPC 数据面)
env:
BIN: ${{ github.workspace }}/server/target/debug/defing
run: ./scripts/sdk-grpc-contract-test.sh
# stage 7: 多进程 e2e(dev-single / 3 节点集群 / 混沌)
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: protoc (apt, 避开 GitHub API 限流)
run: sudo apt-get update -qq && sudo apt-get install -y -qq protobuf-compiler
- name: cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-${{ hashFiles('server/Cargo.lock') }}
- name: build defing
working-directory: server
run: cargo build -p dsh-cli
- name: dev-single demo
env:
BIN: ${{ github.workspace }}/server/target/debug/defing
run: ./scripts/dev-single-demo.sh
- name: cluster demo
env:
BIN: ${{ github.workspace }}/server/target/debug/defing
run: ./scripts/cluster-demo.sh
- name: seed cluster demo (--bootstrap-peers 静态成员表建群)
env:
BIN: ${{ github.workspace }}/server/target/debug/defing
run: ./scripts/seed-demo.sh
- name: chaos test
env:
BIN: ${{ github.workspace }}/server/target/debug/defing
run: ./scripts/chaos-test.sh
# 灰度发布 e2e(G1/G3/G5):三旋钮 + 数据面解析/watch + 指标/自动回滚
- name: g1 policy demo
env:
BIN: ${{ github.workspace }}/server/target/debug/defing
run: ./scripts/g1-policy-demo.sh
- name: gray demo
env:
BIN: ${{ github.workspace }}/server/target/debug/defing
run: ./scripts/gray-demo.sh
- name: gray observability demo
env:
BIN: ${{ github.workspace }}/server/target/debug/defing
run: ./scripts/gray-obs-demo.sh
# stage 8: 基准冒烟(结果归档,不 gate 合并)
bench:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: protoc (apt, 避开 GitHub API 限流)
run: sudo apt-get update -qq && sudo apt-get install -y -qq protobuf-compiler
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-${{ hashFiles('server/Cargo.lock') }}
- name: build defing
working-directory: server
run: cargo build -p dsh-cli
- name: benchmark smoke
env:
BIN: ${{ github.workspace }}/server/target/debug/defing
run: ./scripts/bench.sh 2>&1 | tee /tmp/dsh-bench.out
# stage 9: release 构建 + SBOM(A4)
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: protoc (apt, 避开 GitHub API 限流)
run: sudo apt-get update -qq && sudo apt-get install -y -qq protobuf-compiler
- name: cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-${{ hashFiles('server/Cargo.lock') }}
- name: release build
working-directory: server
run: cargo build --release -p dsh-cli
- name: sbom
uses: anchore/sbom-action@v0
with:
path: ./server
format: spdx-json
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-binary
path: server/target/release/defing