Skip to content

Commit eea3764

Browse files
committed
feat: Update workflow files and README for improved clarity and consistency; refactor code formatting and enhance documentation
1 parent b24e922 commit eea3764

File tree

14 files changed

+251
-166
lines changed

14 files changed

+251
-166
lines changed

.github/workflows/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
## 工作流文件
66

77
### 1. `simple-test.yml` - 基础测试工作流
8+
89
**推荐使用** - 简洁、可靠的测试工作流
910

1011
- **触发条件**: 推送到 `main`/`develop` 分支,PR 到 `main` 分支
11-
- **测试矩阵**:
12+
- **测试矩阵**:
1213
- Deno 版本: `2.4.x`, `2.x` (最新)
1314
- 操作系统: Ubuntu, macOS, Windows
1415
- **功能**:
@@ -20,9 +21,10 @@
2021
- ✅ 安全检查(依赖分析)
2122

2223
### 2. `deno-test.yml` - 完整测试工作流
24+
2325
高级功能的完整测试套件
2426

25-
- **触发条件**:
27+
- **触发条件**:
2628
- 推送到任何分支
2729
- PR 到 `main`/`develop` 分支
2830
- 手动触发(支持选择测试类型)
@@ -35,28 +37,35 @@
3537
- 🚀 并发控制
3638

3739
### 3. `test.yml` - 传统测试工作流
40+
3841
包含基准测试和多任务的扩展版本
3942

4043
## 推荐配置
4144

4245
### 主要工作流
46+
4347
建议使用 **`simple-test.yml`** 作为主要的 CI/CD 工作流,因为它:
48+
4449
- 快速执行(通常 < 5 分钟)
4550
- 覆盖所有必要的检查
4651
- 在多个平台上测试
4752
- 使用最新的 Deno 版本
4853

4954
### 高级需求
55+
5056
如果需要更详细的测试和报告,可以使用 **`deno-test.yml`**
5157

5258
## Deno 设置详情
5359

5460
### 版本策略
61+
5562
- **`2.x`**: 使用 Deno 2.x 系列的最新版本
5663
- **`2.4.x`**: 使用 Deno 2.4.x 系列的最新补丁版本
5764

5865
### 依赖缓存
66+
5967
工作流使用 GitHub Actions 缓存来加速构建:
68+
6069
```yaml
6170
- name: Cache Dependencies
6271
uses: actions/cache@v4
@@ -66,7 +75,9 @@
6675
```
6776
6877
### 权限设置
78+
6979
测试只需要最小权限:
80+
7081
- `--allow-env`: 用于环境变量测试
7182
- `--allow-read`: 用于读取测试文件
7283

@@ -132,13 +143,17 @@ deno coverage coverage --lcov --output=coverage.lcov
132143
## 维护
133144

134145
### 更新 Deno 版本
146+
135147
定期更新工作流中的 Deno 版本:
148+
136149
1. 检查 [Deno 发布页面](https://github.com/denoland/deno/releases)
137150
2. 更新 `deno-version` 在工作流文件中
138151
3. 测试新版本的兼容性
139152

140153
### Actions 版本更新
154+
141155
定期更新 GitHub Actions 版本:
156+
142157
- `actions/checkout@v4` → 检查最新版本
143158
- `denoland/setup-deno@v2` → 检查最新版本
144159
- `actions/cache@v4` → 检查最新版本

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [main, develop]
66
paths:
7-
- 'packages/core/**'
8-
- '.github/workflows/**'
7+
- "packages/core/**"
8+
- ".github/workflows/**"
99
pull_request:
10-
branches: [ main ]
10+
branches: [main]
1111
paths:
12-
- 'packages/core/**'
13-
- '.github/workflows/**'
12+
- "packages/core/**"
13+
- ".github/workflows/**"
1414

1515
jobs:
1616
test:
@@ -20,7 +20,7 @@ jobs:
2020

2121
strategy:
2222
matrix:
23-
deno-version: ['2.4.x', '2.x']
23+
deno-version: ["2.4.x", "2.x"]
2424
os: [ubuntu-latest, macos-latest, windows-latest]
2525
fail-fast: false
2626

.github/workflows/deno-test.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ name: Deno Core Tests
22

33
on:
44
push:
5-
branches: [ main, develop, feature/* ]
5+
branches: [main, develop, feature/*]
66
paths:
7-
- 'packages/core/**'
8-
- '.github/workflows/deno-test.yml'
7+
- "packages/core/**"
8+
- ".github/workflows/deno-test.yml"
99
pull_request:
10-
branches: [ main, develop ]
10+
branches: [main, develop]
1111
paths:
12-
- 'packages/core/**'
13-
- '.github/workflows/deno-test.yml'
12+
- "packages/core/**"
13+
- ".github/workflows/deno-test.yml"
1414
workflow_dispatch:
1515
inputs:
1616
test_type:
17-
description: 'Type of test to run'
17+
description: "Type of test to run"
1818
required: true
19-
default: 'all'
19+
default: "all"
2020
type: choice
2121
options:
2222
- all
@@ -42,7 +42,7 @@ jobs:
4242
strategy:
4343
matrix:
4444
os: [ubuntu-latest, windows-latest, macos-latest]
45-
deno-version: ['2.4.x', '2.x']
45+
deno-version: ["2.4.x", "2.x"]
4646
fail-fast: false
4747

4848
steps:
@@ -195,7 +195,7 @@ jobs:
195195
run: |
196196
echo "Checking test execution time..."
197197
time deno task test
198-
198+
199199
echo "Running individual test timing..."
200200
for test_file in tests/*.ts; do
201201
if [[ "$test_file" != "tests/run_tests.ts" ]]; then
@@ -223,7 +223,7 @@ jobs:
223223
run: |
224224
echo "Checking dependency tree..."
225225
deno info mod.ts
226-
226+
227227
echo "Checking for insecure HTTP imports..."
228228
if grep -r "http://" . --include="*.ts" --include="*.js"; then
229229
echo "⚠️ Found HTTP imports (should use HTTPS)"
@@ -263,7 +263,7 @@ jobs:
263263
run: |
264264
echo "Checking JSR publishing readiness..."
265265
deno publish --dry-run --allow-dirty || echo "Package would fail to publish to JSR"
266-
266+
267267
echo "Validating deno.json..."
268268
deno task server:compile || echo "Server compilation task failed"
269269

.github/workflows/simple-test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: MCPC Core - Deno Tests
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [main, develop]
66
paths:
7-
- 'packages/core/**'
8-
- '.github/workflows/**'
7+
- "packages/core/**"
8+
- ".github/workflows/**"
99
pull_request:
10-
branches: [ main ]
10+
branches: [main]
1111
paths:
12-
- 'packages/core/**'
13-
- '.github/workflows/**'
12+
- "packages/core/**"
13+
- ".github/workflows/**"
1414

1515
jobs:
1616
test:
@@ -20,7 +20,7 @@ jobs:
2020

2121
strategy:
2222
matrix:
23-
deno-version: ['2.4.x', '2.x']
23+
deno-version: ["2.4.x", "2.x"]
2424
os: [ubuntu-latest, macos-latest, windows-latest]
2525
fail-fast: false
2626

.github/workflows/test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: MCPC Core Tests
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [main, develop]
66
paths:
7-
- 'packages/core/**'
8-
- '.github/workflows/test.yml'
7+
- "packages/core/**"
8+
- ".github/workflows/test.yml"
99
pull_request:
10-
branches: [ main, develop ]
10+
branches: [main, develop]
1111
paths:
12-
- 'packages/core/**'
13-
- '.github/workflows/test.yml'
12+
- "packages/core/**"
13+
- ".github/workflows/test.yml"
1414

1515
env:
1616
DENO_DIR: ~/.cache/deno
@@ -87,7 +87,7 @@ jobs:
8787
strategy:
8888
matrix:
8989
os: [ubuntu-latest, windows-latest, macos-latest]
90-
deno-version: ['v2.0', 'v2.1', 'v2.2', 'v2.3', 'v2.4']
90+
deno-version: ["v2.0", "v2.1", "v2.2", "v2.3", "v2.4"]
9191
fail-fast: false
9292

9393
steps:

0 commit comments

Comments
 (0)