Skip to content

dylib and minor

dylib and minor #49

Workflow file for this run

on:
push:
branches:
- main
pull_request:
merge_group:
workflow_dispatch:
name: CI
# Cancel PR actions on new commits
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
name: test
strategy:
fail-fast: false
matrix:
os: [ ubuntu-24.04, windows-2022, macOS-latest ]
integration: [ "cargo-gpu", "spirv-builder" ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: install nextest
uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Install Vulkan SDK
uses: jakoch/install-vulkan-sdk-action@v1
with:
vulkan_version: 1.4.321.0
install_runtime: true
cache: true
stripdown: true
# FIXME(eddyb) consider using lavapipe instead, or even trying both.
install_swiftshader: true
# install_lavapipe: true
- if: ${{ runner.os == 'Linux' }}
name: Linux - Install native dependencies
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
- if: ${{ runner.os == 'Windows' && matrix.integration == 'spirv-builder' }}
name: Windows - set rustflags to make it compile
run: echo "RUSTFLAGS=-Zshare-generics=off" >> "$GITHUB_ENV"
# just need a random command that forces the installation of rust-toolchain
# figure out native target triple while we're at it
- name: install rust-toolchain
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
- name: cargo fetch --locked
run: cargo fetch --locked --target $TARGET
- if: ${{ matrix.integration == 'cargo-gpu' }}
name: template build
run: cargo build --workspace --exclude xtask
- if: ${{ matrix.integration == 'cargo-gpu' }}
name: template test
run: cargo nextest run --workspace --exclude xtask --no-tests warn
- name: xtask build
run: cargo build -p xtask
- name: xtask generate
# generate all variants
# If this fails, the files committed don't match what should have been generated.
# Since `--clean` deletes `generated/`, any additional files in git are marked as removed.
run: cargo xtask generate --clean
- name: check generated files are up-to-date
run: |
git add .
git diff --cached
git diff --quiet && git diff --cached --quiet
# no --locked, templates need to generate their lockfile
- name: cargo fetch
run: cargo xtask generate ${{ matrix.integration }} -x "cargo fetch --target $TARGET"
- name: cargo build
run: cargo xtask generate ${{ matrix.integration }} -x "cargo build"
# graphics templates have no tests by default
- name: cargo test
run: cargo xtask generate ${{ matrix.integration }} -x "cargo nextest run --no-tests warn"
# This allows us to have a single job we can branch protect on, rather than needing
# to update the branch protection rules when the test matrix changes
test_success:
runs-on: ubuntu-24.04
needs: [test, template-test, lint]
# Hack for buggy GitHub Actions behavior with skipped checks: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
if: ${{ always() }}
steps:
# Another hack is to actually check the status of the dependencies or else it'll fall through
- run: |
echo "Checking statuses..."
[[ "${{ needs.test.result }}" == "success" ]] || exit 1
[[ "${{ needs.template-test.result }}" == "success" ]] || exit 1
[[ "${{ needs.lint.result }}" == "success" ]] || exit 1
template-test:
name: xtask test & lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: install nextest
uses: taiki-e/install-action@v2
with:
tool: nextest
- if: ${{ runner.os == 'Linux' }}
name: Linux - Install native dependencies
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
# just need a random command that forces the installation of rust-toolchain
# figure out native target triple while we're at it
- name: install rust-toolchain
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
- name: Install rustup components
run: rustup component add rustfmt clippy
# no --target since lint needs all targets
- name: cargo fetch --locked
run: cargo fetch --locked
- name: xtask cargo test
run: cargo nextest run -p xtask
- name: cargo fmt
run: cargo fmt --all -- --check
- name: cargo clippy
run: cargo clippy --all-targets -- -D warnings
lint:
name: lint
strategy:
fail-fast: false
matrix:
integration: [ "cargo-gpu", "spirv-builder" ]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- if: ${{ runner.os == 'Linux' }}
name: Linux - Install native dependencies
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
# just need a random command that forces the installation of rust-toolchain
# figure out native target triple while we're at it
- name: install rust-toolchain
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
- name: Install rustup components
run: rustup component add rustfmt clippy
# no --target since lint needs all targets
- name: cargo fetch --locked
run: cargo fetch --locked
- name: xtask build
run: cargo build -p xtask
- name: xtask generate
run: cargo xtask generate ${{ matrix.integration }}
# no --locked, templates need to generate their lockfile
- name: cargo fetch
run: cargo xtask generate ${{ matrix.integration }} -x "cargo fetch"
- name: cargo fmt
run: cargo xtask generate ${{ matrix.integration }} -x "cargo fmt --all -- --check"
- name: cargo clippy
run: cargo xtask generate ${{ matrix.integration }} -x "cargo clippy --all-targets -- -D warnings"
defaults:
run:
shell: bash