|
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 \ |
| 35 | + TAG_PREFIX="rc-${{ env.GITHUB_SHA_SHORT }}-" \ |
| 36 | + docker buildx bake \ |
| 37 | + --set "*.cache-to=type=gha" --set "*.cache-from=type=gha \ |
31 | 38 | --set "*.platform=linux/amd64" \ |
| 39 | + --set "*.output=type=docker" \ |
32 | 40 | 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 |
| 41 | + - name: Test amd64 |
| 42 | + run: | |
| 43 | + TAG_PREFIX="rc${{ env.GITHUB_SHA_SHORT }}-" \ |
| 44 | + PHP_VERSION="${{ matrix.php_version }}" BRANCH=v4 VARIANT=${{ matrix.variant }} PLATFORM=linux/amd64 ./tests-suite/bash_unit -f tap ./tests-suite/*.sh |
| 45 | + - name: Build arm64 |
| 46 | + run: | |
| 47 | + PHP_VERSION="${{ matrix.php_version }}" |
| 48 | + TAG_PREFIX="rc-${{ env.GITHUB_SHA_SHORT }}-" \ |
| 49 | + docker buildx bake \ |
| 50 | + --set "*.cache-to=type=gha" --set "*.cache-from=type=gha \ |
| 51 | + --set "*.platform=linux/arm64" \ |
| 52 | + --set "*.output=type=docker" \ |
| 53 | + php${PHP_VERSION//.}-${{ matrix.variant }}-all |
| 54 | + - name: Test arm64 |
| 55 | + run: | |
| 56 | + TAG_PREFIX="rc-${{ env.GITHUB_SHA_SHORT }}-" \ |
| 57 | + PHP_VERSION="${{ matrix.php_version }}" BRANCH=v4 VARIANT=${{ matrix.variant }} PLATFORM=linux/arm64 ./tests-suite/bash_unit -f tap ./tests-suite/*.sh |
43 | 58 | - name: Login to DockerHub |
44 | | - # Merge ~ push. |
| 59 | + # push ~ schedule |
45 | 60 | if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} |
46 | 61 | uses: docker/login-action@v1 |
47 | 62 | with: |
48 | 63 | username: ${{ secrets.DOCKERHUB_USERNAME }} |
49 | 64 | password: ${{ secrets.DOCKERHUB_TOKEN }} |
50 | | - - name: Build and push to repository (both amd64 and arm64) |
51 | | - # Merge ~ push. |
| 65 | + - name: Build and push as multiarch (amd64 and arm64) |
| 66 | + # push ~ schedule |
52 | 67 | if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} |
53 | 68 | run: | |
| 69 | + 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 | 70 | PHP_VERSION="${{ matrix.php_version }}" |
| 71 | + TAG_PREFIX="rc-${{ env.GITHUB_SHA_SHORT }}-" \ |
55 | 72 | PHP_PATCH_MINOR="${{ env.PHP_VERSION_MINOR }}" \ |
56 | 73 | docker buildx bake \ |
57 | 74 | --set "*.platform=linux/amd64,linux/arm64" \ |
|
0 commit comments