---
# inspiration:
# - [Tips for Faster Rust CI Builds | corrode Rust Consulting](https://corrode.dev/blog/tips-for-faster-ci-builds/)
name: try-build-on

on:
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  build-on:
    # "ubuntu-22.04-arm" vs "ubuntu-latest"
    # - faster? (not sure 10min for both with cold cache, and 4min (+1min) for arm on 90% cache'hit)
    # - fewer available => longer "queued times"
    strategy:
      matrix:
        runner:
          - ubuntu-22.04
          # - ubuntu-24.04-arm
    runs-on: ${{ matrix.runner }}
    env:
      CARGO_TERM_COLOR: always
      # to help debug on failure (maybe conflict with disable of test debug)
      RUST_BACKTRACE: full
      # reduce size of target (good for caching)
      CARGO_PROFILE_TEST_DEBUG: 0
      # disable incremental compilation faster from-scratch builds & sccache
      CARGO_INCREMENTAL: 0
      # configure sccache to cache the build artifacts (on github caches)
      SCCACHE_GHA_ENABLED: "true"
      RUSTC_WRAPPER: "sccache"
    steps:
      - uses: actions/checkout@v7
      - uses: mozilla-actions/sccache-action@v0.0.9
      - uses: dtolnay/rust-toolchain@stable
      - run: cargo build --locked
        shell: bash
