91 lines
2.8 KiB
YAML
91 lines
2.8 KiB
YAML
# This action sets up:
|
|
# - The correct version of Rust based on the `rust-toolchain` file
|
|
# - All components + targets specified in `rust-toolchain`
|
|
# - Caching of individual compilation requests via `sccache` and GCS
|
|
# - Downloads sccache from the mirror at build.rerun.io
|
|
# - `cargo nextest`
|
|
#
|
|
# Note that due to the use of GCS as an sccache storage backend,
|
|
# this action also sets up GCP credentials as a side effect.
|
|
# There is no harm to setting up the credentials twice accidentally,
|
|
# but care should be taken not to do that, as it's wasteful.
|
|
|
|
name: "Setup Rust"
|
|
|
|
inputs:
|
|
cache_key:
|
|
type: string
|
|
required: true
|
|
save_cache:
|
|
type: boolean
|
|
required: false
|
|
default: false
|
|
workload_identity_provider:
|
|
type: string
|
|
required: true
|
|
service_account:
|
|
type: string
|
|
required: true
|
|
toolchains:
|
|
type: string
|
|
required: false
|
|
description: "Space-separated list of extra toolchains to install"
|
|
targets:
|
|
type: string
|
|
required: false
|
|
description: "One or more space separated target triplets that will be ensured to be supported."
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
# Needed because the default is clang 15 and it fails to compile some dependencies for wasm, with "LLVM error:
|
|
# section too large".
|
|
- name: Use clang 18 (mac)
|
|
if: ${{ runner.os == 'macOS' }}
|
|
run: |
|
|
echo "$(brew --prefix llvm@18)/bin" >> $GITHUB_PATH
|
|
shell: bash --noprofile --norc -euo pipefail {0}
|
|
|
|
- name: Check clang version
|
|
if: ${{ runner.os == 'macOS' }}
|
|
run: |
|
|
clang --version
|
|
which clang
|
|
shell: bash --noprofile --norc -euo pipefail {0}
|
|
|
|
- name: Set up GCP credentials
|
|
uses: google-github-actions/auth@v2
|
|
with:
|
|
workload_identity_provider: ${{ inputs.workload_identity_provider }}
|
|
service_account: ${{ inputs.service_account }}
|
|
|
|
- name: Ensure correct version of Rust is installed
|
|
shell: bash --noprofile --norc -euo pipefail {0}
|
|
run: |
|
|
rustup --version
|
|
rustup install
|
|
|
|
- name: Install additional targets
|
|
if: ${{ inputs.targets != '' }}
|
|
shell: bash --noprofile --norc -euo pipefail {0}
|
|
run: rustup target add ${{ inputs.targets }}
|
|
|
|
- name: Install additional toolchains
|
|
if: ${{ inputs.toolchains }}
|
|
shell: bash --noprofile --norc -euo pipefail {0}
|
|
run: |
|
|
for toolchain in ${{ inputs.toolchains }}; do
|
|
rustup install $toolchain
|
|
done
|
|
|
|
- name: Set up sccache
|
|
shell: bash --noprofile --norc -euo pipefail {0}
|
|
run: |
|
|
"$GITHUB_ACTION_PATH/../../scripts/setup_sccache.sh" --version v0.14.0 --backend gcs
|
|
|
|
# Recommended way to install nextest on CI.
|
|
- name: Install latest nextest release
|
|
uses: taiki-e/install-action@v2.48.7
|
|
with:
|
|
tool: nextest@0.9.89
|