burrow/.forgejo/workflows/build-rust.yml
2026-03-19 03:51:53 -07:00

57 lines
1.6 KiB
YAML

name: Build Rust
on:
push:
branches:
- main
pull_request:
branches:
- "**"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
rust:
name: Cargo Test
runs-on: namespace-profile-linux-medium
env:
CARGO_INCREMENTAL: 0
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 20G
steps:
- name: Checkout
uses: https://code.forgejo.org/actions/checkout@v4
with:
token: ${{ github.token }}
fetch-depth: 0
- name: Prepare Cache Dirs
shell: bash
run: |
set -euo pipefail
cache_root="${NSC_CACHE_PATH:-${HOME}/.cache/burrow}"
shared_root="${NSC_SHARED_CACHE_PATH:-${cache_root}/shared}"
lane_root="${NSC_LANE_CACHE_PATH:-${cache_root}/lane/build-rust}"
mkdir -p \
"${shared_root}/cargo" \
"${shared_root}/sccache" \
"${shared_root}/xdg" \
"${lane_root}/cargo-target"
echo "CARGO_HOME=${shared_root}/cargo" >> "${GITHUB_ENV}"
echo "SCCACHE_DIR=${shared_root}/sccache" >> "${GITHUB_ENV}"
echo "XDG_CACHE_HOME=${shared_root}/xdg" >> "${GITHUB_ENV}"
echo "CARGO_TARGET_DIR=${lane_root}/cargo-target" >> "${GITHUB_ENV}"
df -h /nix "${shared_root}" "${lane_root}" || true
- name: Test
shell: bash
run: |
set -euo pipefail
nix develop .#ci -c bash -lc '
sccache --zero-stats >/dev/null 2>&1 || true
cargo test --workspace --all-features
sccache --show-stats || true
'