Skip to content

Commit 295886c

Browse files
committed
ci: 重构CI工作流并添加TypeScript支持
- 删除旧的rust.yml工作流文件 - 新增ci.yml工作流文件,包含完整的CI流程 - 添加对TypeScript项目的检查、构建和测试支持 - 支持多平台(ubuntu/macos/windows)构建矩阵 - 包含Rust和TypeScript的格式检查、lint和类型检查
1 parent 4b5586b commit 295886c

File tree

2 files changed

+90
-23
lines changed

2 files changed

+90
-23
lines changed

.github/workflows/ci.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, dev ]
6+
pull_request:
7+
branches: [ master, dev ]
8+
9+
jobs:
10+
# 1. 检查阶段:Lint, Format, Typecheck
11+
check:
12+
name: Check (Rust & TS)
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
# Setup Rust
18+
- name: Install Rust
19+
uses: dtolnay/rust-toolchain@stable
20+
with:
21+
components: rustfmt, clippy
22+
23+
# Setup Node/pnpm
24+
- uses: pnpm/action-setup@v4
25+
with:
26+
version: 10
27+
- uses: actions/setup-node@v4
28+
with:
29+
node-version: 20
30+
cache: 'pnpm'
31+
32+
# Install Dependencies
33+
- name: Install TS Dependencies
34+
run: pnpm install
35+
36+
# Rust Checks
37+
- name: Rust Format Check
38+
run: cargo fmt --all -- --check
39+
- name: Rust Clippy
40+
run: cargo clippy --all-targets --all-features -- -D warnings
41+
42+
# TS Checks
43+
- name: TS Biome Check
44+
run: pnpm biome check .
45+
- name: TS Typecheck
46+
run: pnpm typecheck
47+
48+
# 2. 构建与测试阶段:Build & Test (Matrix OS)
49+
build-test:
50+
name: Build & Test
51+
needs: check
52+
runs-on: ${{ matrix.os }}
53+
strategy:
54+
matrix:
55+
os: [ubuntu-latest, macos-latest, windows-latest]
56+
steps:
57+
- uses: actions/checkout@v4
58+
59+
# Setup Rust
60+
- name: Install Rust
61+
uses: dtolnay/rust-toolchain@stable
62+
with:
63+
targets: wasm32-wasip1
64+
65+
# Setup Node/pnpm
66+
- uses: pnpm/action-setup@v4
67+
with:
68+
version: 10
69+
- uses: actions/setup-node@v4
70+
with:
71+
node-version: 20
72+
cache: 'pnpm'
73+
74+
# Install Dependencies
75+
- name: Install TS Dependencies
76+
run: pnpm install
77+
78+
# Rust Build & Test (包括 WASM)
79+
- name: Rust Build
80+
run: cargo build --verbose
81+
- name: Rust Test
82+
run: cargo test --verbose
83+
- name: Build WASM Target
84+
run: cargo build -p hxo-target-wasm --target wasm32-wasip2 --release
85+
86+
# TS Build & Test (直接使用同环境构建出的 WASM)
87+
- name: TS Build
88+
run: pnpm build
89+
- name: TS Test
90+
run: pnpm test

.github/workflows/rust.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)