Skip to content

Commit

Permalink
Test unused_crate_dependencies in CI
Browse files Browse the repository at this point in the history
To make sure we don't have any unnecessary dependencies in Cargo.toml,
this commit adds a command line that checks with the
unused_crate_dependencies lint.

This commit also adds command lines that build with all combinations of
features to catch possible build errors that do not happen with the
check command.

Some test commands are removed from check-extra.sh because they are
already run in check.sh.
magicant committed Jan 25, 2024

Partially verified

This commit is signed with the committer’s verified signature.
spydon’s contribution has been verified via GPG key.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
1 parent a571e5c commit b131cc8
Showing 2 changed files with 24 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -19,8 +19,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build
- name: Run basic tests
run: ./check.sh -v
clippy:
33 changes: 24 additions & 9 deletions check-extra.sh
Original file line number Diff line number Diff line change
@@ -4,8 +4,6 @@ if [ "$*" = "" ]; then quiet='--quiet'; else quiet=''; fi

set -x

cargo check

cargo tomlfmt --dryrun --path Cargo.toml
cargo tomlfmt --dryrun --path yash/Cargo.toml
cargo tomlfmt --dryrun --path yash-arith/Cargo.toml
@@ -16,12 +14,29 @@ cargo tomlfmt --dryrun --path yash-quote/Cargo.toml
cargo tomlfmt --dryrun --path yash-semantics/Cargo.toml
cargo tomlfmt --dryrun --path yash-syntax/Cargo.toml

cargo test --package 'yash-arith' -- $quiet
cargo test --package 'yash-builtin' -- $quiet
# Make sure we don't have any unnecessary dependencies in Cargo.toml.
RUSTFLAGS='-D unused_crate_dependencies' cargo check --lib --all-features

# Make sure the crates can be built with all combinations of features.
cargo build --package 'yash' --all-targets
cargo build --package 'yash-arith' --all-targets
cargo build --package 'yash-builtin' --all-targets
cargo build --package 'yash-builtin' --all-targets --no-default-features
cargo build --package 'yash-env' --all-targets
cargo build --package 'yash-fnmatch' --all-targets
cargo build --package 'yash-quote' --all-targets
cargo build --package 'yash-semantics' --all-targets
cargo build --package 'yash-syntax' --all-targets
cargo build --package 'yash-syntax' --all-targets --features annotate-snippets

# Test with non-default feature configurations.
#cargo test --package 'yash' -- $quiet
#cargo test --package 'yash-arith' -- $quiet
#cargo test --package 'yash-builtin' -- $quiet
cargo test --package 'yash-builtin' --no-default-features -- $quiet
cargo test --package 'yash-env' -- $quiet
cargo test --package 'yash-fnmatch' -- $quiet
cargo test --package 'yash-quote' -- $quiet
cargo test --package 'yash-semantics' -- $quiet
cargo test --package 'yash-syntax' -- $quiet
#cargo test --package 'yash-env' -- $quiet
#cargo test --package 'yash-fnmatch' -- $quiet
#cargo test --package 'yash-quote' -- $quiet
#cargo test --package 'yash-semantics' -- $quiet
#cargo test --package 'yash-syntax' -- $quiet
cargo test --package 'yash-syntax' --features annotate-snippets -- $quiet

0 comments on commit b131cc8

Please sign in to comment.