hako/scripts/e2e.sh
Felipe M. 291aed39f1
Some checks failed
CI / goreleaser-lint (push) Successful in 7s
CI / format (push) Successful in 50s
CI / lint (push) Failing after 4m12s
CI / test (push) Successful in 5m33s
CI / build (push) Successful in 6m15s
CI / e2e (push) Successful in 35m20s
ci: migrate from Woodpecker CI to Forgejo Actions (#1)
Replace the Woodpecker pipelines with Actions workflows under `.github/workflows`, matching the conventions the other migrated repositories now use (butterrobot, smtp2shoutrrr, terraria-companion, dharma).

## Workflows

- Jobs run on `ubuntu-latest`, answered with the catthehacker act image — no `ci-base` container.
- Short `uses:` resolves against github.com, so every action carries its real name: `goreleaser/goreleaser-action`, `oven-sh/setup-bun`, `docker/setup-qemu-action`, `docker/setup-buildx-action`.
- The act image carries none of the tooling `ci-base` provided, so each job installs what it calls: `make` everywhere, `build-essential` for the CGO test job, `upx-ucl` for goreleaser's `upx` block, bun for the webapp build, goreleaser itself for `make build`.
- `e2e` gets a Docker-in-Docker service so testcontainers can resolve its mapped ports from inside the job container; Playwright installs with `--with-deps` now that the job has sudo.

## Supporting changes

- `Makefile` drops unused variables and adopts a self-documenting `help` target.
- `.goreleaser.yml` keeps `dockers_v2` for the multi-platform image.
- `Containerfile` moves to Alpine 3.23; nfpm description fixed.
- e2e: shared Docker network so link creation reaches the test web server, `mattn/go-sqlite3` added to the e2e module, `all:dist` embed directive so dot-files ship in the webapp bundle.

Reviewed-on: #1
2026-09-22 17:33:29 +02:00

37 lines
1.1 KiB
Shell
Executable file

#!/usr/bin/env bash
set -e
echo "🧪 Running Hako E2E Tests"
# Environment setup
export TESTCONTAINERS_RYUK_DISABLED="${TESTCONTAINERS_RYUK_DISABLED:-true}"
export DOCKER_HOST="${DOCKER_HOST:-unix:///var/run/docker.sock}"
# Check Docker
if ! docker info > /dev/null 2>&1; then
echo "❌ Error: Docker is not available (check DOCKER_HOST and socket mount)"
exit 1
fi
# Install Playwright if needed, pinned to the module the tests link against
PLAYWRIGHT_MODULE="github.com/mxschmitt/playwright-go"
PLAYWRIGHT_VERSION="$(cd e2e && go list -m -f '{{.Version}}' "$PLAYWRIGHT_MODULE")"
PLAYWRIGHT_CMD="$PLAYWRIGHT_MODULE/cmd/playwright@$PLAYWRIGHT_VERSION"
if ! go run "$PLAYWRIGHT_CMD" --help > /dev/null 2>&1; then
echo "📦 Installing Playwright browsers..."
(cd e2e && go run "$PLAYWRIGHT_CMD" install chromium)
fi
# Build webapp (required for embed)
echo "🏗️ Building webapp..."
make build-webapp
# Create screenshots directory
mkdir -p e2e/screenshots
# Run tests
echo "🚀 Running e2e tests..."
cd e2e && CGO_ENABLED=0 go test -v -timeout=60m ./...
echo "✅ E2E tests completed"