Skip to content

adding default rustfmt.toml file #32

adding default rustfmt.toml file

adding default rustfmt.toml file #32

Workflow file for this run

name: CI
permissions:
contents: write
# Use our Nix Flake Environment for steps
defaults:
run:
shell: nix develop --command bash {0}
on:
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
check:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- 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
- name: Check best practices (Clippy)
run: cargo clippy --verbose
- name: Check for build errors
run: cargo check --verbose
- name: Running tests
run: cargo test --verbose