Files
2026-07-13 13:05:14 +08:00

272 lines
8.9 KiB
YAML

name: "Rust Checks: Lints, Tests, Docs"
on:
workflow_call:
inputs:
CONCURRENCY:
required: true
type: string
CHANNEL:
required: false
type: string # enum: 'nightly', 'main', or 'pr'
concurrency:
group: ${{ inputs.CONCURRENCY }}-checks_rust
cancel-in-progress: true
env:
RUSTFLAGS: --deny warnings
RUSTDOCFLAGS: --deny warnings
# Improve diagnostics for crashes.
RUST_BACKTRACE: full
# Sourced from https://vulkan.lunarg.com/sdk/home#linux
VULKAN_SDK_VERSION: "1.3.290.0"
# Via: https://nexte.st/docs/installation/pre-built-binaries/#using-nextest-in-github-actions
# ANSI color codes should be supported by default on GitHub Actions.
CARGO_TERM_COLOR: always
defaults:
run:
shell: bash --noprofile --norc -euo pipefail {0}
permissions:
contents: "read"
id-token: "write"
jobs:
# ---------------------------------------------------------------------------
rs-lints:
name: Rust lints (fmt, check, clippy, doc)
timeout-minutes: 60
runs-on: ubuntu-latest-16-cores
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
lfs: true
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache_key: "build-linux"
save_cache: true
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
- uses: prefix-dev/setup-pixi@v0.10.0
with:
pixi-version: v0.71.3
- name: Rust checks (PR subset)
if: ${{ inputs.CHANNEL == 'pr' }}
run: pixi run rs-check --only base_checks sdk_variations cargo_deny denied_sdk_deps wasm docs
- name: Rust most checks (`main` branch subset)
if: ${{ inputs.CHANNEL == 'main' }}
run: pixi run rs-check --skip individual_crates docs_slow tests tests_without_all_features # Tests run in a separate job
- name: Rust all checks (nightly)
if: ${{ inputs.CHANNEL == 'nightly' }}
run: pixi run rs-check --skip tests tests_without_all_features # Tests run in a separate job
- name: .rrd backwards compatibility
# We don't yet guarantee backwards compatibility, but we at least check it
# so that we _know_ if/when we break it.
# See tests/assets/rrd/README.md for more
run: pixi run check-backwards-compatibility
- name: Check dependency tree (no cycles)
run: pixi run python scripts/ci/crates.py check-dependency-tree
rs-tests:
name: Test on Linux
timeout-minutes: 60
runs-on: ubuntu-latest-16-cores
env:
RUSTDOCFLAGS: ""
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
lfs: true
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache_key: "build-linux"
save_cache: true
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
- uses: prefix-dev/setup-pixi@v0.10.0
with:
pixi-version: v0.71.3
# Install the Vulkan SDK, so we can use the software rasterizer.
# TODO(andreas): It would be nice if `setup_software_rasterizer.py` could do that for us as well (note though that this action here is very fast when cached!)
- name: Install Vulkan SDK
uses: rerun-io/install-vulkan-sdk-action@v1.1.0
with:
vulkan_version: ${{ env.VULKAN_SDK_VERSION }}
install_runtime: true
cache: true
stripdown: true
- name: Setup software rasterizer
run: pixi run python ./scripts/ci/setup_software_rasterizer.py
- name: Rust tests
run: pixi run rs-check --only tests
- name: Rust tests without --all-features (`main`/`nightly` channel)
if: ${{ inputs.CHANNEL != 'pr' }}
run: pixi run rs-check --only tests_without_all_features
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-linux
path: |
**/tests/snapshots
**/tests/failures
# Run tests on Mac and Windows (main channel)
mac-windows-tests-main:
name: Tests only (main)
timeout-minutes: 100 # Windows is very slow
strategy:
matrix:
include:
- runs_on: "macos-26-xlarge"
name: "macos"
- runs_on: "windows-latest-32-cores"
name: "windows"
if: ${{ inputs.CHANNEL == 'main' }}
runs-on: ${{ matrix.runs_on }}
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache_key: "build-${{ matrix.name }}"
save_cache: true
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
# Building with `--all-features` requires extra build tools like `nasm`.
- uses: prefix-dev/setup-pixi@v0.10.0
with:
pixi-version: v0.71.3
# Install the Vulkan SDK, so we can use the software rasterizer.
# TODO(andreas): It would be nice if `setup_software_rasterizer.py` could do that for us as well (note though that this action here is very fast when cached!)
- name: Install Vulkan SDK
uses: rerun-io/install-vulkan-sdk-action@v1.1.0
with:
vulkan_version: ${{ env.VULKAN_SDK_VERSION }}
install_runtime: true
cache: true
stripdown: true
- name: Setup software rasterizer
run: pixi run python ./scripts/ci/setup_software_rasterizer.py
- name: Rust tests
run: pixi run rs-check --only tests
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.name }}
path: |
**/tests/snapshots
**/tests/failures
# Run all checks on Mac and Windows (nightly channel, split across multiple jobs)
mac-windows-checks-nightly:
name: ${{ matrix.platform.name }}${{ matrix.checks_group.label }}
timeout-minutes: 100 # Windows is very slow
strategy:
fail-fast: false
matrix:
platform:
- runs_on: "macos-26-xlarge"
name: "macos"
- runs_on: "windows-latest-32-cores"
name: "windows"
checks_group:
- name: "base-and-deny"
checks: "base_checks sdk_variations cargo_deny denied_sdk_deps"
label: " (base & deny)"
- name: "wasm-and-examples"
checks: "wasm individual_examples"
label: " (wasm & examples)"
- name: "individual-crates"
checks: "individual_crates"
label: " (individual crates)"
- name: "docs"
checks: "docs docs_slow"
label: " (docs)"
- name: "tests"
checks: "tests"
label: " (tests)"
- name: "tests-default-features"
checks: "tests_without_all_features"
label: " (tests default features)"
if: ${{ inputs.CHANNEL == 'nightly' }}
runs-on: ${{ matrix.platform.runs_on }}
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache_key: "build-${{ matrix.platform.name }}-${{ matrix.checks_group.name }}"
save_cache: true
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
# Building with `--all-features` requires extra build tools like `nasm`.
- uses: prefix-dev/setup-pixi@v0.10.0
with:
pixi-version: v0.71.3
# Install the Vulkan SDK, so we can use the software rasterizer.
# TODO(andreas): It would be nice if `setup_software_rasterizer.py` could do that for us as well (note though that this action here is very fast when cached!)
- name: Install Vulkan SDK
uses: rerun-io/install-vulkan-sdk-action@v1.1.0
with:
vulkan_version: ${{ env.VULKAN_SDK_VERSION }}
install_runtime: true
cache: true
stripdown: true
- name: Setup software rasterizer
run: pixi run python ./scripts/ci/setup_software_rasterizer.py
- name: Rust checks
run: pixi run rs-check --only ${{ matrix.checks_group.checks }}
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.platform.name }}-${{ matrix.checks_group.name }}
path: |
**/tests/snapshots
**/tests/failures