name: CI
on:
push:
branches:
- main
pull_request: {}
workflow_dispatch: {}
permissions:
contents: read
jobs:
check:
name: Check (${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-14
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Install MSVC target (Windows)
if: runner.os == 'Windows'
run: rustup target add x86_64-pc-windows-msvc
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
prefix-key: v2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Read Dawn tag
id: dawn_tag
run: |
dawn_tag="$(tr -d '\r\n' < DAWN_VERSION)"
if [[ -z "$dawn_tag" ]]; then
echo "DAWN_VERSION is empty" >&2
exit 1
fi
echo "value=$dawn_tag" >> "$GITHUB_OUTPUT"
- name: Cache Dawn prebuilt
uses: actions/cache@v4
with:
path: .ci/dawn-cache
key: dawn-${{ runner.os }}-${{ steps.dawn_tag.outputs.value }}-v2
- name: Set up MSVC dev environment (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Force MSVC linker/toolchain (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$cleanPath = ($env:PATH -split ';' | Where-Object { $_ -and ($_ -notmatch 'Git\\usr\\bin') }) -join ';'
"PATH=$cleanPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Download Dawn prebuilt release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
case "${{ runner.os }}" in
Linux) platform="linux" ;;
macOS) platform="macos" ;;
Windows) platform="windows" ;;
*)
echo "Unsupported runner OS: ${{ runner.os }}" >&2
exit 1
;;
esac
dawn_root="$(python3 ./scripts/download_dawn_prebuilt.py \
--platform "$platform" \
--tag "${{ steps.dawn_tag.outputs.value }}" \
--output ".ci/dawn-cache/${platform}-${{ steps.dawn_tag.outputs.value }}")"
if [[ -z "$dawn_root" ]]; then
echo "Failed to resolve DAWN_ROOT from prebuilt download" >&2
exit 1
fi
echo "DAWN_ROOT=$dawn_root" >> "$GITHUB_ENV"
echo "Using DAWN_ROOT=$dawn_root"
- name: Set cargo target args
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
echo "CARGO_TARGET_ARGS=--target x86_64-pc-windows-msvc" >> "$GITHUB_ENV"
else
echo "CARGO_TARGET_ARGS=" >> "$GITHUB_ENV"
fi
- name: Cargo check workspace
if: runner.os != 'Windows'
run: cargo check --workspace $CARGO_TARGET_ARGS
- name: Check dawn-rs examples (default)
if: runner.os != 'Windows'
run: cargo check -p dawn-rs --examples $CARGO_TARGET_ARGS
- name: Check dawn-wgpu examples (default)
if: runner.os != 'Windows'
run: cargo check -p dawn-wgpu --examples $CARGO_TARGET_ARGS