@@ -3,8 +3,16 @@ name: PHP Docker Image CI for Sylius
33on :
44 workflow_dispatch : ~
55 push :
6- branches :
7- - frankenphp
6+ branches : [ frankenphp ]
7+ paths :
8+ - ' frankenphp/**'
9+ - ' WORKSPACE'
10+ schedule :
11+ - cron : ' 0 20 * * 5'
12+
13+ concurrency :
14+ group : sylius_frankenphp_build
15+ cancel-in-progress : false
816
917jobs :
1018
@@ -66,15 +74,14 @@ jobs:
6674 password : ${{ secrets.GITHUB_TOKEN }}
6775 logout : true
6876
69- - name : Build and push
70- uses : docker/build-push-action@v5.0.0
77+ - name : Build multiplatform
78+ uses : docker/build-push-action@v5
7179 with :
7280 file : ./frankenphp/Dockerfile
7381 context : ./frankenphp
74- build-args : |
75- "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}"
82+ build-args : " FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}"
7683 platforms : linux/amd64,linux/arm64
77- push : ${{ github.ref == 'refs/heads/frankenphp' || github.event_name == 'workflow_dispatch' }}
84+ push : false
7885 pull : true
7986 tags : ${{ steps.meta.outputs.tags }}
8087 cache-from : type=local,src=/tmp/.buildx-cache
@@ -108,107 +115,42 @@ jobs:
108115 cache-to : type=local,mode=max,dest=/tmp/.buildx-cache-new-arm64
109116 outputs : type=docker,dest=./external/image-arm64.tar
110117
111- # - name: Mount Bazel cache
112- # uses: actions/cache@v4
113- # with:
114- # path: "~/.cache/bazel"
115- # key: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}"
116- # restore-keys: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-"
117-
118- # - name: Setup PHP for Bazel
119- # run: |
120- # set -ex
121- # cat > frankenphp/php-version.bzl <<EOF
122- # PHP_VERSION = "${{ matrix.php }}"
123- # EOF
124- # cat > frankenphp/frankenphp-arch.bzl <<EOF
125- # ARCHITECTURES = ["amd64", "arm64"]
126- # EOF
127-
128- # - name: Bazel build and test
129- # run: |
130- # set -ex
131- # targets=$(bazel query 'attr(visibility, "//visibility:public", //frankenphp:*)' | sort)
132- # bazel build --curses=no ${targets}
133- # bazel test --curses=no --test_output=errors ${targets}
134-
135- - name : Move cache
136- run : |
137- rm -rf /tmp/.buildx-cache
138- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
139-
140- build-xdebug :
141- needs : build
142-
143- name : " Sylius PHP with Xdebug - ${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}"
144-
145- runs-on : ubuntu-latest
146-
147- strategy :
148- fail-fast : false
149- matrix :
150- frankenphp : [ "1.5-php" ]
151- php : [ "8.0", "8.1", "8.2", "8.3", "8.4" ]
152- distro : [ "", "-alpine" ]
153-
154- steps :
155-
156- - uses : actions/checkout@v4
157-
158- - name : Generate UUID
159- id : generate-uuid
160- run : |
161- UUID=$(cat /proc/sys/kernel/random/uuid)
162- echo "UUID=${UUID}" >> $GITHUB_OUTPUT
163-
164- - name : Set up QEMU
165- id : qemu
166- uses : docker/setup-qemu-action@v3
167-
168- - name : Available platforms
169- run : echo ${{ steps.qemu.outputs.platforms }}
170-
171- - name : Docker meta
172- id : meta
173- uses : docker/metadata-action@v5
174- with :
175- images : ${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }}
176- tags : |
177- type=raw,value=${{ matrix.frankenphp }}${{ matrix.php }}-xdebug-${{ matrix.distro }}
178-
179- - name : Set up Docker Buildx
180- uses : docker/setup-buildx-action@v3
181-
182- - name : Cache Docker layers
118+ - name : Mount Bazel cache
183119 uses : actions/cache@v4
184120 with :
185- path : /tmp/.buildx-cache
186- key : " ${{ runner.os }}-frankenphp-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}"
187- # https://github.com/actions/cache/issues/109#issuecomment-558771281
188- # https://github.community/t/always-save-new-cache-for-incremental-builds/172791
189- restore-keys : " ${{ runner.os }}-frankenphp-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-"
121+ path : " ~/.cache/bazel"
122+ key : " ${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}"
123+ restore-keys : " ${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-"
190124
191- - name : Docker Login
192- uses : docker/login-action@v3
193- with :
194- registry : ghcr.io
195- username : ${{ github.actor }}
196- password : ${{ secrets.GITHUB_TOKEN }}
197- logout : true
125+ - name : Setup PHP for Bazel
126+ run : |
127+ set -ex
128+ cat > frankenphp/php-version.bzl <<EOF
129+ PHP_VERSION = "${{ matrix.php }}"
130+ EOF
131+ cat > frankenphp/frankenphp-arch.bzl <<EOF
132+ ARCHITECTURES = ["amd64", "arm64"]
133+ EOF
134+
135+ - name : Bazel build and test
136+ run : |
137+ set -ex
138+ targets=$(bazel query 'attr(visibility, "//visibility:public", //frankenphp:*)' | sort)
139+ bazel build --curses=no ${targets}
140+ bazel test --curses=no --test_output=errors ${targets}
198141
199- - name : Build and push
142+ - name : Push
200143 uses : docker/build-push-action@v5
201144 with :
202- file : ./frankenphp/xdebug. Dockerfile
145+ file : ./frankenphp/Dockerfile
203146 context : ./frankenphp
204- build-args : |
205- "IMAGE_NAME=${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }}"
206- "IMAGE_TAG=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}"
147+ build-args : " FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}"
207148 platforms : linux/amd64,linux/arm64
208149 push : ${{ github.ref == 'refs/heads/frankenphp' || github.ref == 'refs/heads/main' || github.event_name == 'release' }}
209- pull : true
150+ pull : false
210151 tags : ${{ steps.meta.outputs.tags }}
211- cache-from : type=local,src=/tmp/.buildx-cache
152+ labels : ${{ steps.meta.outputs.labels }}
153+ cache-from : type=local,src=/tmp/.buildx-cache-new
212154 cache-to : type=local,mode=max,dest=/tmp/.buildx-cache-new
213155
214156 - name : Move cache
0 commit comments