mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-05-29 04:10:00 +08:00
Default pull_request types are [opened, synchronize, reopened] which excludes ready_for_review. Draft PRs (e.g. those auto-generated by Cursor Background Agent) thus skipped CI when converted to ready, requiring close+reopen workarounds. Explicit types list now ensures CI runs on draft -> ready transitions too.
93 lines
2.4 KiB
YAML
93 lines
2.4 KiB
YAML
# ClawPanel 持续集成工作流
|
||
# 在推送到 main 分支或提交 PR 到 main 分支时自动运行
|
||
name: CI
|
||
|
||
on:
|
||
push:
|
||
branches: [main]
|
||
pull_request:
|
||
branches: [main]
|
||
# 默认 types 不含 ready_for_review,导致 draft → ready 转换不会触发 CI;显式列出确保所有人为状态变化都会跑 CI
|
||
types: [opened, synchronize, reopened, ready_for_review]
|
||
|
||
# 同一分支的新提交会取消正在运行的旧工作流
|
||
concurrency:
|
||
group: ${{ github.workflow }}-${{ github.ref }}
|
||
cancel-in-progress: true
|
||
|
||
jobs:
|
||
check:
|
||
name: 检查 (${{ matrix.platform.name }})
|
||
runs-on: ${{ matrix.platform.os }}
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
platform:
|
||
# macOS Apple Silicon
|
||
- name: macOS (ARM64)
|
||
os: macos-latest
|
||
# Linux x86_64
|
||
- name: Linux (x64)
|
||
os: ubuntu-latest
|
||
# Windows x86_64
|
||
- name: Windows (x64)
|
||
os: windows-latest
|
||
|
||
steps:
|
||
# 签出代码
|
||
- name: 签出代码
|
||
uses: actions/checkout@v4
|
||
|
||
# 安装 Node.js 22
|
||
- name: 安装 Node.js
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: 22
|
||
cache: npm
|
||
|
||
# 安装前端依赖
|
||
- name: 安装前端依赖
|
||
run: npm ci
|
||
|
||
# 安装 Rust 工具链 (stable)
|
||
- name: 安装 Rust 工具链
|
||
uses: dtolnay/rust-toolchain@stable
|
||
|
||
# Rust 编译缓存
|
||
- name: Rust 编译缓存
|
||
uses: swatinem/rust-cache@v2
|
||
with:
|
||
workspaces: src-tauri -> target
|
||
|
||
# Linux 专用: 安装 Tauri v2 系统依赖
|
||
- name: 安装 Linux 系统依赖
|
||
if: runner.os == 'Linux'
|
||
run: |
|
||
sudo apt-get update
|
||
sudo apt-get install -y \
|
||
libwebkit2gtk-4.1-dev \
|
||
librsvg2-dev \
|
||
patchelf \
|
||
libssl-dev \
|
||
libgtk-3-dev \
|
||
libayatana-appindicator3-dev
|
||
|
||
# Rust 格式检查
|
||
- name: Rust 格式检查
|
||
working-directory: src-tauri
|
||
run: cargo fmt --all -- --check
|
||
|
||
# Rust 编译检查
|
||
- name: Rust 编译检查
|
||
working-directory: src-tauri
|
||
run: cargo check
|
||
|
||
# Rust Lint(警告视为错误)
|
||
- name: Rust Clippy
|
||
working-directory: src-tauri
|
||
run: cargo clippy --all-targets -- -D warnings
|
||
|
||
# 前端构建验证
|
||
- name: 前端构建验证
|
||
run: npm run build
|