Skip to content

Commit 4b05d20

Browse files
committed
Gitlab ci Test and build for multiarch
1 parent d573095 commit 4b05d20

File tree

6 files changed

+40
-26
lines changed

6 files changed

+40
-26
lines changed

.github/workflows/workflow.yml

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,63 @@ on:
1212

1313
jobs:
1414
build_test_maybe_release:
15+
runs-on: ubuntu-latest
1516
strategy:
17+
fail-fast: true
1618
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']
2021
steps:
2122
- name: Checkout
2223
uses: actions/checkout@v3
2324
- name: Set up QEMU
2425
uses: docker/setup-qemu-action@v2
2526
- name: Set up Docker Buildx
2627
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
2833
run: |
2934
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 \
3138
--set "*.platform=linux/amd64" \
39+
--set "*.output=type=docker" \
3240
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
4358
- name: Login to DockerHub
44-
# Merge ~ push.
59+
# push ~ schedule
4560
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
4661
uses: docker/login-action@v1
4762
with:
4863
username: ${{ secrets.DOCKERHUB_USERNAME }}
4964
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
5267
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
5368
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`
5470
PHP_VERSION="${{ matrix.php_version }}"
71+
TAG_PREFIX="rc-${{ env.GITHUB_SHA_SHORT }}-" \
5572
PHP_PATCH_MINOR="${{ env.PHP_VERSION_MINOR }}" \
5673
docker buildx bake \
5774
--set "*.platform=linux/amd64,linux/arm64" \

Dockerfile.slim.apache

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ RUN apt-get update \
5252
php${PHP_VERSION}-readline \
5353
php${PHP_VERSION}-xml \
5454
php${PHP_VERSION}-zip \
55-
&& if [[ "${PHP_VERSION}" =~ ^7 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \
56-
&& if [[ "${PHP_VERSION}" =~ ^8 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \
55+
php${PHP_VERSION}-json \
5756
&& apt-get clean \
5857
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
5958

Dockerfile.slim.cli

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ RUN apt-get update \
5252
php${PHP_VERSION}-readline \
5353
php${PHP_VERSION}-xml \
5454
php${PHP_VERSION}-zip \
55-
&& if [[ "${PHP_VERSION}" =~ ^7 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \
56-
&& if [[ "${PHP_VERSION}" =~ ^8 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \
55+
php${PHP_VERSION}-json \
5756
&& apt-get clean \
5857
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
5958

Dockerfile.slim.fpm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ RUN apt-get update \
5252
php${PHP_VERSION}-readline \
5353
php${PHP_VERSION}-xml \
5454
php${PHP_VERSION}-zip \
55-
&& if [[ "${PHP_VERSION}" =~ ^7 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \
56-
&& if [[ "${PHP_VERSION}" =~ ^8 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \
55+
php${PHP_VERSION}-json \
5756
&& apt-get clean \
5857
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
5958

extensions/core/swoole/install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22

3+
exit 0 # disable swoole as hotfix
34
set -e
45
export DEPENDENCIES="zlib1g"
56
EXTENSION=swoole ../docker-install.sh

utils/Dockerfile.slim.blueprint

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ RUN apt-get update \
5151
php${PHP_VERSION}-readline \
5252
php${PHP_VERSION}-xml \
5353
php${PHP_VERSION}-zip \
54-
&& if [[ "${PHP_VERSION}" =~ ^7 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \
55-
&& if [[ "${PHP_VERSION}" =~ ^8 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \
54+
php${PHP_VERSION}-json \
5655
&& apt-get clean \
5756
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
5857

0 commit comments

Comments
 (0)