-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(deps): Remove unused dependencies, and check for them in CI (#6216)
* Remove unused dependencies * Check for newly unused dependencies in CI * Use the correct grep command * Always show cargo machete output * Ignore cargo machete exit status, use grep instead * Use if instead of && and subshells * Invert if logic
- Loading branch information
Showing
8 changed files
with
45 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -279,3 +279,40 @@ jobs: | |
with: | ||
command: check ${{ matrix.checks }} | ||
arguments: --workspace ${{ matrix.features }} | ||
|
||
unused-deps: | ||
name: Check for unused dependencies | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout git repository | ||
uses: actions/[email protected] | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
|
||
- name: Install cargo-machete | ||
uses: baptiste0928/cargo-install@v1 | ||
with: | ||
crate: cargo-machete | ||
|
||
- name: Check unused dependencies | ||
# Exclude macro and transitive dependencies by filtering them out of the output, | ||
# then if there are any more unused dependencies, fail the job. | ||
run: | | ||
echo "-- full cargo machete output, including ignored dependencies --" | ||
cargo machete --skip-target-dir || true | ||
echo "-- unused dependencies are below this line, full output is above --" | ||
if (cargo machete --skip-target-dir 2>/dev/null || true) | \ | ||
grep -v -e gumdrop -e humantime-serde -e tinyvec -e "found the following" -e Cargo.toml -e Done; then | ||
echo "New unused dependencies were found, please remove them!" | ||
exit 1 | ||
else | ||
echo "No unused dependencies found." | ||
fi |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters