Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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.

27 changes: 27 additions & 0 deletions gotester/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Comment thread
bosbaber marked this conversation as resolved.
Outdated
| 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
Comment thread
bosbaber marked this conversation as resolved.
Outdated

WORKDIR /app
46 changes: 46 additions & 0 deletions gotester/README.md
Original file line number Diff line number Diff line change
@@ -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 .
Comment thread
bosbaber marked this conversation as resolved.
```
Loading