Skip to content

Commit a6c958e

Browse files
committed
Adjust workflow for multistage
1 parent 7edaece commit a6c958e

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

.github/workflows/workflow.yml

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,48 +18,42 @@ jobs:
1818
variant: ['apache','cli','fpm']
1919
runs-on: ubuntu-latest
2020
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
2123
- name: Set up QEMU
22-
uses: docker/setup-qemu-action@v1
24+
uses: docker/setup-qemu-action@v2
2325
- name: Set up Docker Buildx
24-
uses: docker/setup-buildx-action@v1
25-
- name: Checkout
26-
uses: actions/checkout@v1
27-
# - name: Build locally
28-
# run: |
29-
# PHP_VERSION="${{ matrix.php_version }}"
30-
# docker buildx bake --load \
31-
# --set "*.platform=linux/amd64" \
32-
# php${PHP_VERSION//.}-slim-${{ matrix.variant }}
33-
# docker buildx bake --load \
34-
# --set "*.platform=linux/amd64" \
35-
# php${PHP_VERSION//.}-${{ matrix.variant }}-all
36-
# PHP_VERSION_MINOR=`docker run --rm thecodingmachine/php:${PHP_VERSION}-v4-slim-cli php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1`
37-
# echo "PHP_VERSION_MINOR=${PHP_VERSION_MINOR}" >> $GITHUB_ENV
38-
# echo "PHP Version : ${PHP_VERSION_MINOR}" >> $GITHUB_STEP_SUMMARY
39-
# docker images --filter=reference=thecodingmachine/php >> $GITHUB_STEP_SUMMARY
40-
# - name: Test ${{ matrix.variant }}
41-
# run: |
42-
# PHP_VERSION="${{ matrix.php_version }}" BRANCH=v4 VARIANT=${{ matrix.variant }} ./test-image.sh
43-
# echo "${{ matrix.variant }} variant OK" >> $GITHUB_STEP_SUMMARY
26+
uses: docker/setup-buildx-action@v2
27+
- name: Build locally (amd64)
28+
run: |
29+
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
4443
- name: Login to DockerHub
4544
# Merge ~ push.
4645
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
4746
uses: docker/login-action@v1
4847
with:
4948
username: ${{ secrets.DOCKERHUB_USERNAME }}
5049
password: ${{ secrets.DOCKERHUB_TOKEN }}
51-
- name: Build and push to repository
50+
- name: Build and push to repository (both amd64 and arm64)
5251
# Merge ~ push.
5352
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
5453
run: |
5554
PHP_VERSION="${{ matrix.php_version }}"
56-
docker buildx bake \
57-
--set "*.platform=linux/amd64,linux/arm64" \
58-
--set "*.output=type=registry" \
59-
php${PHP_VERSION//.}-slim-${{ matrix.variant }}
60-
PHP_PATCH_MINOR=`docker run --rm thecodingmachine/php:${PHP_VERSION}-v4-slim-cli php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1` \
55+
PHP_PATCH_MINOR="${{ env.PHP_VERSION_MINOR }}" \
6156
docker buildx bake \
6257
--set "*.platform=linux/amd64,linux/arm64" \
6358
--set "*.output=type=registry" \
6459
php${PHP_VERSION//.}-${{ matrix.variant }}-all
65-
docker images --filter=reference=thecodingmachine/php >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)