Skip to content

Commit

Permalink
test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Sep 25, 2024
1 parent 31ee7d2 commit 966dd71
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 69 deletions.
84 changes: 16 additions & 68 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,90 +35,44 @@ jobs:
echo "$MATRIX" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
fpm-amd64:
name: PHP FPM ${{ matrix.php }} (amd64)
runs-on: ubuntu-latest
fpm:
name: PHP FPM ${{ matrix.php }}
runs-on: shopware-arm64
container:
image: ghcr.io/catthehacker/ubuntu:act-22.04
needs: [generate-matrix]
strategy: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login into Github Docker Registery
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and Push
uses: docker/build-push-action@v6
with:
tags: ${{ matrix.fpm-image }}-amd64
context: fpm
cache-from: type=gha,scope=fpm-${{ matrix.php }}-amd64
cache-to: type=gha,mode=max,scope=fpm-${{ matrix.php }}-amd64
platforms: linux/amd64
build-args: |
PHP_PATCH_VERSION=${{ matrix.phpPatch }}
PHP_DIGEST=${{ matrix.phpPatchDigest }}
push: true
provenance: false

fpm-arm64:
name: PHP FPM ${{ matrix.php }} (arm64)
runs-on: github-hosted-arm64
needs: [generate-matrix]
strategy: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login into Docker Hub
if: github.ref == 'refs/heads/main'
run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin

- name: Login into Github Docker Registery
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and Push
uses: docker/build-push-action@v6
with:
tags: ${{ matrix.fpm-image }}-arm64
tags: |
${{ matrix.fpm-tags }}
context: fpm
cache-from: type=gha,scope=fpm-${{ matrix.php }}-arm64
cache-to: type=gha,mode=max,scope=fpm-${{ matrix.php }}-arm64
platforms: linux/arm64
cache-from: type=gha,scope=fpm-${{ matrix.php }}
cache-to: type=gha,mode=max,scope=fpm-${{ matrix.php }}
platforms: linux/arm64,linux/amd64
build-args: |
PHP_PATCH_VERSION=${{ matrix.phpPatch }}
PHP_DIGEST=${{ matrix.phpPatchDigest }}
push: true
provenance: false

fpm:
name: Merge FPM Manifest
runs-on: ubuntu-latest
needs: [fpm-amd64, fpm-arm64, generate-matrix]
strategy: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- name: Login into Docker Hub
if: github.ref == 'refs/heads/main'
run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin

- name: Login into Github Docker Registery
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Create Manifest
run: |
for image in ${{ matrix.fpm-tags }}; do
docker manifest create $image ${{ matrix.fpm-image }}-amd64 ${{ matrix.fpm-image }}-arm64
docker manifest push $image
done
fpm-otel:
name: PHP FPM ${{ matrix.php }} with OpenTelemetry
runs-on: ubuntu-latest
runs-on: shopware-arm64
container:
image: ghcr.io/catthehacker/ubuntu:act-22.04
needs: [generate-matrix, fpm]
strategy: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
Expand All @@ -131,12 +85,6 @@ jobs:

- name: Login into Github Docker Registery
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and Push
uses: docker/build-push-action@v6
Expand Down
2 changes: 1 addition & 1 deletion matrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function get_digest_of_image(string $imageName, string $tag): string {
'phpPatch' => $patchVersion['version'],
'phpPatchDigest' => $phpDigest,
'fpm-image' => 'ghcr.io/shopware/docker-base' . $imageSuffix . ':' . $imageTagPrefix . $supportedVersion . '-fpm',
'fpm-tags' => implode(" ", $fpmImages),
'fpm-tags' => implode("\n", $fpmImages),
'fpm-tags-otel' => implode("\n", $fpmImagesOtel),
'caddy-tags' => implode("\n", $caddyImages),
'caddy-tags-otel' => implode("\n", $caddyImagesOtel),
Expand Down

0 comments on commit 966dd71

Please sign in to comment.