mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
50 lines
1.8 KiB
YAML
50 lines
1.8 KiB
YAML
name: "Setup Rust"
|
|
description: "Sets up the correct Rust version and caching via sccache and a GCP backend"
|
|
inputs:
|
|
sccache_enabled:
|
|
description: "Enable or disable the sccache service"
|
|
required: false
|
|
default: 'true'
|
|
targets:
|
|
description: "Additional targets to install"
|
|
required: false
|
|
default: ""
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- if: ${{ inputs.sccache_enabled == 'true' }}
|
|
id: auth
|
|
uses: google-github-actions/auth@v1
|
|
with:
|
|
workload_identity_provider: "projects/397012414171/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions"
|
|
service_account: "github-actions@github-iam-387915.iam.gserviceaccount.com"
|
|
export_environment_variables: true
|
|
create_credentials_file: true
|
|
- if: ${{ inputs.sccache_enabled == 'true' }}
|
|
run: |
|
|
echo "SCCACHE_GCS_BUCKET=firezone-staging-sccache" >> $GITHUB_ENV
|
|
echo "SCCACHE_GCS_RW_MODE=READ_WRITE" >> $GITHUB_ENV
|
|
shell: bash
|
|
- if: ${{ inputs.sccache_enabled == 'true' }}
|
|
uses: mozilla-actions/sccache-action@v0.0.3
|
|
- if: ${{ inputs.sccache_enabled }}
|
|
run: echo "RUSTC_WRAPPER=$SCCACHE_PATH" >> $GITHUB_ENV
|
|
shell: bash
|
|
- name: Extract Rust version
|
|
run: |
|
|
RUST_TOOLCHAIN=$(grep 'channel' rust-toolchain.toml | awk -F '"' '{print $2}')
|
|
echo "RUST_TOOLCHAIN=$RUST_TOOLCHAIN" >> $GITHUB_ENV
|
|
shell: bash
|
|
working-directory: ./rust
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
components: rustfmt,clippy
|
|
- if: inputs.targets != ''
|
|
run: rustup target add ${{ inputs.targets }}
|
|
shell: bash
|
|
- if: ${{ inputs.sccache_enabled == 'true' }}
|
|
name: Start sccache
|
|
run: $SCCACHE_PATH --start-server
|
|
shell: bash
|