mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
To avoid burning Azure credits, we move the runners back down to the free tier. Now that caching is properly set up, this should incur only a minor increase in CI time.
89 lines
3.6 KiB
YAML
89 lines
3.6 KiB
YAML
---
|
|
name: "Setup Rust"
|
|
description: "Sets up the correct Rust version and caching via sccache and a GCP backend"
|
|
inputs:
|
|
sccache_azure_connection_string:
|
|
description: "Azure connection string for sccache"
|
|
targets:
|
|
description: "Additional targets to install"
|
|
required: false
|
|
default: ""
|
|
|
|
outputs:
|
|
bench-packages:
|
|
description: Benchmarkable packages for the current OS
|
|
value: ${{
|
|
(runner.os == 'Linux' && '--help') ||
|
|
(runner.os == 'macOS' && '--help') ||
|
|
(runner.os == 'Windows' && '-p firezone-bin-shared') }}
|
|
compile-packages:
|
|
description: Compilable packages for the current OS
|
|
value: ${{
|
|
(runner.os == 'Linux' && '--workspace') ||
|
|
(runner.os == 'macOS' && '--workspace --exclude ebpf-turn-router --exclude gui-smoke-test --exclude client-ffi') ||
|
|
(runner.os == 'Windows' && '--workspace --exclude ebpf-turn-router --exclude apple-client-ffi --exclude client-ffi') }}
|
|
test-packages:
|
|
description: Testable packages for the current OS
|
|
value: ${{
|
|
(runner.os == 'Linux' && '--workspace') ||
|
|
(runner.os == 'macOS' && '-p apple-client-ffi -p client-shared -p firezone-tunnel -p snownet') ||
|
|
(runner.os == 'Windows' && '-p client-shared -p connlib-model -p firezone-bin-shared -p firezone-gui-client -p firezone-headless-client -p firezone-logging -p firezone-telemetry -p firezone-tunnel -p gui-smoke-test -p http-test-server -p ip-packet -p phoenix-channel -p snownet -p socket-factory -p tun') }}
|
|
nightly_version:
|
|
description: The nightly version of Rust
|
|
value: ${{ steps.nightly.outputs.nightly }}
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
|
|
|
|
- name: Disable Windows Defender
|
|
if: ${{ runner.os == 'Windows' }}
|
|
run: Set-MpPreference -DisableRealtimeMonitoring $true
|
|
shell: powershell
|
|
|
|
- name: Extract Rust version
|
|
run: |
|
|
RUST_TOOLCHAIN=$(grep 'channel' rust/rust-toolchain.toml | awk -F '"' '{print $2}')
|
|
echo "RUST_TOOLCHAIN=$RUST_TOOLCHAIN" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
- uses: actions-rust-lang/setup-rust-toolchain@ab6845274e2ff01cd4462007e1a9d9df1ab49f42 # v1
|
|
id: toolchain
|
|
with:
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
components: rustfmt,clippy
|
|
target: ${{ inputs.targets }}
|
|
cache: true
|
|
cache-on-failure: true
|
|
rustflags: "" # Don't set -D warnings by default
|
|
|
|
# We use Azure Blob Storage for sccache because credits and GHA cache is too small (10 GB).
|
|
# For this to work, you need an Azure Storage account and a blob container named `sccache`.
|
|
# The connection string here can be found under Storage Account -> Settings -> Security + networking -> Access keys.
|
|
- name: Configure sccache
|
|
shell: bash
|
|
run: |
|
|
echo "SCCACHE_GHA_ENABLED=false" >> $GITHUB_ENV
|
|
echo "SCCACHE_AZURE_CONNECTION_STRING=${{ inputs.sccache_azure_connection_string }}" >> $GITHUB_ENV
|
|
echo "SCCACHE_AZURE_BLOB_CONTAINER=sccache" >> $GITHUB_ENV
|
|
echo "RUSTC_WRAPPER=$SCCACHE_PATH" >> $GITHUB_ENV
|
|
|
|
- name: Install nightly Rust
|
|
id: nightly
|
|
run: |
|
|
NIGHTLY="nightly-2025-05-30"
|
|
# Check if nightly toolchain is already installed
|
|
if ! rustup toolchain list | grep -q "$NIGHTLY"; then
|
|
rustup toolchain install $NIGHTLY
|
|
rustup component add rust-src --toolchain $NIGHTLY
|
|
fi
|
|
echo "nightly=$NIGHTLY" >> $GITHUB_OUTPUT
|
|
shell: bash
|
|
|
|
- name: Start sccache
|
|
run: $SCCACHE_PATH --start-server
|
|
shell: bash
|
|
env:
|
|
SCCACHE_CONF: ".github/actions/setup-rust/sccache.toml"
|