Add formatting workflow with prettier and gofumpt v0.8.0
This commit adds a new GitHub workflow for code formatting that:
- Uses prettier to check JavaScript/TypeScript code formatting
- Uses gofumpt v0.8.0 to check Go code formatting
- Updates the queue workflow to run both UI tests and formatting checks
Co-Authored-By: sketch
diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml
new file mode 100644
index 0000000..ea50853
--- /dev/null
+++ b/.github/workflows/formatting.yml
@@ -0,0 +1,44 @@
+name: Code Formatting
+on:
+ workflow_call:
+ push:
+ branches-ignore:
+ - "queue-main-**"
+ pull_request:
+
+jobs:
+ formatting:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ # Setup for Prettier
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '20'
+ cache: 'npm'
+ cache-dependency-path: loop/webui/package-lock.json
+
+ - name: Install dependencies
+ working-directory: ./loop/webui
+ run: npm ci
+
+ - name: Check Prettier formatting
+ working-directory: ./loop/webui
+ run: npx prettier --check .
+
+ # Setup for gofumpt
+ - name: Setup Go
+ uses: actions/setup-go@v4
+ with:
+ go-version: stable
+ cache: true
+
+ - name: Install gofumpt v0.8.0
+ run: |
+ go install mvdan.cc/gofumpt@v0.8.0
+ echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
+
+ - name: Check Go formatting
+ run: gofumpt -l . | grep . && { echo "Go files need formatting"; exit 1; } || echo "Go formatting check passed"
diff --git a/.github/workflows/queue-main.yml b/.github/workflows/queue-main.yml
index ae0f0b1..120a684 100644
--- a/.github/workflows/queue-main.yml
+++ b/.github/workflows/queue-main.yml
@@ -16,13 +16,21 @@
permissions: read-all
jobs:
- test:
+ go-test:
uses: ./.github/workflows/go_test.yml
permissions: read-all
+ ui-test:
+ uses: ./.github/workflows/webui_test.yml
+ permissions: read-all
+
+ formatting:
+ uses: ./.github/workflows/formatting.yml
+ permissions: read-all
+
push-to-main:
runs-on: ubuntu-latest
- needs: [test]
+ needs: [go-test, ui-test, formatting]
permissions:
contents: write
steps: