diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f63b2a3..e9ecfa9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -8,6 +8,30 @@ concurrency: cancel-in-progress: true jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Install nix + uses: DeterminateSystems/nix-installer-action@main + + - name: Setup Nix cache + uses: nix-community/cache-nix-action@main + with: + primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} + restore-prefixes-first-match: nix-${{ runner.os }}- + + - name: Check formatting + run: nix develop -c cargo fmt --check + + - name: Clippy + run: nix develop -c cargo clippy + test: name: Run Tests runs-on: ubuntu-latest @@ -33,7 +57,9 @@ jobs: deploy: name: Deploy to Fly.io runs-on: ubuntu-latest - needs: [test] + needs: + - lint + - test steps: - name: Checkout uses: actions/checkout@v6 diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 2536140..a46527a 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -8,6 +8,30 @@ concurrency: cancel-in-progress: true jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Install nix + uses: DeterminateSystems/nix-installer-action@main + + - name: Setup Nix cache + uses: nix-community/cache-nix-action@main + with: + primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} + restore-prefixes-first-match: nix-${{ runner.os }}- + + - name: Check formatting + run: nix develop -c cargo fmt --check + + - name: Clippy + run: nix develop -c cargo clippy + test: name: Run Tests runs-on: ubuntu-latest