Ci: Add check for unused dependencies #348
Workflow file for this run
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
name: CI | |
permissions: | |
contents: write | |
defaults: | |
run: | |
shell: nix develop --command bash {0} | |
on: | |
pull_request: | |
branches: [ "main" ] | |
types: [opened, synchronize, reopened, ready_for_review] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
formatting: | |
name: Format code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: eneoli/flakeshot@github-actions-v1 | |
- name: Check formatting | |
if: github.event.pull_request.head.repo.full_name != github.repository | |
run: cargo fmt --check --verbose | |
- name: Format code | |
id: format_code | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
run: | | |
cargo fmt --verbose | |
echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT | |
- name: Committing reformatted code | |
if: | | |
steps.format_code.outputs.modified == 'true' && | |
github.event.pull_request.head.repo.full_name == github.repository | |
run: | | |
git config --global user.name 'Github Actions' | |
git config --global user.email '<>' | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
git commit -am "Automated formatting" | |
git push | |
check: | |
name: check code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: eneoli/flakeshot@github-actions-v1 | |
- name: Check for build errors | |
run: cargo check --verbose | |
clippy: | |
name: Is clippy happy? | |
runs-on: ubuntu-latest | |
steps: | |
- uses: eneoli/flakeshot@github-actions-v1 | |
- name: Check best practices (Clippy) | |
run: cargo clippy --verbose -- -Dwarnings | |
tests: | |
name: tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: eneoli/flakeshot@github-actions-v1 | |
- name: Running tests | |
run: cargo test --verbose | |
unused-dep: | |
name: check for unused dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- uses: eneoli/flakeshot@github-actions-v1 | |
- name: cargo udeps | |
run: cargo udeps --verbose |