* Move the e2e suite to Go and playwright-go The seven playwright tests in `frontend/e2e` become twenty in `e2e/`, a separate Go module driving the same browsers through playwright-go. The npm project, its lockfile entries, its prettier config and `Dockerfile.e2e` go with it, leaving `frontend/` a single-member workspace. The suite covers posting with markdown, replying and the nesting that implies, editing inside the deadline and the backend refusing one outside it, deleting, voting with the optimistic score observed mid-flight and rolled back on failure, changing the sort, collapse persistence across a reload, dev, anonymous and email sign-in end to end, the profile iframe, and the two scripts that render into the host page rather than the widget's own frame. The rendering tests run in chromium, firefox and webkit. The rest sign in, sign-in needs the dev oauth2 provider, and reaching that by name from the host is chromium-only, so they run there alone. `compose-e2e-test.yml` runs remark42, a second instance with a short edit window so that path does not need a five-minute test, and mailpit, which catches the email verification message the suite reads back. Everything binds to the loopback interface: the stack holds a known secret and an admin shared id, and `go test` can start it unattended. The tests run on the host rather than in a container. Three settings there exist for the tests rather than for realism. `REMARK_URL` uses a hostname because the dev oauth2 server binds whatever host it reads out of it, and a loopback bind inside a container cannot be published. `UPDATE_LIMIT` is raised because the default of 0.5/sec rejects any test posting twice in a row. The suite also paces its own `/auth/` calls, which are capped at 2/sec by a bare literal in `rest.go` rather than by a setting. Each test gets its own comment thread from a query string on the demo page, so nothing has to reset the database between runs. CI gains a vet and lint job for the module, since the build tag keeps it out of a plain `go test ./...`, and uploads a browser trace for any test that fails. `e2e/README.md` carries the rest: how to run it, what the stack is for, and the widget behaviour the assertions have to work around. * Update golangci-lint to 2.13.1 in the backend workflow The pin sat three minors behind what the linter installs locally, so CI checked the backend with an older set of rules than anyone running it by hand. 2.10.1 also fetches its config schema over the network on every `config verify`, which is a failure mode with no bearing on the code. Both targets are clean on 2.13.1, `backend/app` and the memory_store example.
57 lines
2.0 KiB
Makefile
57 lines
2.0 KiB
Makefile
OS=linux
|
|
ARCH=amd64
|
|
GITHUB_REF=$(shell git rev-parse --symbolic-full-name HEAD)
|
|
GITHUB_SHA=$(shell git rev-parse --short HEAD)
|
|
CLEANUP_RELEASE_ASSETS=$(CURDIR)/scripts/cleanup-release-assets.sh
|
|
|
|
bin:
|
|
@set -e; \
|
|
./scripts/prepare-release-assets.sh; \
|
|
trap '$(CLEANUP_RELEASE_ASSETS)' EXIT; \
|
|
cd backend && CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o ../remark42 -ldflags "-X main.revision=$(GITHUB_REF)-$(GITHUB_SHA) -s -w" ./app
|
|
|
|
docker:
|
|
DOCKER_BUILDKIT=1 docker build -t umputun/remark42 -t ghcr.io/umputun/remark42 --build-arg GITHUB_REF=$(GITHUB_REF) --build-arg GITHUB_SHA=$(GITHUB_SHA) \
|
|
--build-arg CI=true --build-arg SKIP_FRONTEND_TEST=true --build-arg SKIP_BACKEND_TEST=true .
|
|
|
|
dockerx:
|
|
docker buildx build --build-arg GITHUB_REF=$(GITHUB_REF) --build-arg GITHUB_SHA=$(GITHUB_SHA) --build-arg CI=true \
|
|
--build-arg SKIP_FRONTEND_TEST=true --build-arg SKIP_BACKEND_TEST=true \
|
|
--progress=plain --platform linux/amd64,linux/arm64 \
|
|
-t ghcr.io/umputun/remark42:master -t umputun/remark42:master .
|
|
|
|
release:
|
|
@set -e; \
|
|
trap '$(CLEANUP_RELEASE_ASSETS)' EXIT; \
|
|
goreleaser release --snapshot --clean --skip=publish
|
|
|
|
race_test:
|
|
cd backend/app && go test -race -timeout=60s -count 1 ./...
|
|
|
|
backend:
|
|
docker compose -f compose-dev-backend.yml build
|
|
|
|
frontend:
|
|
docker compose -f compose-dev-frontend.yml build
|
|
|
|
rundev:
|
|
SKIP_BACKEND_TEST=true SKIP_FRONTEND_TEST=true GITHUB_REF=$(GITHUB_REF) GITHUB_SHA=$(GITHUB_SHA) CI=true \
|
|
docker compose -f compose-private.yml build
|
|
docker compose -f compose-private.yml up
|
|
|
|
e2e-up:
|
|
docker compose -f compose-e2e-test.yml up -d --build --quiet-pull --wait
|
|
|
|
e2e-down:
|
|
docker compose -f compose-e2e-test.yml down -v
|
|
|
|
# the suite brings the stack up itself when it finds none, so e2e-up is only worth running
|
|
# to keep the containers between invocations
|
|
e2e:
|
|
cd e2e && go test -tags=e2e -count 1 -timeout 20m ./...
|
|
|
|
e2e-ui:
|
|
cd e2e && E2E_HEADLESS=false E2E_KEEP=1 go test -tags=e2e -count 1 -v -timeout 20m ./...
|
|
|
|
.PHONY: bin docker dockerx release race_test backend frontend rundev e2e e2e-up e2e-down e2e-ui
|