Files
firezone/.github/workflows/rust.yml
2023-06-07 06:17:20 -07:00

71 lines
2.2 KiB
YAML

name: Rust CI
on:
pull_request:
paths:
- 'rust/**'
push:
branches:
- master
paths:
- 'rust/**'
# Cancel old workflow runs if new code is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test all crates
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./rust
steps:
- uses: actions/checkout@v2
# This implicitly triggers installation of the toolchain in the `rust-toolchain.toml` file.
# If we don't do this here, our cache action will compute a cache key based on the Rust version shipped on GitHub's runner which might differ from the one we use.
- run: rustup show
- uses: Swatinem/rust-cache@v2
- run: cargo fmt -- --check
- run: cargo doc --no-deps --document-private-items
env:
RUSTDOCFLAGS: "-D warnings"
- run: cargo clippy -- -D warnings
- run: cargo test
cross: # cross is separate from test because cross-compiling yields different artifacts and we cannot reuse the cache.
name: Cross compile all crates
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./rust
steps:
- uses: actions/checkout@v2
# This implicitly triggers installation of the toolchain in the `rust-toolchain.toml` file.
# If we don't do this here, our cache action will compute a cache key based on the Rust version shipped on GitHub's runner which might differ from the one we use.
- run: rustup show
- uses: Swatinem/rust-cache@v2
- run: rustup target add x86_64-unknown-linux-musl
- run: cargo build --bin relay --target x86_64-unknown-linux-musl
relay_smoke:
name: Smoke-test relay
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./rust/relay
steps:
- uses: actions/checkout@v2
# This implicitly triggers installation of the toolchain in the `rust-toolchain.toml` file.
# If we don't do this here, our cache action will compute a cache key based on the Rust version shipped on GitHub's runner which might differ from the one we use.
- run: rustup show
- uses: Swatinem/rust-cache@v2
- run: ./run_smoke_test.sh