Repository navigation
统一语言检查入口与原生修复任务,完善 WASM 验收 #140
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: codeguard | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| gate: | |
| # ubuntu-latest 预装稳定版 Rust;Cargo.toml 声明 rust-version = 1.85 / edition = 2024。 | |
| runs-on: ubuntu-latest | |
| env: | |
| # Linux 完整 DWARF 测试制品会超出 SDK 的 256 MiB 宿主制品读取预算。 | |
| # 仅去掉测试调试符号;保留 debug assertions 和产品读取上限。 | |
| CARGO_PROFILE_TEST_DEBUG: "0" | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Check out corpus evidence source | |
| # 固定语料按 sha256 校验来自插件仓的真实文件(provenance.source_ref = | |
| # codeguard-plugin@9e4adb1),因此必须把该 commit 检出到兄弟目录; | |
| # 只建空目录不够,会因摘要不匹配而失败。 | |
| run: | | |
| git clone --quiet https://github.com/full-stack-plugins/codeguard-plugin.git ../codeguard-plugin | |
| git -C ../codeguard-plugin checkout --quiet 9e4adb1 | |
| - name: Verify crate layering debt does not grow | |
| run: python3 scripts/check_layering.py | |
| - name: Build workspace | |
| run: cargo build --workspace --all-targets | |
| - name: Preserve the binary without WASM for package rejection | |
| run: cp target/debug/codeguard "$RUNNER_TEMP/codeguard-no-wasm" | |
| - name: Verify Linux WASM worker resource boundary | |
| run: | | |
| cargo test -p codeguard-runtime --features wasm-precheck --test process_contract | |
| cargo test -p codeguard-runtime --features wasm-precheck --test wasm_grammar_load --test dart_upstream_corpus | |
| cargo test -p codeguard-cli --features wasm-precheck --test syntax_worker_candidate --test grammar_probe_cli --test grammar_route --test zig_lint_cli --test typescript_syntax_fallback_candidate --test java_syntax_fallback_candidate --test java_native_differential --test kotlin_native_differential --test erlang_native_differential --test check_all_eslint --test hook_execute_cli --test claude_hook_cli --test hook_syntax_tasks --test syntax_task_verify --test zig_native_cli --test task_resolution_service | |
| # 32 份 WASM 的批次和单项目回归各自独占候选阶段预算,避免测试进程互相争抢内存与 CPU。 | |
| cargo test -p codeguard-cli --features wasm-precheck --test check_all_grammar_candidates -- --test-threads=1 | |
| - name: Verify the local npm package contains a running WASM worker | |
| run: | | |
| cargo build --locked -p codeguard-cli --features wasm-precheck | |
| CODEGUARD_NO_WASM_BIN="$RUNNER_TEMP/codeguard-no-wasm" \ | |
| CODEGUARD_WASM_BIN="$PWD/target/debug/codeguard" \ | |
| node --test tests/npm_pack_wasm.test.mjs | |
| # 独占打包输出与 npm 缓存,不与上面的全量 grammar 包测试并发。 | |
| CODEGUARD_WASM_BIN="$PWD/target/debug/codeguard" \ | |
| node --test tests/npm_pack_repair.test.mjs | |
| - name: Run test suite | |
| run: cargo test --workspace --all-targets | |
| - name: Explain remaining layering debt | |
| if: always() | |
| run: python3 scripts/check_layering.py --explain |