Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

36 changes: 36 additions & 0 deletions gotester/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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
# 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
# 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
47 changes: 47 additions & 0 deletions gotester/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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 | 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 |
| 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
cd gotester
docker build -t gotester .
Comment thread
bosbaber marked this conversation as resolved.
```
Loading