ci: Forgejo Actions workflows and make targets

- Add make fmt-check, go-ci, admin-ci and ci so CI and a local run do the same thing
- Add a ci workflow: Go (gofmt, vet, race tests) and the admin UI (tests, type check, build)
- Add a manual e2e workflow for runners that can run Docker
This commit is contained in:
tgiachi 2026-11-09 17:03:17 +01:00
commit 65528830d3
3 changed files with 53 additions and 1 deletions

View file

@ -0,0 +1,23 @@
# Runs on Forgejo Actions (Codeberg). Enable Actions in the repository settings and make sure
# a runner with the `docker` label is available; change `runs-on` if yours is named differently.
name: ci
on:
push:
branches: [main]
pull_request:
jobs:
go:
runs-on: docker
container: golang:1.27
steps:
- uses: actions/checkout@v4
- run: make go-ci
admin:
runs-on: docker
container: node:24
steps:
- uses: actions/checkout@v4
- run: make admin-ci

View file

@ -0,0 +1,16 @@
# The end-to-end test starts Postfix and parsimony in Docker, so it needs a runner that can run
# Docker itself. Start it by hand from the Actions tab (or run `make e2e` locally).
name: e2e
on:
workflow_dispatch:
jobs:
e2e:
runs-on: docker
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: make e2e

View file

@ -1,4 +1,4 @@
.PHONY: all admin test build e2e clean
.PHONY: all admin test build e2e clean fmt-check go-ci admin-ci ci
all: admin build
@ -13,6 +13,19 @@ test:
go test ./...
cd admin && npm test
# CI jobs. `make ci` runs them all locally, exactly as the workflow does.
fmt-check:
@unformatted="$$(gofmt -l .)"; if [ -n "$$unformatted" ]; then echo "gofmt needed:"; echo "$$unformatted"; exit 1; fi
go-ci: fmt-check
go vet ./...
go test -race -count=1 ./...
admin-ci:
cd admin && npm ci && npm test && npm run build
ci: go-ci admin-ci build
# End-to-end test: parsimony behind a real Postfix, both in Docker (needs a running Docker daemon).
# Set E2E_PARSIMONY_IMAGE to reuse an image instead of building one.
e2e: