|
12 | 12 |
|
13 | 13 | jobs:
|
14 | 14 | build_test_maybe_release:
|
| 15 | + runs-on: ubuntu-latest |
15 | 16 | strategy:
|
| 17 | + fail-fast: true |
16 | 18 | matrix:
|
17 |
| - php_version: ['8.1','8.0','7.4', '7.3','7.2'] |
18 |
| - variant: ['apache','cli','fpm'] |
19 |
| - runs-on: ubuntu-latest |
| 19 | + php_version: ['8.1'] #,'8.0','7.4', '7.3','7.2'] |
| 20 | + variant: ['apache'] #,'cli','fpm'] |
20 | 21 | steps:
|
21 | 22 | - name: Checkout
|
22 | 23 | uses: actions/checkout@v3
|
23 | 24 | - name: Set up QEMU
|
24 | 25 | uses: docker/setup-qemu-action@v2
|
25 | 26 | - name: Set up Docker Buildx
|
26 | 27 | uses: docker/setup-buildx-action@v2
|
27 |
| - - name: Build locally (amd64) |
| 28 | + - name: Expose GitHub Runtime for docker cache |
| 29 | + uses: crazy-max/ghaction-github-runtime@v2 |
| 30 | + - name: Inject slug/short variables |
| 31 | + uses: rlespinasse/github-slug-action@v4 |
| 32 | + - name: Build amd64 |
28 | 33 | run: |
|
29 | 34 | PHP_VERSION="${{ matrix.php_version }}"
|
30 |
| - docker buildx bake --load \ |
31 |
| - --set "*.platform=linux/amd64" \ |
32 |
| - php${PHP_VERSION//.}-${{ matrix.variant }}-all |
33 |
| - # Fetch minor version |
34 |
| - PHP_VERSION_MINOR=`docker run --rm thecodingmachine/php:${PHP_VERSION}-v4-slim-${{ matrix.variant }} php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1` |
35 |
| - echo "PHP_VERSION_MINOR=${PHP_VERSION_MINOR}" >> $GITHUB_ENV |
36 |
| - # Summary |
37 |
| - echo "PHP Version : ${PHP_VERSION_MINOR}" >> $GITHUB_STEP_SUMMARY |
38 |
| - docker images --filter=reference=thecodingmachine/php >> $GITHUB_STEP_SUMMARY |
39 |
| - docker images --filter=reference=thecodingmachine/php |
40 |
| - - name: Test variant '${{ matrix.variant }}' (amd64) |
41 |
| - run: | |
42 |
| - PHP_VERSION="${{ matrix.php_version }}" BRANCH=v4 VARIANT=${{ matrix.variant }} ./tests-suite/bash_unit -f tap ./tests-suite/*.sh |
| 35 | + BUILD_OPTS=('--set "*.platform=linux/amd64"') |
| 36 | + BUILD_OPTS+=('--set "*.output=type=docker"') |
| 37 | + if [[ "${{ github.event_name }}" != "schedule" ]] && [[ "${{ github.event_name }}" != "push" ]]; then |
| 38 | + BUILD_OPTS+=('--set "*.cache-to=type=gha"') |
| 39 | + BUILD_OPTS+=('--set "*.cache-from=type=gha"') |
| 40 | + fi |
| 41 | + TAG_PREFIX="rc-${{ env.GITHUB_SHA_SHORT }}-" \ |
| 42 | + exec docker buildx bake ${BUILD_OPTS[@]} php${PHP_VERSION//.}-${{ matrix.variant }}-all |
| 43 | + - name: Test amd64 |
| 44 | + run: | |
| 45 | + TAG_PREFIX="rc${{ env.GITHUB_SHA_SHORT }}-" \ |
| 46 | + PHP_VERSION="${{ matrix.php_version }}" BRANCH=v4 VARIANT=${{ matrix.variant }} PLATFORM=linux/amd64 ./tests-suite/bash_unit -f tap ./tests-suite/*.sh |
| 47 | + - name: Build arm64 |
| 48 | + run: | |
| 49 | + PHP_VERSION="${{ matrix.php_version }}" |
| 50 | + BUILD_OPTS=('--set "*.platform=linux/arm64"') |
| 51 | + BUILD_OPTS+=('--set "*.output=type=docker"') |
| 52 | + if [[ "${{ github.event_name }}" != "schedule" ]] && [[ "${{ github.event_name }}" != "push" ]]; then |
| 53 | + BUILD_OPTS+=('--set "*.cache-to=type=gha"') |
| 54 | + BUILD_OPTS+=('--set "*.cache-from=type=gha"') |
| 55 | + fi |
| 56 | + TAG_PREFIX="rc-${{ env.GITHUB_SHA_SHORT }}-" \ |
| 57 | + exec docker buildx bake ${BUILD_OPTS[@]} "php${PHP_VERSION//.}-${{ matrix.variant }}-all" |
| 58 | + - name: Test arm64 |
| 59 | + run: | |
| 60 | + TAG_PREFIX="rc-${{ env.GITHUB_SHA_SHORT }}-" \ |
| 61 | + PHP_VERSION="${{ matrix.php_version }}" BRANCH=v4 VARIANT=${{ matrix.variant }} PLATFORM=linux/arm64 ./tests-suite/bash_unit -f tap ./tests-suite/*.sh |
43 | 62 | - name: Login to DockerHub
|
44 |
| - # Merge ~ push. |
| 63 | + # push ~ schedule |
45 | 64 | if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
|
46 | 65 | uses: docker/login-action@v1
|
47 | 66 | with:
|
48 | 67 | username: ${{ secrets.DOCKERHUB_USERNAME }}
|
49 | 68 | password: ${{ secrets.DOCKERHUB_TOKEN }}
|
50 |
| - - name: Build and push to repository (both amd64 and arm64) |
51 |
| - # Merge ~ push. |
| 69 | + - name: Build and push as multiarch (amd64 and arm64) |
| 70 | + # push ~ schedule |
52 | 71 | if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
|
53 | 72 | run: |
|
| 73 | + PHP_PATCH_MINOR=`docker run --rm thecodingmachine/php:rc-${{ env.GITHUB_SHA_SHORT }}-${{ matrix.php_version }}-v4-slim-${{ matrix.variant }} php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1` |
54 | 74 | PHP_VERSION="${{ matrix.php_version }}"
|
| 75 | + TAG_PREFIX="rc-${{ env.GITHUB_SHA_SHORT }}-" \ |
55 | 76 | PHP_PATCH_MINOR="${{ env.PHP_VERSION_MINOR }}" \
|
56 | 77 | docker buildx bake \
|
57 | 78 | --set "*.platform=linux/amd64,linux/arm64" \
|
|
0 commit comments