Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,107 @@ jobs:
run: cargo clippy --workspace --lib --all-features -- -D warnings
- name: Run clippy (no default features)
run: cargo clippy --workspace --lib --no-default-features -- -D warnings

# Feature combination testing for issue #47
feature-combinations:
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
features:
# === 基础组合 (Basic Combinations) ===
- "" # no-default-features (minimal build)
- "auth" # default features
- "auth,communication"
- "auth,docs"
- "auth,hr"
- "auth,workflow"
- "auth,meeting"
- "auth,ai"
- "auth,security"
- "auth,platform"
- "auth,application"
- "auth,mail"
- "auth,helpdesk"
- "auth,analytics"
- "auth,user"
- "auth,cardkit"

# === 文档细分组合 (Docs Sub-features) ===
- "auth,docs-base"
- "auth,docs-bitable"
- "auth,docs-drive"
- "auth,docs-full"

# === Webhook 组合 (Webhook Features) ===
- "webhook"
- "webhook-card"
- "webhook-signature"
- "webhook-full"

# === 推荐业务组合 (Recommended Business Combinations) ===
- "essential" # auth + communication + docs
- "enterprise" # essential + security + hr + workflow
- "communication,docs,auth"
- "communication,hr,auth"
- "docs,hr,auth"
- "hr,workflow,auth"
- "communication,docs,hr,auth"

# === 高价值组合 (High-Value Combinations) ===
- "auth,communication,webhook"
- "auth,docs,webhook-full"
- "auth,communication,cardkit"
- "essential,webhook-full"
- "enterprise,ai"
- "enterprise,meeting"

# === Edge Cases ===
- "full" # all enterprise features
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ env.CARGO_TOOLCHAIN }}
Comment on lines +140 to +143
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Request clippy component in feature-combination job

The new feature-combinations job runs cargo clippy but its toolchain setup only specifies toolchain and does not request clippy as a component. dtolnay/rust-toolchain installs with a minimal profile unless components are added, so this job can fail on runners that don’t already have cargo-clippy preinstalled (or when the preinstalled toolchain/cache changes), causing nondeterministic CI breakage. Add components: clippy in this job’s Rust toolchain step to make the lint step reliable.

Useful? React with 👍 / 👎.

components: clippy

- name: Cache Cargo build files
uses: Swatinem/rust-cache@v2

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: 23.4
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build with feature combination
run: |
echo "Testing feature combination: ${{ matrix.features }}"
if [ -z "${{ matrix.features }}" ]; then
echo "Building with no features (minimal build)"
timeout 20m cargo build --no-default-features
else
echo "Building with features: ${{ matrix.features }}"
timeout 20m cargo build --no-default-features --features "${{ matrix.features }}"
fi

- name: Test with feature combination
run: |
if [ -z "${{ matrix.features }}" ]; then
echo "Testing with no features"
timeout 15m cargo test --no-default-features --lib
else
echo "Testing with features: ${{ matrix.features }}"
timeout 15m cargo test --no-default-features --features "${{ matrix.features }}" --lib
fi

- name: Run clippy with feature combination
run: |
if [ -z "${{ matrix.features }}" ]; then
cargo clippy --no-default-features --lib -- -D warnings
else
cargo clippy --no-default-features --features "${{ matrix.features }}" --lib -- -D warnings
fi
25 changes: 25 additions & 0 deletions docs/FEATURE_MATRIX.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# OpenLark Feature Matrix

本文档描述 OpenLark 的 feature 组合测试策略和维护指南。

## 背景

OpenLark 采用模块化架构,提供 50+ 个 feature flags 支持按需编译。为确保跨模块组合在发布前后不会出现回归,我们将常用 feature 组合纳入 CI 自动化校验。

## 目标

- 覆盖 `no-default-features`、默认 features、常见业务组合和 `all-features`
- 为新增 feature 或 feature 重构提供回归保护
- 明确 feature 组合清单的维护策略

## 相关文件

- [ci.yml](../.github/workflows/ci.yml) - CI 配置,包含 feature 组合测试
- [feature-matrix.yml](../.github/workflows/feature-matrix.yml) - 高级 feature 矩阵测试
- [Cargo.toml](../Cargo.toml) - Feature 定义

## 参考

- Issue #47 - 添加 CI checks 用于常用 feature 组合
- [Cargo Features 文档](https://doc.rust-lang.org/cargo/reference/features.html)
- [cargo-hack 文档](https://github.com/taiki-e/cargo-hack)
Loading