Skip to content

Commit 5e0b5e1

Browse files
committed
ci: add end-to-end tests
Signed-off-by: Evan Wies <evan@neomantra.net>
1 parent 4e11a26 commit 5e0b5e1

3 files changed

Lines changed: 95 additions & 0 deletions

File tree

tests/e2e/local-test.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Local E2E Test
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
GHCR_IMAGE: localhost:5001/neomantra/openresty
8+
DOCKERHUB_IMAGE: localhost:5002/openresty/openresty
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- flavor: alpine-apk-test
18+
arch: amd64
19+
dockerfile: alpine-apk/Dockerfile
20+
platforms: linux/amd64
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v3
28+
29+
# Configure Buildx to allow insecure registries for localhost
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
with:
33+
driver-opts: network=host
34+
buildkitd-flags: --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host
35+
36+
- name: Extract metadata
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.GHCR_IMAGE }}
41+
tags: |
42+
type=raw,value=${{ matrix.flavor }}-${{ matrix.arch }}
43+
44+
- name: Build and push
45+
uses: docker/build-push-action@v5
46+
with:
47+
context: .
48+
file: ${{ matrix.dockerfile }}
49+
platforms: ${{ matrix.platforms }}
50+
push: true
51+
tags: ${{ steps.meta.outputs.tags }}
52+
labels: ${{ steps.meta.outputs.labels }}
53+
54+
- name: Tag and Push to Mirror
55+
run: |
56+
for TAG in ${{ steps.meta.outputs.tags }}; do
57+
# Replace port 5001 with 5002 for the mirror
58+
DOCKERHUB_TAG=$(echo "$TAG" | sed "s|5001|5002|")
59+
docker buildx imagetools create -t "$DOCKERHUB_TAG" "$TAG"
60+
done

tests/e2e/run-test.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Ensure registries are running
5+
if ! docker ps | grep -q openresty-test-ghcr; then
6+
echo "Starting registries..."
7+
./tests/e2e/start-registries.sh
8+
fi
9+
10+
echo "Running E2E test with act..."
11+
# We use --network host to allow the buildx container to reach localhost registries
12+
# We specify the workflow file explicitly
13+
act workflow_dispatch \
14+
-W tests/e2e/local-test.yml \
15+
--container-architecture linux/amd64 \
16+
--bind \
17+
--network host
18+
19+
echo "Test complete. Verifying images..."
20+
docker pull localhost:5001/neomantra/openresty:alpine-apk-test-amd64
21+
docker pull localhost:5002/openresty/openresty:alpine-apk-test-amd64
22+
23+
echo "✅ verification successful!"

tests/e2e/start-registries.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Start GHCR mock
5+
docker run -d -p 5001:5000 --restart=always --name openresty-test-ghcr registry:2
6+
echo "Started openresty-test-ghcr on port 5001"
7+
8+
# Start Docker Hub mock
9+
docker run -d -p 5002:5000 --restart=always --name openresty-test-hub registry:2
10+
echo "Started openresty-test-hub on port 5002"
11+
12+
echo "Registries are running."

0 commit comments

Comments
 (0)