chore: add linting scripts for frontend, backend, and worker, and create a Gitea workflow for automated linting on push and pull request events

This commit is contained in:
keven1024
2025-12-14 20:10:52 +08:00
parent 552434e389
commit 04ebb22d35
2 changed files with 70 additions and 1 deletions

View File

@@ -0,0 +1,66 @@
name: Lint
on:
push:
branches:
- 'dev'
pull_request:
jobs:
lint-front:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install front dependencies
run: |
corepack enable
corepack use pnpm@latest
pnpm i
- name: Run frontend lint
run: pnpm lint:front
lint-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Install golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
- name: Run backend lint
run: cd backend && golangci-lint run
lint-worker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Install golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
- name: Run worker lint
run: cd worker && golangci-lint run

View File

@@ -8,7 +8,10 @@
"dev:front": "cd front && pnpm run dev",
"dev:backend": "cd backend && air",
"dev:worker": "cd worker && air",
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "concurrently -n front,backend,worker -c blue,green,yellow 'pnpm:lint:front' 'pnpm:lint:backend' 'pnpm:lint:worker'",
"lint:front": "cd front && pnpm nuxt typecheck",
"lint:backend": "cd backend && golangci-lint run",
"lint:worker": "cd worker && golangci-lint run",
"prepare": "husky"
},
"workspaces": [