mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 02:31:13 +08:00
68 lines
2.0 KiB
YAML
68 lines
2.0 KiB
YAML
name: CI
|
||
|
||
on:
|
||
push:
|
||
branches: [main]
|
||
pull_request:
|
||
branches: [main]
|
||
|
||
env:
|
||
CARGO_TERM_COLOR: always
|
||
|
||
# job 拓扑:fmt / clippy / build 三者并行独立;test 依赖 build(needs),在
|
||
# build 编译完成后启动,复用 build 的产物(经共享 rust-cache 传递 target/),
|
||
# 只补编 test harness、不重编整个 workspace。各 job 单独状态,一个挂了不阻塞
|
||
# 无关者,GitHub 界面一眼看出哪个红。clippy 走 check 模式、产物与 build 不同,
|
||
# 无法复用 build 产物,故保持独立并行。
|
||
#
|
||
# sccache 与 mold:.cargo/config.toml 全局引用(rustc-wrapper 与 -fuse-ld=mold),
|
||
# 凡跑 rustc 的 job(clippy/build/test)必须先装,否则构建直接失败。fmt 只跑
|
||
# rustfmt、不跑 rustc,无需安装。
|
||
jobs:
|
||
fmt:
|
||
name: Format
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- uses: dtolnay/rust-toolchain@stable
|
||
with:
|
||
components: rustfmt
|
||
- name: Check formatting
|
||
run: cargo fmt --all -- --check
|
||
|
||
clippy:
|
||
name: Clippy
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
with:
|
||
submodules: true
|
||
- uses: dtolnay/rust-toolchain@stable
|
||
with:
|
||
components: clippy
|
||
- uses: Swatinem/rust-cache@v2
|
||
- uses: ./.github/actions/setup-tools
|
||
- name: Clippy
|
||
run: cargo clippy --all-targets -- -D warnings
|
||
|
||
build:
|
||
name: Build
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
with:
|
||
submodules: true
|
||
- uses: dtolnay/rust-toolchain@stable
|
||
- uses: Swatinem/rust-cache@v2
|
||
- uses: ./.github/actions/setup-tools
|
||
- name: Build
|
||
run: cargo build --verbose
|
||
|
||
# test 是单一 job:经 workflow_call 调用 ci-test.yml,外观上主 CI 只有一个 test
|
||
# (全过才绿),点进去才见内部 matrix(os × group)并行图。needs build 复用产物。
|
||
test:
|
||
name: Test
|
||
needs: [build]
|
||
uses: ./.github/workflows/ci-test.yml
|
||
secrets: inherit
|