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
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ jobs:
if: steps.ws.outputs.exists == 'true'
run: make test

- uses: taiki-e/install-action@5d880190e41a7608c29a5c91c6b5d24561d53850 # cargo-deny
- name: Install cargo-deny (retry + crates.io 回退)
run: ./scripts/install-cargo-deny.sh
if: steps.ws.outputs.exists == 'true'

- name: make deny(零诊断门禁)
Expand Down Expand Up @@ -143,7 +144,8 @@ jobs:
targets: aarch64-apple-darwin, x86_64-apple-darwin
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
if: steps.changes.outputs.lane == 'full'
- uses: taiki-e/install-action@5d880190e41a7608c29a5c91c6b5d24561d53850 # cargo-deny
- name: Install cargo-deny (retry + crates.io 回退)
run: ./scripts/install-cargo-deny.sh
if: steps.changes.outputs.lane != 'docs'
- name: Verify Rust and privacy
if: steps.changes.outputs.lane == 'full'
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/isolated-imk-notary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ jobs:
components: rustfmt, clippy
targets: aarch64-apple-darwin, x86_64-apple-darwin
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6
- uses: taiki-e/install-action@5d880190e41a7608c29a5c91c6b5d24561d53850
with:
tool: cargo-deny
- name: Install cargo-deny (retry + crates.io 回退)
run: ./scripts/install-cargo-deny.sh
- name: Verify and build owned test host
env:
TARGET_TEST_ROOT: ${{ inputs.target_root }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/isolated-update-drill.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ jobs:
components: rustfmt, clippy
targets: aarch64-apple-darwin, x86_64-apple-darwin
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6
- uses: taiki-e/install-action@5d880190e41a7608c29a5c91c6b5d24561d53850
with:
tool: cargo-deny
- name: Install cargo-deny (retry + crates.io 回退)
run: ./scripts/install-cargo-deny.sh
- name: Verify and build owned drill host
env:
TARGET_TEST_ROOT: ${{ inputs.target_root }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/macos-acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ jobs:
components: rustfmt, clippy
targets: aarch64-apple-darwin, x86_64-apple-darwin
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
- uses: taiki-e/install-action@5d880190e41a7608c29a5c91c6b5d24561d53850 # cargo-deny
- name: Install cargo-deny (retry + crates.io 回退)
run: ./scripts/install-cargo-deny.sh
- name: Verify and build
run: |
make verify
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/macos-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ jobs:
components: rustfmt, clippy
targets: aarch64-apple-darwin, x86_64-apple-darwin
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
- uses: taiki-e/install-action@5d880190e41a7608c29a5c91c6b5d24561d53850 # cargo-deny
- name: Install cargo-deny (retry + crates.io 回退)
run: ./scripts/install-cargo-deny.sh
- name: Repository gates
run: make verify
- name: Offline macOS and packaging regressions
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- uses: dtolnay/rust-toolchain@e2a55d2ffb04f378e9626c28d38b36d230d1e12f # master
with:
toolchain: ${{ steps.rust.outputs.channel }}
- uses: taiki-e/install-action@5d880190e41a7608c29a5c91c6b5d24561d53850 # cargo-deny
- name: Install cargo-deny (retry + crates.io 回退)
run: ./scripts/install-cargo-deny.sh
- name: Dependency advisories
run: cargo deny check advisories
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ Signed-off-by: Your Name <you@example.com>
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
```

**工具安装**(`cargo-deny` 等)统一走仓库脚本,不直接用 `install-action`:该 action 从 GitHub Release
资产下载,2026-11-09 连续两次 504 让 `main` 的 macOS 任务假红。`scripts/install-cargo-deny.sh`
自己下载并重试,失败退回 crates.io 源码编译,两条路都固定同一版本(`CARGO_DENY_VERSION`):

```yaml
- name: Install cargo-deny (retry + crates.io 回退)
run: ./scripts/install-cargo-deny.sh
```

**升级步骤**(单独一个 `ci: bump ...` 提交,说明里附来源):

1. 在**官方仓库**查该 tag/branch 当前指向的 commit:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ deny: check-workspace ## 依赖许可 / 漏洞 / 重复依赖检查(零诊断
$(CLEAN) $(CARGO) deny check

bootstrap: ## 安装开发依赖(版本固定,见 MVP 审计 SEC-07)
cargo install cargo-deny --version 0.20.2 --locked
./scripts/install-cargo-deny.sh
cargo install cargo-fuzz --version 0.13.2 --locked

EVAL_SAMPLES ?= tools/eval/samples.tsv
Expand Down
14 changes: 14 additions & 0 deletions docs/reviews/263-1.2.1-audit-cleanup.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,17 @@
- 每一步删除后跑 `make verify` 与离线回归;最终 `make macos-offline-tests`:**62 文件 / 328 例 PASS**(4 并发)。
- `platforms/macos/dev-preview.sh --build-only` 通过(AppKit 面编译验证)。
- 版本推进到 **1.2.1 / build 40**,发布稿 `docs/releases/1.2.1.md`;tag 需用户授权。

## 5. CI 依赖安装去第三方(2026-11-09 追加)

`main` 上两次连续的红灯都不是代码问题:`taiki-e/install-action` 从 GitHub Release 资产取
`cargo-deny-0.20.2-aarch64-apple-darwin.tar.gz` 时拿到 **504**(重试 10 次约 60s 后失败),
而同一提交在 `dev` 上早已全绿、重置后仍失败。

处置:新增 `scripts/install-cargo-deny.sh`——固定版本、自下载 + 5 轮退避重试,失败退回
`cargo install cargo-deny --version 0.20.2 --locked`;`ci.yml`(macos/check)、`security.yml`、
`macos-acceptance.yml`、`macos-nightly.yml`、两个 isolated drill 工作流全部改用它;`make bootstrap`
同一入口。好处是版本单一来源、少一个第三方 Action、下载路径可控。
`CONTRIBUTING.md` §9 写明原因与用法,避免下次又改回 `install-action`。

验证:脚本两条路径都实跑过(资产下载路径在干净 `HOME` 下安装成功并输出 `cargo-deny 0.20.2`)。
55 changes: 55 additions & 0 deletions scripts/install-cargo-deny.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
# Install cargo-deny at the pinned version.
#
# CI 里 `taiki-e/install-action` 会从 GitHub Release 资产下载预编译包,该路径偶发 504
# (2026-11-09 连续两次让 main 的 macOS 任务红掉,代码其实全绿)。这里自己下载并重试,
# 失败时退回 crates.io 源码编译;两条路都固定同一版本,避免"工具版本漂移"变成假结论。
set -euo pipefail

VERSION="${CARGO_DENY_VERSION:-0.20.2}"
export PATH="${HOME}/.cargo/bin:${PATH}"

if command -v cargo-deny >/dev/null 2>&1 && cargo-deny --version 2>/dev/null | grep -q " ${VERSION}$"; then
echo "cargo-deny ${VERSION} 已就绪"
exit 0
fi

case "$(uname -s)-$(uname -m)" in
Darwin-arm64) TARGET="aarch64-apple-darwin" ;;
Darwin-x86_64) TARGET="x86_64-apple-darwin" ;;
Linux-x86_64) TARGET="x86_64-unknown-linux-musl" ;;
Linux-aarch64) TARGET="aarch64-unknown-linux-musl" ;;
*) TARGET="" ;;
esac

asset_install() {
[ -n "${TARGET}" ] || return 1
local url="https://github.com/EmbarkStudios/cargo-deny/releases/download/${VERSION}/cargo-deny-${VERSION}-${TARGET}.tar.gz"
local tmp
tmp="$(mktemp -d)"
for attempt in 1 2 3 4 5; do
if curl -fsSL --retry 3 --retry-all-errors --connect-timeout 20 --max-time 300 \
-o "${tmp}/cargo-deny.tar.gz" "${url}"; then
tar -xzf "${tmp}/cargo-deny.tar.gz" -C "${tmp}" --strip-components=1 \
"cargo-deny-${VERSION}-${TARGET}/cargo-deny" 2>/dev/null ||
tar -xzf "${tmp}/cargo-deny.tar.gz" -C "${tmp}" --strip-components=1
mkdir -p "${HOME}/.cargo/bin"
install -m 0755 "${tmp}/cargo-deny" "${HOME}/.cargo/bin/cargo-deny"
rm -rf "${tmp}"
return 0
fi
echo "下载 ${TARGET} 资产失败(第 ${attempt} 次),重试…" >&2
sleep $((attempt * 10))
done
rm -rf "${tmp}"
return 1
}

if asset_install && cargo-deny --version | grep -q " ${VERSION}$"; then
echo "cargo-deny ${VERSION} 已从 Release 资产安装"
exit 0
fi

echo "Release 资产不可用,改用 crates.io 源码编译(较慢但可靠)" >&2
cargo install cargo-deny --version "${VERSION}" --locked --force
cargo-deny --version
Loading