Skip to content

Add PHP 8.3 and replace Buster with Bookworm #10

Add PHP 8.3 and replace Buster with Bookworm

Add PHP 8.3 and replace Buster with Bookworm #10

Workflow file for this run

name: Build and test Docker images
on:
pull_request:
branches:
- master
paths-ignore:
- "*.md"
- 'LICENSE'
- 'docs/'
- '.gitignore'
- 'docker-compose.yml'
- 'Makefile'
env:
IMAGE_PREFIX: localhost:5000/brettt89/silverstripe-web
REGISTRY_PATH: ${{ github.workspace }}/registry
CACHE_PATH: /tmp/.buildx-cache
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [bookworm, bullseye, alpine]
php: ['8.1', '8.2', '8.3']
distro: [apache, fpm, cli]
exclude:
- os: alpine
distro: apache
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
- name: Start Docker registry
run: |
docker run --rm --detach --publish 5000:5000 \
--volume ${REGISTRY_PATH}:/var/lib/registry \
--name registry registry:2
- name: Build silverstripe docker image
uses: docker/[email protected]
with:
context: src/${{ matrix.php }}/${{ matrix.distro }}/${{ matrix.os }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha,scope=${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}
cache-to: type=gha,scope=${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}
push: true
tags: ${{ env.IMAGE_PREFIX }}:${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}-test
- name: Stop Docker registry
run: docker stop registry
- name: Upload Docker registry data for testing
uses: actions/upload-artifact@v3
with:
name: docker-registry-data-${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}
path: ${{ env.REGISTRY_PATH }}/
test:
name: Test
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
os: [bookworm, bullseye, alpine]
php: ['8.1', '8.2', '8.3']
distro: [apache, fpm, cli]
exclude:
- os: alpine
distro: apache
env:
PLATFORM: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download Docker registry data from build job
uses: actions/download-artifact@v3
with:
name: docker-registry-data-${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}
path: ${{ env.REGISTRY_PATH }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Start Docker registry
run: |
docker run --rm --detach --publish 5000:5000 \
--volume ${REGISTRY_PATH}:/var/lib/registry \
--name registry registry:2
sleep 10
- name: Import Docker images
run: docker pull --platform ${{ matrix.platform }} ${{ env.IMAGE_PREFIX }}:${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}-test
- name: Docker inspect
run: docker buildx imagetools inspect ${{ env.IMAGE_PREFIX }}:${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}-test | grep '${{ matrix.platform }}'
- id: test
uses: ./.github/actions/build-test
with:
image: ${{ env.IMAGE_PREFIX }}:${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}-test
platform: ${{ matrix.platform }}
php: ${{ matrix.php }}
distro: ${{ matrix.distro }}
os: ${{ matrix.os }}
- name: Cleanup
run: |
docker stop registry