From 056726591ef84911e635b7be1f6907111c2c2320 Mon Sep 17 00:00:00 2001 From: Stephan Butler Date: Mon, 20 Apr 2026 17:34:59 +0200 Subject: [PATCH 1/2] feat(gotester): added gotester for go build speedups --- README.md | 3 +++ gotester/Dockerfile | 27 ++++++++++++++++++++++++++ gotester/README.md | 46 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 gotester/Dockerfile create mode 100644 gotester/README.md diff --git a/README.md b/README.md index 8e5a564..fc5ccd9 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,6 @@ In various places across the ILF ecosystem we need custom built images. Quite of Image: Chart Validator Description: Kustomize, Helm, GCloud SDK and Kubeconform. For easy chart validation. +Image: Go Tester +Description: Go 1.25, golangci-lint, Atlas CLI, and PostgreSQL client. Pre-built image for running Go unit tests, mock-service tests, and linting in CI. + diff --git a/gotester/Dockerfile b/gotester/Dockerfile new file mode 100644 index 0000000..bfd49fc --- /dev/null +++ b/gotester/Dockerfile @@ -0,0 +1,27 @@ +FROM golang:1.25-alpine + +# System dependencies needed by both go-test and mock-tester CI workflows: +# bash - shell scripts in CI steps +# bc - floating-point coverage threshold comparison +# curl - downloading tools (Atlas CLI) +# git - Go modules, golangci-lint VCS checks +# grep - GNU grep with -P (PCRE) for extracting coverage thresholds +# make - mock service Makefiles +# postgresql17-client - pg_isready to wait for Postgres service containers +RUN apk add --no-cache \ + bash \ + bc \ + curl \ + git \ + grep \ + make \ + postgresql17-client + +# golangci-lint v2.5.0 — used by both mock-tester and linting workflows +RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \ + | sh -s -- -b /usr/local/bin v2.5.0 + +# Atlas CLI — generates test migrations for backend/pacioli database schemas +RUN curl -sSf https://atlasgo.sh | sh + +WORKDIR /app diff --git a/gotester/README.md b/gotester/README.md new file mode 100644 index 0000000..88cd0ea --- /dev/null +++ b/gotester/README.md @@ -0,0 +1,46 @@ +# Go Tester + +Pre-built image for running Go unit tests, mock-service tests, and linting in the [interledger-app](https://github.com/interledger/interledger-app) CI pipeline. + +## What's inside + +| Tool | Version | Purpose | +|------|---------|---------| +| Go | 1.25 | Compile and test Go code | +| golangci-lint | 2.5.0 | Lint all Go packages | +| Atlas CLI | latest | Generate database test migrations | +| PostgreSQL 17 client | 17.x | `pg_isready` to wait for Postgres service containers | +| GNU grep (PCRE) | — | Extract coverage thresholds with `-oP` | +| bc | — | Floating-point coverage comparison | +| make | — | Run mock-service Makefiles | +| bash, git, curl | — | Standard CI utilities | + +## Replaces + +This single image replaces the tool-installation steps in two interledger-app workflow templates: + +- **`go-test-template.yml`** — `setup-go`, `Install Atlas CLI`, `pg_isready` wait loop +- **`mock-tester.yml`** — `setup-go`, `golangci-lint-action`, Docker setup + +## Usage + +```yaml +# GitHub Actions example +jobs: + test: + runs-on: ubuntu-latest + container: + image: ghcr.io/interledger/builders/gotester:latest + services: + postgres: + image: postgres:17 + steps: + - uses: actions/checkout@v4 + - run: go test -coverprofile=coverage.out ./go/backend/... +``` + +## Building locally + +```bash +docker build -t gotester . +``` From 7b672d49eba8100cd22e669f6e91b1237afe9866 Mon Sep 17 00:00:00 2001 From: Stephan Butler Date: Mon, 20 Apr 2026 17:46:17 +0200 Subject: [PATCH 2/2] fix: fixed reported issues --- gotester/Dockerfile | 15 ++++++++++++--- gotester/README.md | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gotester/Dockerfile b/gotester/Dockerfile index bfd49fc..da85dcb 100644 --- a/gotester/Dockerfile +++ b/gotester/Dockerfile @@ -18,10 +18,19 @@ RUN apk add --no-cache \ postgresql17-client # golangci-lint v2.5.0 — used by both mock-tester and linting workflows -RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \ - | sh -s -- -b /usr/local/bin v2.5.0 +# Installed from versioned release artifact with checksum verification. +ARG GOLANGCI_LINT_VERSION=2.5.0 +ARG GOLANGCI_LINT_SHA256=c77313a77e19b06123962c411d9943cc0d092bbec76b956104d18964e274902e +RUN curl -sSfL "https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz" \ + -o /tmp/golangci-lint.tar.gz \ + && echo "${GOLANGCI_LINT_SHA256} /tmp/golangci-lint.tar.gz" | sha256sum -c - \ + && tar -xzf /tmp/golangci-lint.tar.gz -C /tmp \ + && mv /tmp/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64/golangci-lint /usr/local/bin/ \ + && rm -rf /tmp/golangci-lint* # Atlas CLI — generates test migrations for backend/pacioli database schemas -RUN curl -sSf https://atlasgo.sh | sh +# Pinned to a specific version via ATLAS_VERSION; bump the ARG to upgrade. +ARG ATLAS_VERSION=v1.2.0 +RUN ATLAS_VERSION=${ATLAS_VERSION} curl -sSf https://atlasgo.sh | sh WORKDIR /app diff --git a/gotester/README.md b/gotester/README.md index 88cd0ea..ecd4996 100644 --- a/gotester/README.md +++ b/gotester/README.md @@ -8,7 +8,7 @@ Pre-built image for running Go unit tests, mock-service tests, and linting in th |------|---------|---------| | Go | 1.25 | Compile and test Go code | | golangci-lint | 2.5.0 | Lint all Go packages | -| Atlas CLI | latest | Generate database test migrations | +| Atlas CLI | 1.2.0 | Generate database test migrations | | PostgreSQL 17 client | 17.x | `pg_isready` to wait for Postgres service containers | | GNU grep (PCRE) | — | Extract coverage thresholds with `-oP` | | bc | — | Floating-point coverage comparison | @@ -42,5 +42,6 @@ jobs: ## Building locally ```bash +cd gotester docker build -t gotester . ```