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
11 changes: 1 addition & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,7 @@ jobs:
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Build image
run: |
set -a
. ./versions/${{ matrix.php-versions }}.env
set +a
args=()
while IFS='=' read -r k _; do
[[ -z "$k" || "$k" =~ ^# ]] && continue
args+=(--build-arg "$k")
done < versions/${{ matrix.php-versions }}.env
docker image build "${args[@]}" --tag utopia-base-test .
run: make build VERSION=${{ matrix.php-versions }} IMAGE=utopia-base-test

- name: Save image
run: docker image save utopia-base-test -o image.tar
Expand Down
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
VERSION ?= 8.4
IMAGE ?= utopia-base-test:$(VERSION)
ENV_FILE := versions/$(VERSION).env

VERSIONS := $(patsubst versions/%.env,%,$(wildcard versions/*.env))

BUILD_ARGS = $(shell awk -F= '!/^\#/ && NF { printf "--build-arg %s ", $$1 }' $(ENV_FILE))

.PHONY: build test all clean

build:
set -a && . ./$(ENV_FILE) && set +a && \
docker build $(BUILD_ARGS) --tag $(IMAGE) .

test: build
container-structure-test test --image $(IMAGE) --config tests.yaml

all:
@for v in $(VERSIONS); do $(MAKE) build VERSION=$$v || exit $$?; done

clean:
@for v in $(VERSIONS); do docker rmi utopia-base-test:$$v 2>/dev/null || true; done
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,12 @@ All publishing workflows share a `build-<sha>` concurrency group so a release qu

## Local development

A single `Dockerfile` is templated by the per-version configs in `versions/<X.Y>.env`:
A single `Dockerfile` is templated by the per-version configs in `versions/<X.Y>.env`. Use the `Makefile`:

```sh
set -a && . versions/8.4.env && set +a
args=()
while IFS='=' read -r k _; do
[[ -z "$k" || "$k" =~ ^# ]] && continue
args+=(--build-arg "$k")
done < versions/8.4.env

docker build "${args[@]}" -t utopia-base-test .
container-structure-test test --image utopia-base-test --config tests.yaml
make build VERSION=8.4 # build a single version
make test VERSION=8.4 # build + run structure tests
make all # build all supported versions
```

To bump an extension version, edit the relevant `versions/<X.Y>.env`. To add a new PHP version, drop in a new `versions/<X.Y>.env` and add the version to the matrix in `.github/workflows/ci.yml` and `publish.yml`.
Loading