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
70 lines
2.1 KiB
Go
70 lines
2.1 KiB
Go
package e2eutil
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"path/filepath"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/testcontainers/testcontainers-go"
|
|
"github.com/testcontainers/testcontainers-go/wait"
|
|
)
|
|
|
|
// StartTestWebServer starts an nginx container with test content for E2E testing.
|
|
// The container is attached to the shared network with the testServerAlias hostname,
|
|
// and the returned URL uses that alias so the Hako container can fetch from it.
|
|
func StartTestWebServer(ctx context.Context, t *testing.T) (testcontainers.Container, string, error) {
|
|
t.Helper()
|
|
|
|
// Get the project root (one level up from e2e)
|
|
projectRoot, err := filepath.Abs(filepath.Join("..", ".."))
|
|
if err != nil {
|
|
return nil, "", fmt.Errorf("failed to get project root: %w", err)
|
|
}
|
|
|
|
// Ensure shared network exists so Hako can reach this server by alias.
|
|
nw, err := getSharedNetwork(ctx)
|
|
if err != nil {
|
|
return nil, "", err
|
|
}
|
|
|
|
// Create container request attached to the shared network.
|
|
req := testcontainers.ContainerRequest{
|
|
FromDockerfile: testcontainers.FromDockerfile{
|
|
Context: filepath.Join(projectRoot, "e2e", "testserver"),
|
|
Dockerfile: "Dockerfile",
|
|
PrintBuildLog: false,
|
|
},
|
|
ExposedPorts: []string{"80/tcp"},
|
|
WaitingFor: wait.ForHTTP("/").WithStartupTimeout(10 * time.Second),
|
|
Networks: []string{nw.Name},
|
|
NetworkAliases: map[string][]string{
|
|
nw.Name: {testServerAlias},
|
|
},
|
|
}
|
|
|
|
// Start container
|
|
t.Log("Starting test web server container...")
|
|
container, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
|
|
ContainerRequest: req,
|
|
Started: true,
|
|
})
|
|
if err != nil {
|
|
return nil, "", fmt.Errorf("failed to start test web server container: %w", err)
|
|
}
|
|
|
|
// Register cleanup
|
|
t.Cleanup(func() {
|
|
if err := container.Terminate(ctx); err != nil {
|
|
t.Logf("Failed to terminate test web server container: %v", err)
|
|
}
|
|
})
|
|
|
|
// Use the network alias as the base URL so Hako can reach this server
|
|
// from inside its container via Docker DNS.
|
|
baseURL := fmt.Sprintf("http://%s", testServerAlias)
|
|
t.Logf("Test web server started at %s (network alias)", baseURL)
|
|
|
|
return container, baseURL, nil
|
|
}
|