thavlik / vpn-operator

Kubernetes VPN operator in rust
https://vpn.beebs.dev
Apache License 2.0
6 stars 2 forks source link

Check formatting with rustfmt GitHub action #3

Closed thavlik closed 9 months ago

thavlik commented 9 months ago

Implement a GitHub Action that verifies consistent formatting with rustfmt.

thavlik commented 9 months ago

@patsevanton This ended up being simpler than expected. For reference, all this required was adding the workflow file .github/workflows/rustfmt.yml, and GitHub does the rest:

name: Check formatting with rustfmt
run-name: Ensure rustfmt check passes
on: [push]
jobs:
  Check-Formatting:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Install rustfmt
        run: sudo apt-get update && sudo apt-get install -y rustfmt
      - name: Check vpn-types subcrate formatting
        run: rustfmt --edition 2021 --check $GITHUB_WORKSPACE/types/src/lib.rs
      - name: Check vpn-operator subcrate formatting
        run: rustfmt --edition 2021 --check $GITHUB_WORKSPACE/operator/src/main.rs