@@ -30,13 +30,37 @@ concurrency:
3030 cancel-in-progress : true
3131
3232jobs :
33+ setup :
34+ runs-on : ubuntu-latest
35+ outputs :
36+ php-versions : ${{ steps.matrix.outputs.php-versions }}
37+ s6-version : ${{ steps.s6.outputs.version }}
38+ steps :
39+ - name : Determine PHP versions to test
40+ id : matrix
41+ run : |
42+ if [ "${{ github.event_name }}" = "pull_request" ]; then
43+ echo 'php-versions=["8.4","8.2"]' >> $GITHUB_OUTPUT
44+ echo "::notice::PR detected — testing PHP 8.4 + 8.2 only (skipping 8.3)"
45+ else
46+ echo 'php-versions=["8.4","8.3","8.2"]' >> $GITHUB_OUTPUT
47+ fi
48+
49+ - name : Get latest s6-overlay version
50+ id : s6
51+ run : |
52+ S6_OVERLAY_VERSION="$(curl -s https://api.github.com/repos/just-containers/s6-overlay/releases/latest | jq -r .tag_name)"
53+ echo "version=${S6_OVERLAY_VERSION}" >> $GITHUB_OUTPUT
54+ echo "✅ Latest s6-overlay version: ${S6_OVERLAY_VERSION}"
55+
3356 build-and-test :
57+ needs : setup
3458 runs-on : ubuntu-latest
3559 strategy :
3660 fail-fast : false
3761 matrix :
3862 variant : [v1, v2]
39- php-version : ['8.4', '8.3', '8.2']
63+ php-version : ${{ fromJson(needs.setup.outputs.php-versions) }}
4064 php-type : [fpm, cli, apache]
4165 php-base : [alpine, bookworm]
4266 exclude :
@@ -88,18 +112,6 @@ jobs:
88112 - name : Checkout
89113 uses : actions/checkout@v4
90114
91- - name : Get latest s6-overlay version
92- id : s6-version
93- run : |
94- S6_OVERLAY_VERSION="$(curl -s https://api.github.com/repos/just-containers/s6-overlay/releases/latest | jq -r .tag_name)"
95- echo "version=${S6_OVERLAY_VERSION}" >> $GITHUB_OUTPUT
96- echo "✅ Latest s6-overlay version: ${S6_OVERLAY_VERSION}"
97-
98- - name : Setup QEMU
99- uses : docker/setup-qemu-action@v3
100- with :
101- platforms : amd64,arm64,arm
102-
103115 - name : Setup Docker Buildx
104116 uses : docker/setup-buildx-action@v3
105117
@@ -138,7 +150,7 @@ jobs:
138150 VERSION=${{ steps.vars.outputs.VERSION }}
139151 PHPVERSION=${{ matrix.php-version }}
140152 BASEOS=${{ matrix.php-base }}
141- S6_OVERLAY_VERSION=${{ steps.s6-version .outputs.version }}
153+ S6_OVERLAY_VERSION=${{ needs.setup .outputs.s6- version }}
142154 BUILD_DATE=${{ steps.vars.outputs.BUILD_DATE }}
143155 VCS_REF=${{ github.sha }}
144156 tags : test-${{ steps.vars.outputs.TAG }}
@@ -295,7 +307,7 @@ jobs:
295307 echo "::notice::✅ Build and tests passed for ${{ matrix.variant }} - ${{ steps.vars.outputs.TAG }}"
296308
297309 publish :
298- needs : build-and-test
310+ needs : [setup, build-and-test]
299311 if : github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'schedule')
300312 runs-on : ubuntu-latest
301313 strategy :
@@ -356,13 +368,6 @@ jobs:
356368 - name : Checkout
357369 uses : actions/checkout@v4
358370
359- - name : Get latest s6-overlay version
360- id : s6-version
361- run : |
362- S6_OVERLAY_VERSION="$(curl -s https://api.github.com/repos/just-containers/s6-overlay/releases/latest | jq -r .tag_name)"
363- echo "version=${S6_OVERLAY_VERSION}" >> $GITHUB_OUTPUT
364- echo "✅ Latest s6-overlay version: ${S6_OVERLAY_VERSION}"
365-
366371 - name : Setup QEMU
367372 uses : docker/setup-qemu-action@v3
368373 with :
@@ -429,7 +434,7 @@ jobs:
429434 VERSION=${{ steps.vars.outputs.VERSION }}
430435 PHPVERSION=${{ matrix.php-version }}
431436 BASEOS=${{ matrix.php-base }}
432- S6_OVERLAY_VERSION=${{ steps.s6-version .outputs.version }}
437+ S6_OVERLAY_VERSION=${{ needs.setup .outputs.s6- version }}
433438 BUILD_DATE=${{ steps.vars.outputs.BUILD_DATE }}
434439 VCS_REF=${{ github.sha }}
435440 tags : |
0 commit comments