Refactor codec structure organization #53
Workflow file for this run
This file contains hidden or 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
| on: | |
| pull_request: | |
| paths: | |
| - '**.rs' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| name: Linter and Formatter | |
| jobs: | |
| format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install Rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| components: rustfmt | |
| - name: Run cargo fmt | |
| run: cargo fmt --all -- --check | |
| - name: Check for formatting differences | |
| id: fmt-check | |
| run: | | |
| if ! cargo fmt --all -- --check; then | |
| echo "Formatting differences found" | |
| cargo fmt --all | |
| echo "needs_commit=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "No formatting differences" | |
| echo "needs_commit=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and push formatting changes | |
| if: steps.fmt-check.outputs.needs_commit == 'true' | |
| run: | | |
| git config --local user.name 'github-actions[bot]' | |
| git config --local user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add . | |
| git commit -m "Apply rustfmt changes" | |
| git push | |
| clippy: | |
| name: Clippy | |
| env: | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_TERM_COLOR: always | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| override: true | |
| components: clippy | |
| - uses: actions-rs/cargo@v1 | |
| with: | |
| command: clippy | |
| args: --all-targets -- -D warnings |