From d272eb7cfe9bf08f1185336a0c385ecce9dd4822 Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Thu, 9 Jul 2026 18:03:04 +0100 Subject: [PATCH] ci: restructure Go gate into separate jobs, add knip and svelte strict check Go: go-build gates three parallel jobs (go-vet, golangci-lint, go-mod-tidy) which gate test+race. Frontend: add knip (between deps and QC) and svelte-check --fail-on-warnings (after build). QC now gates on build, knip, and svelte strict. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- .gitea/workflows/ci.yaml | 173 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 164 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index e2a484f..730a6a9 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -17,8 +17,42 @@ env: POSTGRES_DB: mydb jobs: - vet: - name: Go gate + go-build: + name: Go build + runs-on: ubuntu-latest + defaults: + run: + shell: sh + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: "1.26" + cache: false + + - name: Cache Go modules + uses: actions/cache@v4 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('backend/go.sum') }}-build + restore-keys: | + ${{ runner.os }}-go- + + - name: Fix node toolcache path for Post-step cleanup + run: | + mkdir -p /opt/hostedtoolcache/node/22.23.1/x64/bin + ln -sf /usr/local/bin/node /opt/hostedtoolcache/node/22.23.1/x64/bin/node + + - name: Build + run: go build ./... + working-directory: backend + + go-vet: + name: Go vet + needs: [go-build] runs-on: ubuntu-latest defaults: run: @@ -46,10 +80,6 @@ jobs: mkdir -p /opt/hostedtoolcache/node/22.23.1/x64/bin ln -sf /usr/local/bin/node /opt/hostedtoolcache/node/22.23.1/x64/bin/node - - name: Build - run: go build ./... - working-directory: backend - - name: Vet (dev tags) run: go vet -tags "test,dev" ./... working-directory: backend @@ -58,12 +88,72 @@ jobs: run: go vet -tags "test,!dev" ./... working-directory: backend + go-lint: + name: golangci-lint + needs: [go-build] + runs-on: ubuntu-latest + defaults: + run: + shell: sh + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: "1.26" + cache: false + + - name: Cache Go modules + uses: actions/cache@v4 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('backend/go.sum') }}-lint + restore-keys: | + ${{ runner.os }}-go- + + - name: Fix node toolcache path for Post-step cleanup + run: | + mkdir -p /opt/hostedtoolcache/node/22.23.1/x64/bin + ln -sf /usr/local/bin/node /opt/hostedtoolcache/node/22.23.1/x64/bin/node + - name: golangci-lint run: | go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest golangci-lint run ./... working-directory: backend + go-mod-tidy: + name: go mod tidy + needs: [go-build] + runs-on: ubuntu-latest + defaults: + run: + shell: sh + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: "1.26" + cache: false + + - name: Cache Go modules + uses: actions/cache@v4 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('backend/go.sum') }}-tidy + restore-keys: | + ${{ runner.os }}-go- + + - name: Fix node toolcache path for Post-step cleanup + run: | + mkdir -p /opt/hostedtoolcache/node/22.23.1/x64/bin + ln -sf /usr/local/bin/node /opt/hostedtoolcache/node/22.23.1/x64/bin/node + - name: go mod tidy check run: | cp go.sum go.sum.bak @@ -75,7 +165,7 @@ jobs: test: name: Tests (${{ matrix.label }}) - needs: [vet, vulns] + needs: [go-vet, go-lint, go-mod-tidy, vulns] runs-on: ubuntu-latest defaults: run: @@ -147,7 +237,7 @@ jobs: race: name: Race (${{ matrix.label }}) - needs: [vet, vulns] + needs: [go-vet, go-lint, go-mod-tidy, vulns] runs-on: ubuntu-latest defaults: run: @@ -340,6 +430,37 @@ jobs: console.log('All overrides appear necessary'); " + knip: + name: Knip + needs: [frontend-deps] + runs-on: ubuntu-latest + defaults: + run: + shell: sh + steps: + - uses: actions/checkout@v4 + + - name: Fix node toolcache path for Post-step cleanup + run: | + mkdir -p /opt/hostedtoolcache/node/22.23.1/x64/bin + ln -sf /usr/local/bin/node /opt/hostedtoolcache/node/22.23.1/x64/bin/node + + - name: Restore npm dependencies + uses: actions/cache@v4 + with: + path: | + ~/.npm + frontend/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('frontend/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install dependencies + run: cd frontend && npm ci + + - name: Run knip + run: cd frontend && npx knip + frontend-build: name: Frontend build runs-on: ubuntu-latest @@ -370,9 +491,43 @@ jobs: - name: Build run: cd frontend && npm run build + frontend-svelte-strict: + name: Svelte strict check + needs: [frontend-build] + runs-on: ubuntu-latest + defaults: + run: + shell: sh + steps: + - uses: actions/checkout@v4 + + - name: Fix node toolcache path for Post-step cleanup + run: | + mkdir -p /opt/hostedtoolcache/node/22.23.1/x64/bin + ln -sf /usr/local/bin/node /opt/hostedtoolcache/node/22.23.1/x64/bin/node + + - name: Restore npm dependencies + uses: actions/cache@v4 + with: + path: | + ~/.npm + frontend/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('frontend/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install dependencies + run: cd frontend && npm ci + + - name: svelte-kit sync + run: cd frontend && npx svelte-kit sync + + - name: svelte-check (fail on warnings) + run: cd frontend && npx svelte-check --tsconfig ./tsconfig.json --fail-on-warnings + frontend-qc: name: Frontend QC (${{ matrix.task }}) - needs: [frontend-deps, frontend-build] + needs: [frontend-build, knip, frontend-svelte-strict] runs-on: ubuntu-latest defaults: run: