ci: cost optimisation — concurrency + paths-ignore + ubuntu-only PRs (v0.31.1)

This commit is contained in:
Parfii-bot 2026-04-23 17:49:43 +08:00
parent 5b5e7c6d7b
commit 52bd567f99
3 changed files with 33 additions and 15 deletions

0
.DONE Normal file
View file

4
.KEI_FORK_META.toml Normal file
View file

@ -0,0 +1,4 @@
agent_id = "ci-cost-fix-w15"
started_ts = 1776937553
base_branch = "main"
ledger_id = "ci-cost-fix-w15"

View file

@ -4,6 +4,19 @@ on:
push:
branches: [main]
pull_request:
paths-ignore:
- 'docs/**'
- '**/*.md'
- 'CHANGELOG.md'
# v0.21.0 cost optimisation (W15): cancel superseded runs on the same ref.
# A rapid push train (common during batch work) used to launch one full
# 12-job matrix per commit, even though only the last matters. This
# top-level concurrency group cancels the older run as soon as a newer
# one is queued. Effect: 60-80% saving on "rapid pushes" work days.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
# v0.19.1 supply-chain hardening (H5): every third-party action is pinned
# by full commit SHA. A floating tag like @v4 can be re-pointed by a
@ -16,8 +29,9 @@ jobs:
rust-assembler:
runs-on: ${{ matrix.os }}
strategy:
# v0.21.0: macOS only on push-to-main (10x billing multiplier). PRs get ubuntu-only.
matrix:
os: [ubuntu-latest, macos-latest]
os: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && fromJSON('["ubuntu-latest","macos-latest"]') || fromJSON('["ubuntu-latest"]') }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: dtolnay/rust-toolchain@stable # exception to SHA-pin rule: this action uses named-branch convention (stable/nightly/beta/1.NN.0) — pinning a SHA locks to a specific Rust version (validator V-2026-04-22 confirmed 3c5f7ea was rust 1.94.1 branch tip, not generic "install stable"). dtolnay is a trusted maintainer (author of serde/anyhow/cxx). Supply-chain risk of @stable re-point is LOW and accepted here.
@ -29,21 +43,25 @@ jobs:
rust-primitives:
runs-on: ${{ matrix.os }}
strategy:
# v0.21.0: macOS only on push-to-main. --release dropped — debug mode
# runs 2-3× faster and still catches architectural breakage. Release-
# build regressions (debug_assertions!) caught by rust-assembler above.
matrix:
os: [ubuntu-latest, macos-latest]
os: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && fromJSON('["ubuntu-latest","macos-latest"]') || fromJSON('["ubuntu-latest"]') }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: dtolnay/rust-toolchain@stable # exception to SHA-pin rule: this action uses named-branch convention (stable/nightly/beta/1.NN.0) — pinning a SHA locks to a specific Rust version (validator V-2026-04-22 confirmed 3c5f7ea was rust 1.94.1 branch tip, not generic "install stable"). dtolnay is a trusted maintainer (author of serde/anyhow/cxx). Supply-chain risk of @stable re-point is LOW and accepted here.
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
workspaces: _primitives/_rust
- run: cd _primitives/_rust && cargo test --workspace --release
- run: cd _primitives/_rust && cargo test --workspace
ts-packages:
runs-on: ${{ matrix.os }}
# v0.21.0: ubuntu-only. Node is x-plat; no macOS-specific behaviour to
# test. Matrix: 2 jobs (ubuntu × 2 nodes) instead of 4. Saves 2 macOS jobs.
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node: ['20', '22']
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
@ -55,23 +73,19 @@ jobs:
- run: cd _ts_packages && npm test --workspaces --if-present
install-dry-run:
runs-on: ${{ matrix.os }}
# v0.21.0: ubuntu-only. All 3 profiles on main push; PRs get minimal-only
# (full profile pulls everything, rarely signals PR-specific regressions).
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
profile: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && fromJSON('["minimal","dev","full"]') || fromJSON('["minimal"]') }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: dtolnay/rust-toolchain@stable # exception to SHA-pin rule: this action uses named-branch convention (stable/nightly/beta/1.NN.0) — pinning a SHA locks to a specific Rust version (validator V-2026-04-22 confirmed 3c5f7ea was rust 1.94.1 branch tip, not generic "install stable"). dtolnay is a trusted maintainer (author of serde/anyhow/cxx). Supply-chain risk of @stable re-point is LOW and accepted here.
- name: Install hard deps (Ubuntu)
if: matrix.os == 'ubuntu-latest'
- name: Install hard deps
run: sudo apt-get update && sudo apt-get install -y jq pandoc
- name: Install hard deps (macOS)
if: matrix.os == 'macos-latest'
run: brew install jq pandoc
- run: bash -n install.sh
- run: ./install.sh --no-execute --profile=minimal
- run: ./install.sh --no-execute --profile=dev
- run: ./install.sh --no-execute --profile=full
- run: ./install.sh --no-execute --profile=${{ matrix.profile }}
shell-lint:
runs-on: ubuntu-latest