From ec577d5cbef4e7c7d24983d1633313ff8a714402 Mon Sep 17 00:00:00 2001 From: Jonas Plum Date: Sun, 5 Nov 2023 11:10:40 +0100 Subject: [PATCH] ci: ensure fmt (#282) --- .github/workflows/ci.yml | 29 +++++++++++++++++++++++------ README.md | 9 +++++---- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9df574e2..f3c270b6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,9 +10,9 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v22 + - uses: cachix/install-nix-action@v23 with: github_access_token: ${{ secrets.GITHUB_TOKEN }} @@ -40,9 +40,9 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v22 + - uses: cachix/install-nix-action@v23 with: github_access_token: ${{ secrets.GITHUB_TOKEN }} @@ -54,9 +54,9 @@ jobs: ensure-generated: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v22 + - uses: cachix/install-nix-action@v23 with: github_access_token: ${{ secrets.GITHUB_TOKEN }} @@ -67,3 +67,20 @@ jobs: - name: Ensure clean run: git diff --exit-code + + ensure-fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: cachix/install-nix-action@v23 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + + - uses: DeterminateSystems/magic-nix-cache-action@v2 + + - name: Fmt + run: nix develop --command xc fmt + + - name: Ensure clean + run: git diff --exit-code diff --git a/README.md b/README.md index fbc78f637..102fbe792 100644 --- a/README.md +++ b/README.md @@ -96,10 +96,11 @@ go run ./cmd/templ generate -include-version=false && go test ./... -bench=. -be ### fmt -Format all Go code. +Format all Go and templ code. -``` +```sh gofmt -s -w . +go run ./cmd/templ fmt . ``` ### lint @@ -124,7 +125,7 @@ Run the development server. Directory: docs -``` +```sh npm run start ``` @@ -134,7 +135,7 @@ Build production docs site. Directory: docs -``` +```sh npm run build ```