80868e0f7a
Adopt the proven notify-bridge pipeline pattern and fix deployment bugs. Workflows: - build.yml: split into parallel frontend / backend / build-image jobs. Run svelte-check + vitest + `go vet ./...` + `go test ./internal/...` (tests were never executed in CI). Use buildx with GHA layer cache and pin Go to 1.25. Quote the `if:` skip-guard so it is valid YAML. - release.yml: gate the release on a passing test job, then build & push the image, then create the Gitea release LAST so a failed image build can no longer leave an orphan release. Use buildx + registry buildcache, a hard registry login (a push failure now fails the release), and auto-generate a changelog between tags. Docker: - Dockerfile: pin golang to 1.25 (matches go.mod's `go 1.25.0`), add BuildKit cache mounts for the module + build caches, an OCI source label, VOLUME /app/data, and a HEALTHCHECK on /readyz. - docker-compose.yml: fix the healthcheck — it targeted POST-only /api/auth/login (405 -> always unhealthy); now /readyz. Point the image name at the Gitea registry tag with build-from-source as the default. - .dockerignore: exclude ~95 MB of stray binaries, logs, env, and CI/doc files from the build context.
75 lines
1.8 KiB
YAML
75 lines
1.8 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
frontend:
|
|
# Skip the build on release-bump commits — the tag push runs release.yml.
|
|
if: "${{ !startsWith(gitea.event.head_commit.message, 'chore: release v') }}"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: npm
|
|
cache-dependency-path: web/package-lock.json
|
|
|
|
- name: Install frontend dependencies
|
|
working-directory: web
|
|
run: npm ci --no-audit
|
|
|
|
- name: Svelte check
|
|
working-directory: web
|
|
run: npm run check
|
|
|
|
- name: Unit tests (vitest)
|
|
working-directory: web
|
|
run: npm run test
|
|
|
|
- name: Build frontend
|
|
working-directory: web
|
|
run: npm run build
|
|
|
|
backend:
|
|
if: "${{ !startsWith(gitea.event.head_commit.message, 'chore: release v') }}"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.25'
|
|
cache-dependency-path: go.sum
|
|
|
|
- name: Vet Go code
|
|
run: go vet ./...
|
|
|
|
- name: Run Go tests
|
|
run: go test ./internal/... -count=1
|
|
|
|
build-image:
|
|
if: "${{ !startsWith(gitea.event.head_commit.message, 'chore: release v') }}"
|
|
needs: [frontend, backend]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build Docker image (no push)
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: false
|
|
tags: tinyforge:ci-${{ gitea.sha }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|