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

40 lines
1.5 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/bin,按固定 key 跨 run
# 持久缓存。首跑各 job 各装一次(冗余但一次性),之后每个 run 直接 restore、
# 秒级。nextest 走官方预编译二进制直下,不依赖 main 分支安装脚本(脚本会被移动
# 而 404)。sccache 与 mold 经 apt 装到 /usr/bin 后拷入 ~/oxide-tools/bin,
# 使缓存路径落在用户可写目录(/usr/bin 缓存受权限限制)。
description: 恢复工具缓存;缺失时安装 sccache、mold、nextest 并存缓存
runs:
using: composite
steps:
- name: Restore tool cache
id: tool-cache
uses: actions/cache/restore@v4
with:
path: ~/oxide-tools/bin
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/bin"
cp /usr/bin/sccache /usr/bin/mold "$HOME/oxide-tools/bin/"
curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C "$HOME/oxide-tools/bin"
- name: Add tools to PATH
shell: bash
run: echo "$HOME/oxide-tools/bin" >> "$GITHUB_PATH"
- name: Save tool cache
if: steps.tool-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ~/oxide-tools/bin
key: oxide-tools-ubuntu-v1