-
-
Notifications
You must be signed in to change notification settings - Fork 657
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
autofix.ci
to address formatting issues and possible clip…
…py fixes (#3235) * feat: add `autofix.ci` to address formatting issues and possible clippy fixes * fix: initial run of `autofix.ci` script to prevent PR pollution at first run * fix: typo and indent issue in `autofix.yml` * fix: run `autofix.ci` over members with no features
- Loading branch information
Showing
11 changed files
with
71 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: autofix.ci | ||
on: | ||
workflow_call: | ||
pull_request: | ||
push: | ||
branches: ["main"] | ||
permissions: | ||
contents: read | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
env: | ||
CARGO_TERM_COLOR: always | ||
RUST_BACKTRACE: 1 | ||
jobs: | ||
autofix: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: {toolchain: nightly, components: "rustfmt, clippy", target: "wasm32-unknown-unknown", rustflags: ""} | ||
- name: Install jq | ||
run: sudo apt-get install jq | ||
- run: | | ||
echo "Formatting the workspace" | ||
cargo fmt --all | ||
echo "Running Clippy against each member's features (default features included)" | ||
for member in $(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | .name'); do | ||
echo "Working on member $member": | ||
echo -e "\tdefault-features/no-features:" | ||
# this will also run on members with no features or default features | ||
cargo clippy --allow-dirty --fix --lib --package "$member" | ||
features=$(cargo metadata --no-deps --format-version 1 | jq -r ".packages[] | select(.name == \"$member\") | .features | keys[]") | ||
for feature in $features; do | ||
if [ "$feature" = "default" ]; then | ||
continue | ||
fi | ||
echo -e "\tfeature $feature" | ||
cargo clippy --allow-dirty --fix --lib --package "$member" --features "$feature" | ||
done | ||
done | ||
- uses: autofix-ci/action@v1.3.1 | ||
if: ${{ always() }} | ||
with: | ||
fail-fast: false |
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
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