mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00

Fixed #1038 sccache is not very effective at caching dependencies, the external C/C++ is recompiled in every ci and it takes a lot of time. Compilation of other Rust dependencies also takes quite some time and sccache is not helping at all, so I decided to switch to `Swatinem/rust-cache@v2`. The downside of the new caching method is that a new cache conntaining part of the `.cargo/` and `target/` will be created whenver `Cargo.lock`/`Cargo.toml` changes, but it can still reuse the old cache to create new caching. This is acceptable given that `sccache` often fails to reuse cache due to rate limiting from GHA, since it is not designed for use like a s3 object pool, and `sccache` will create a lot of new cache artifacts for a given branch that cannot be reused in main and would have to cleanup via a cronjob. Edit: rust 1.70 uses llvm 16.0, however ubuntu-latest still uses llvm 15.0 As such, during release-build, cross-lang-lto failed due to llvm is too old. Temporarily disable linker-plugin-lto to fix this. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
59 lines
1.3 KiB
YAML
59 lines
1.3 KiB
YAML
name: Setup tools and cache
|
|
inputs:
|
|
tools:
|
|
description: Extra tools
|
|
required: false
|
|
default: ""
|
|
indexcache:
|
|
description: Enable index cache
|
|
required: true
|
|
default: true
|
|
type: boolean
|
|
buildcache:
|
|
description: Enable build cache
|
|
required: true
|
|
default: true
|
|
type: boolean
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Add just to tools to install
|
|
run: echo "tools=just" >>$GITHUB_ENV
|
|
shell: bash
|
|
|
|
- name: Add inputs.tools to tools to install
|
|
if: inputs.tools != ''
|
|
env:
|
|
inputs_tools: ${{ inputs.tools }}
|
|
run: echo "tools=$tools,$inputs_tools" >>$GITHUB_ENV
|
|
shell: bash
|
|
|
|
- name: Install tools
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: ${{ env.tools }}
|
|
|
|
- name: Install rust toolchains
|
|
run: just toolchain
|
|
shell: bash
|
|
|
|
- name: rustc version
|
|
run: rustc -vV
|
|
shell: bash
|
|
|
|
- name: Retrieve RUSTFLAGS for caching
|
|
if: inputs.indexcache || inputs.buildcache
|
|
id: retrieve-rustflags
|
|
run: |
|
|
if [ -n "${{ inputs.buildcache }}" ]; then
|
|
echo RUSTFLAGS="$(just print-rustflags)" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo RUSTFLAGS= >> "$GITHUB_OUTPUT"
|
|
fi
|
|
shell: bash
|
|
|
|
- if: inputs.indexcache || inputs.buildcache
|
|
uses: Swatinem/rust-cache@v2
|
|
env:
|
|
RUSTFLAGS: ${{ steps.retrieve-rustflags.outputs.RUSTFLAGS }}
|