Files

52 lines
1.8 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Setup tools (sccache / nextest)
# 工具缓存:nextest 缓存到用户可写的 ~/oxide-tools-cache,恢复后 cp 到 ~/.cargo/bin。
# sccache 改用官方 sccache-action 安装,它带 GitHub Actions 缓存后端;apt 版 sccache
# 无该后端,本地磁盘缓存每个 job 用完即弃、跨 run 零命中,等于只付包装开销。
# mold 目前在 CI 统一禁用(见下方配置步骤),故不安装。
description: 恢复 nextest 工具缓存;安装 nextest 与 sccache(GHA 缓存后端)
runs:
using: composite
steps:
- name: Restore tool cache
id: tool-cache
uses: actions/cache/restore@v6
with:
path: ~/oxide-tools-cache
key: oxide-tools-ubuntu-v2
- name: Install nextest (cache miss)
if: steps.tool-cache.outputs.cache-hit != 'true'
shell: bash
run: |
mkdir -p "$HOME/oxide-tools-cache"
curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C "$HOME/oxide-tools-cache"
- name: Install nextest to cargo bin
shell: bash
run: cp "$HOME/oxide-tools-cache/cargo-nextest" "$HOME/.cargo/bin/"
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.11
- name: Configure build cache
shell: bash
run: |
# CI 链接器走默认 ld:sccache 包装 rustc 时链接子进程定位不到 mold,回退默认
# ld 报 cannot find ld。只改工作副本,本地提交的 config 保留 mold 提速。
sed -i '/^rustflags = .*fuse-ld=mold/d' .cargo/config.toml
- name: Verify tools in PATH
shell: bash
run: |
which cargo-nextest sccache
sccache --version
- name: Save tool cache
if: steps.tool-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v6
with:
path: ~/oxide-tools-cache
key: oxide-tools-ubuntu-v2