Skip to content

Commit

Permalink
Run check after building images
Browse files Browse the repository at this point in the history
  • Loading branch information
pweyck committed Jan 30, 2024
1 parent 92d218c commit e22657f
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 57 deletions.
53 changes: 45 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,7 @@ jobs:
if: github.ref == 'refs/heads/main'
with:
tags: |
ghcr.io/shopware/docker-base:${{ matrix.php }}-caddy
ghcr.io/shopware/docker-base:${{ matrix.php }}
ghcr.io/shopware/docker-base:${{ matrix.phpPatch }}-caddy
ghcr.io/shopware/docker-base:${{ matrix.phpPatch }}
shopware/docker-base:${{ matrix.php }}-caddy
shopware/docker-base:${{ matrix.php }}
shopware/docker-base:${{ matrix.phpPatch }}-caddy
shopware/docker-base:${{ matrix.phpPatch }}
${{ matrix.caddy-tags }}
context: caddy
cache-from: type=registry,ref=ghcr.io/shopware/docker-cache:${{ matrix.php }}-caddy
cache-to: type=registry,ref=ghcr.io/shopware/docker-cache:${{ matrix.php }}-caddy,mode=max
Expand All @@ -165,3 +158,47 @@ jobs:
push: false
provenance: false

check:
name: Test Image
runs-on: ubuntu-latest
needs: [caddy]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Checkout
uses: actions/checkout@v4

- name: Checkout example repo
uses: actions/checkout@v4
with:
path: example-repo
repository: shopwareLabs/example-docker-repository

- name: Build
id: build
uses: docker/build-push-action@v5
with:
push: false
load: true
build-arg: |
BASE_IMAGE=ghcr.io/shopware/docker-base:${{ github.run_id }}-8.3-caddy
context: .
file: 8.3/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Run image
env:
DOCKER_BUILDKIT: 0
working-directory: example-repo
run: docker compose up -d --wait

- name: Check if shopware is running
run: curl --fail localhost:8000/admin

# output logs if failed
- name: Output logs
working-directory: example-repo
run: docker compose logs
if: ${{ failure() }}
49 changes: 0 additions & 49 deletions .github/workflows/pr.yml

This file was deleted.

18 changes: 18 additions & 0 deletions matrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,33 @@

$imagePrefix = $_SERVER['GITHUB_RUN_ID'] ? ($_SERVER['GITHUB_RUN_ID'] . '-') : '';

$caddyImages = [
'ghcr.io/shopware/docker-base:' . $imagePrefix . $supportedVersion,
'ghcr.io/shopware/docker-base:' . $imagePrefix . $supportedVersion . '-caddy',
'ghcr.io/shopware/docker-base:' . $imagePrefix . $patchVersion['version'],
'ghcr.io/shopware/docker-base:' . $imagePrefix . $$patchVersion['version'] . '-caddy',
];

if (!$imagePrefix) {
$caddyImages = array_merge($caddyImages, [
'shopware/docker-base:' . $imagePrefix . $supportedVersion,
'shopware/docker-base:' . $imagePrefix . $supportedVersion . '-caddy',
'shopware/docker-base:' . $imagePrefix . $patchVersion['version'],
'shopware/docker-base:' . $imagePrefix . $patchVersion['version'] . '-caddy',
]);
}

$data[] = [
'php' => $supportedVersion,
'phpPatch' => $patchVersion['version'],
'phpPatchDigest' => $phpDigest,
'supervisordDigest' => $supervisord,
'base-image' => 'ghcr.io/shopware/docker-base:' . $imagePrefix . $supportedVersion,
'fpm-image' => 'ghcr.io/shopware/docker-base:' . $imagePrefix . $supportedVersion . '-fpm',
'fpm-patch-image' => 'ghcr.io/shopware/docker-base:' . $imagePrefix . $patchVersion['version'] . '-fpm',
'fpm-hub-image' => 'shopware/docker-base:' . $imagePrefix . $supportedVersion . '-fpm',
'fpm-patch-hub-image' => 'shopware/docker-base:' . $imagePrefix . $patchVersion['version'] . '-fpm',
'caddy-tags' => implode("\n", $caddyImages),
];
}

Expand Down

0 comments on commit e22657f

Please sign in to comment.