Files
firezone/.github/workflows/rust.yml
Thomas Eizinger 5549044afe ci: use sccache for Rust (#2402)
Our caches in GitHub actions are hopelessly overflowing, plus for the
Kotlin and Swift jobs, we don't seem to be doing a particularly good job
at caching the build outputs because those jobs take forever.

Instead of using GitHub actions, this PR configures `sccache` for all
Rust compilation commands and uses a GCP bucket to store the artifacts.
This speeds up some of the builds a fair bit. Android now finishes in
~6minutes.

Apart from the self-hosted MacOS 14 runner, the Swift jobs are slow but
still a lot faster than what we currently have.

Windows seems to be quite slow at compiling / fetching artefacts which
is negatively impacted by this change because they now have to be
fetched from the bucket.

Overall, I think this is a net-positive though and should be much easier
to maintain going forward.

---------

Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2023-10-18 10:25:31 -07:00

76 lines
2.2 KiB
YAML

name: Rust
on:
workflow_call:
defaults:
run:
working-directory: ./rust
permissions:
contents: 'read'
id-token: 'write'
jobs:
static-analysis:
strategy:
fail-fast: false
matrix:
runs-on:
# We only need to run static analysis checks per OS family
- ubuntu-22.04
- macos-13
- windows-2022
# TODO: https://github.com/rust-lang/cargo/issues/5220
include:
- runs-on: ubuntu-22.04
packages: # Intentionally blank as a package catch-all linter
- runs-on: macos-13
packages: -p connlib-client-apple
- runs-on: windows-2022
packages: -p connlib-client-shared
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-rust
- run: cargo fmt -- --check
- run: |
cargo doc --all-features --no-deps --document-private-items ${{ matrix.packages }}
env:
RUSTDOCFLAGS: "-D warnings"
- run: |
cargo clippy --all-targets --all-features ${{ matrix.packages }} -- -D warnings
test:
strategy:
fail-fast: false
matrix:
# TODO: https://github.com/rust-lang/cargo/issues/5220
include:
- runs-on: ubuntu-20.04
packages: -p firezone-headless-client -p firezone-gateway -p connlib-client-android
- runs-on: ubuntu-22.04
packages: -p firezone-headless-client -p firezone-gateway -p connlib-client-android
- runs-on: macos-12
packages: -p connlib-client-apple
- runs-on: macos-13
packages: -p connlib-client-apple
- runs-on: windows-2019
packages: -p connlib-client-shared
- runs-on: windows-2022
packages: -p connlib-client-shared
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-rust
- run: cargo test --all-features ${{ matrix.packages }}
smoke-test-relay:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./rust/relay
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-rust
- run: ./run_smoke_test.sh