Files
OxideJS-New/.github/actions/setup-tools/action.yml
T

49 lines
1.8 KiB
YAML
Raw 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 / mold / nextest)
# 工具缓存:sccache、mold、nextest 缓存到用户可写的 ~/oxide-tools-cache,恢复后
# sudo cp 到 /usr/bin(sccache、mold)与 ~/.cargo/bin(nextest)。mold 必须落
# /usr/bin(默认 PATH)——落 ~/.cargo/bin 时 sccache 包装 rustc 的链接子进程不
# 继承 GITHUB_PATH 加的 PATH,链接器找不到 mold 报 cannot find ld。nextest 走
# 官方预编译二进制直下,不依赖 main 分支安装脚本(脚本会被移动而 404)。
description: 恢复工具缓存;缺失时安装 sccache、mold、nextest 并落系统目录
runs:
using: composite
steps:
- name: Restore tool cache
id: tool-cache
uses: actions/cache/restore@v4
with:
path: ~/oxide-tools-cache
key: oxide-tools-ubuntu-v1
- name: Install tools (cache miss)
if: steps.tool-cache.outputs.cache-hit != 'true'
shell: bash
run: |
sudo apt-get update -y
sudo apt-get install -y sccache mold
mkdir -p "$HOME/oxide-tools-cache"
cp /usr/bin/sccache /usr/bin/mold "$HOME/oxide-tools-cache/"
curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C "$HOME/oxide-tools-cache"
- name: Install tools to system dirs
shell: bash
run: |
sudo cp "$HOME/oxide-tools-cache/sccache" "$HOME/oxide-tools-cache/mold" /usr/bin/
cp "$HOME/oxide-tools-cache/cargo-nextest" "$HOME/.cargo/bin/"
- name: Verify tools in PATH
shell: bash
run: |
which sccache mold cargo-nextest
sccache --version
mold --version
- name: Save tool cache
if: steps.tool-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ~/oxide-tools-cache
key: oxide-tools-ubuntu-v1