64 lines
2.0 KiB
YAML
64 lines
2.0 KiB
YAML
name: 'Setup Rust'
|
|
description: |
|
|
Setup the rust toolchain and environment for the selected toolchain
|
|
|
|
inputs:
|
|
rust-version:
|
|
required: true
|
|
type: string
|
|
targets:
|
|
required: true
|
|
type: string
|
|
components:
|
|
required: false
|
|
default:
|
|
cache-context:
|
|
required: true
|
|
type: string
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
|
|
id: toolchain
|
|
with:
|
|
toolchain: ${{ inputs.rust-version }}
|
|
targets: ${{ inputs.targets }}
|
|
components: ${{ inputs.components }}
|
|
|
|
- name: Install i686 dependencies
|
|
if: "contains(inputs.targets,'i686')"
|
|
shell: bash
|
|
run: |
|
|
sudo dpkg --add-architecture i386
|
|
sudo apt-get update
|
|
sudo apt-get install libssl-dev:i386 gcc-multilib clang -y
|
|
echo "CC=clang" >> $GITHUB_ENV
|
|
echo "PKG_CONFIG_SYSROOT_DIR=/" >> $GITHUB_ENV
|
|
|
|
- name: Install s390x cross-compilation toolchain
|
|
if: ${{ matrix.target == 's390x-unknown-linux-gnu' }}
|
|
shell: bash
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y gcc-s390x-linux-gnu
|
|
echo "CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc" >> $GITHUB_ENV
|
|
|
|
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: ${{ inputs.cache-context }}_${{ inputs.targets }}_rustc-${{ steps.toolchain.outputs.cachekey }}_cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
# Remove build artifacts for the current crate, since it will be rebuilt every
|
|
# run anyway, but keep dependency artifacts to cache them.
|
|
# Must be placed after actions/cache so its post step runs first.
|
|
- uses: pyTooling/Actions/with-post-step@41aed3e559cbf69bfdb46abb25d7c535900ed5b6 # v7.7.0
|
|
with:
|
|
main: bash ./.github/actions/setup-rust/cleanup.sh
|
|
post: bash ./.github/actions/setup-rust/cleanup.sh
|