Skip to content

Commit

Permalink
ci: add custom lint for spirv-std building with -Z minimal-versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Apr 26, 2023
1 parent 9cc2072 commit 867c54b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,29 @@ if (
echo
exit 1
fi

# 2. Ensure `spirv-std` & helper crates have necessary dependency versions
# listed in their `Cargo.toml` files, by using `cargo -Z minimal-versions`.
echo ::group::'Testing dependency versions with `cargo -Z minimal-versions`'

function version_test() {
local crate_path="$1"
local crate_name="$(basename "$crate_path")"
local test_dir="$(mktemp -d --tmpdir "version-test-$crate_name-XXXXXXXXXX")"
local test_cargoflags=(
-Z minimal-versions
--manifest-path "$test_dir/Cargo.toml"
)

echo ::group::"$crate_name (via $test_dir)"
cargo init --lib --vcs none "$test_dir"
cargo add "${test_cargoflags[@]}" --path "$crate_path"
cargo clippy "${test_cargoflags[@]}" -- -D warnings
rm -r "$test_dir"
echo ::endgroup::
}
# FIXME(eddyb) try to get this working for `spirv-builder`, which has a larger
# dependency graph, with too much imprecision in upstream `Cargo.toml` files.
version_test crates/spirv-std

echo ::endgroup::

0 comments on commit 867c54b

Please sign in to comment.