ash/.github/workflows/ci.yml
Marijn Suijten b50a253be7
generator: Run rustfmt over generated output before writing to disk (#735)
Some users are confused by seeing wildly different output after running
the generator, which is simply solved by running `rustfmt`.  As this is
both confusing and "somewhat" slow, invoke `rustfmt` directly within the
generator by piping string contents through it before redirecting to
disk.  This not only makes the output consistent, it is the fastest way
to reformat generator changes by omitting the round-trip to disk
entirely, nor having `rustfmt` recursively go through the workspace and
all files (including those that are not generated).

On a many-core machine these times are a bit skewed, but I want to
include them to prove the "speed" point nevertheless, even if simplicity
and consistency is the main reason to make this change:

Before:

    time ./target/debug/generator && time cargo fmt --all
    ./target/debug/generator  3.51s user 1.25s system 99% cpu 4.769 total
    cargo fmt --all  0.79s user 0.06s system 99% cpu 0.853 total

After:

    time ./target/debug/generator
    ./target/debug/generator  4.51s user 0.41s system 99% cpu 4.931 total
2023-04-08 22:02:30 +02:00

84 lines
2.4 KiB
YAML

on: [push, pull_request]
name: CI
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: cargo check --workspace --all-targets --all-features
check_msrv:
name: Check ash MSRV (1.59.0)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: dtolnay/rust-toolchain@1.59.0
- run: cargo check -p ash --all-features
check_ash_window_msrv:
name: Check ash-window MSRV (1.64.0)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: dtolnay/rust-toolchain@1.64.0
- run: cargo check -p ash-window -p examples --all-features
generated:
name: Generated
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Run generator
run: cargo run -p generator
- name: Diff autogen result
run: git diff --quiet || (echo "::error::Generated files are different, please regenerate with cargo run -p generator!"; git diff; false)
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Install Vulkan loader
run: sudo apt-get install libvulkan-dev
- uses: actions/checkout@v1
- name: Test all targets
run: cargo test --workspace --all-targets
- name: Test docs
run: cargo test --workspace --doc
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Clippy lint without features
# Only test the core ash and ash-window crate, where features reside.
# The examples crate would otherwise enable all default features again,
# making this test moot.
run: cargo clippy -p ash -p ash-window --no-default-features -- -D warnings
- name: Clippy lint with all features
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Clippy lint with default features
run: cargo clippy --workspace --all-targets -- -D warnings
docs:
name: Build-test docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Document all crates
env:
RUSTDOCFLAGS: -Dwarnings
run: cargo doc --all --all-features --no-deps --document-private-items