Repository navigation
test: clear the last error in the parse errors worker script #5859
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Build binary releases | |
| concurrency: | |
| cancel-in-progress: true | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled] | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - v*.*.* | |
| workflow_dispatch: | |
| inputs: | |
| #checkov:skip=CKV_GHA_7 | |
| version: | |
| description: "FrankenPHP version" | |
| required: false | |
| type: string | |
| schedule: | |
| - cron: "0 0 * * *" | |
| permissions: | |
| contents: read | |
| env: | |
| IMAGE_NAME: ${{ (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.version) || startsWith(github.ref, 'refs/tags/')) && 'dunglas/frankenphp' || 'dunglas/frankenphp-dev' }} | |
| GOTOOLCHAIN: local | |
| jobs: | |
| prepare: | |
| if: "github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'CI: All jobs')" | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| push: ${{ toJson((steps.check.outputs.ref || (github.event_name == 'workflow_dispatch' && inputs.version) || startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')) && true || false) }} | |
| platforms: ${{ steps.matrix.outputs.platforms }} | |
| metadata: ${{ steps.matrix.outputs.metadata }} | |
| gnu_metadata: ${{ steps.matrix.outputs.gnu_metadata }} | |
| ref: ${{ steps.check.outputs.ref }} | |
| steps: | |
| - name: Get version | |
| id: check | |
| if: github.event_name == 'schedule' | |
| run: | | |
| ref="${REF}" | |
| if [[ -z "${ref}" ]]; then | |
| ref="$(gh release view --repo dunglas/frankenphp --json tagName --jq '.tagName')" | |
| fi | |
| echo "ref=${ref}" >> "${GITHUB_OUTPUT}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REF: ${{ (github.ref_type == 'tag' && github.ref_name) || (github.event_name == 'workflow_dispatch' && inputs.version) || '' }} | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| ref: ${{ steps.check.outputs.ref }} | |
| persist-credentials: false | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 | |
| - name: Create platforms matrix | |
| id: matrix | |
| run: | | |
| METADATA="$(docker buildx bake --print static-builder-musl | jq -c)" | |
| GNU_METADATA="$(docker buildx bake --print static-builder-gnu | jq -c)" | |
| { | |
| echo metadata="${METADATA}" | |
| echo platforms="$(jq -c 'first(.target[]) | .platforms' <<< "${METADATA}")" | |
| echo gnu_metadata="${GNU_METADATA}" | |
| } >> "${GITHUB_OUTPUT}" | |
| env: | |
| SHA: ${{ github.sha }} | |
| VERSION: ${{ (github.ref_type == 'tag' && github.ref_name) || steps.check.outputs.ref || 'dev' }} | |
| build-linux-musl: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| attestations: write | |
| artifact-metadata: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: ${{ fromJson(needs.prepare.outputs.platforms) }} | |
| debug: [false] | |
| mimalloc: [false] | |
| include: | |
| - platform: linux/amd64 | |
| - platform: linux/amd64 | |
| debug: true | |
| - platform: linux/amd64 | |
| mimalloc: true | |
| name: Build ${{ matrix.platform }} static musl binary${{ matrix.debug && ' (debug)' || '' }}${{ matrix.mimalloc && ' (mimalloc)' || '' }} | |
| runs-on: ${{ startsWith(matrix.platform, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} | |
| needs: [prepare] | |
| steps: | |
| - name: Prepare | |
| id: prepare | |
| run: echo "sanitized_platform=${PLATFORM//\//-}" >> "${GITHUB_OUTPUT}" | |
| env: | |
| PLATFORM: ${{ matrix.platform }} | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| ref: ${{ needs.prepare.outputs.ref }} | |
| persist-credentials: false | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 | |
| with: | |
| platforms: ${{ matrix.platform }} | |
| - name: Login to DockerHub | |
| uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0 | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
| with: | |
| username: ${{ vars.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} # zizmor: ignore[secrets-outside-env] TODO: drop once super-linter ships zizmor >=1.24.0, then the allowlist in zizmor.yaml takes over | |
| - name: Set VERSION | |
| run: | | |
| if [ "${GITHUB_REF_TYPE}" == "tag" ]; then | |
| export VERSION=${GITHUB_REF_NAME:1} | |
| elif [ "${GITHUB_EVENT_NAME}" == "schedule" ]; then | |
| export VERSION="${REF}" | |
| else | |
| export VERSION=${GITHUB_SHA} | |
| fi | |
| echo "VERSION=${VERSION}" >> "${GITHUB_ENV}" | |
| env: | |
| REF: ${{ needs.prepare.outputs.ref }} | |
| - name: Build | |
| id: build | |
| uses: docker/bake-action@59cb1203cd42bcefd40a1b6d73b589e48c86040e # v7.5.0 | |
| with: | |
| pull: true | |
| load: true | |
| source: . | |
| targets: static-builder-musl | |
| set: | | |
| ${{ matrix.debug && 'static-builder-musl.args.DEBUG_SYMBOLS=1' || '' }} | |
| ${{ matrix.mimalloc && 'static-builder-musl.args.MIMALLOC=1' || '' }} | |
| *.tags=frankenphp-static-builder-musl:ci | |
| *.platform=${{ matrix.platform }} | |
| ${{ !fromJson(needs.prepare.outputs.push) && format('*.cache-from=type=gha,scope={0}-static-builder-musl{1}{2}', needs.prepare.outputs.ref || github.ref, matrix.debug && '-debug' || '', matrix.mimalloc && '-mimalloc' || '') || '' }} | |
| ${{ !fromJson(needs.prepare.outputs.push) && format('*.cache-from=type=gha,scope=refs/heads/main-static-builder-musl{0}{1}', matrix.debug && '-debug' || '', matrix.mimalloc && '-mimalloc' || '') || '' }} | |
| ${{ format('*.cache-to=type=gha,scope={0}-static-builder-musl{1}{2},ignore-error=true', needs.prepare.outputs.ref || github.ref, matrix.debug && '-debug' || '', matrix.mimalloc && '-mimalloc' || '') }} | |
| env: | |
| SHA: ${{ github.sha }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build FrankenPHP | |
| run: | | |
| mkdir -p output | |
| docker run --rm --platform="${PLATFORM}" --ulimit nofile=8192:8192 -v "${PWD}/output:/output" -e OUTPUT_DIR=/output -e SPC_LOGS_DIR=/output/log -e GITHUB_TOKEN ${DEBUG_SYMBOLS:+-e DEBUG_SYMBOLS} ${MIMALLOC:+-e MIMALLOC} frankenphp-static-builder-musl:ci | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PLATFORM: ${{ matrix.platform }} | |
| DEBUG_SYMBOLS: ${{ matrix.debug && '1' || '' }} | |
| MIMALLOC: ${{ matrix.mimalloc && '1' || '' }} | |
| - name: Upload static-php-cli logs | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: static-php-cli-log-musl-${{ steps.prepare.outputs.sanitized_platform }}${{ matrix.debug && '-debug' || '' }}${{ matrix.mimalloc && '-mimalloc' || '' }}-${{ github.sha }} | |
| path: output/log | |
| if-no-files-found: warn | |
| - name: Push the builder image | |
| id: push | |
| if: fromJson(needs.prepare.outputs.push) && !matrix.debug && !matrix.mimalloc | |
| uses: docker/bake-action@59cb1203cd42bcefd40a1b6d73b589e48c86040e # v7.5.0 | |
| with: | |
| source: . | |
| targets: static-builder-musl | |
| set: | | |
| *.tags= | |
| *.platform=${{ matrix.platform }} | |
| *.output=type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true | |
| env: | |
| SHA: ${{ github.sha }} | |
| - # Workaround for https://github.com/actions/runner/pull/2477#issuecomment-1501003600 | |
| name: Export metadata | |
| if: fromJson(needs.prepare.outputs.push) && !matrix.debug && !matrix.mimalloc | |
| run: | | |
| mkdir -p /tmp/metadata | |
| # shellcheck disable=SC2086 | |
| digest=$(jq -r '."static-builder-musl"."containerimage.digest"' <<< "${METADATA}") | |
| touch "/tmp/metadata/${digest#sha256:}" | |
| env: | |
| METADATA: ${{ steps.push.outputs.metadata }} | |
| - name: Upload metadata | |
| if: fromJson(needs.prepare.outputs.push) && !matrix.debug && !matrix.mimalloc | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: metadata-static-builder-musl-${{ steps.prepare.outputs.sanitized_platform }} | |
| path: /tmp/metadata/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| - name: Copy binary | |
| run: | | |
| cp "output/${BINARY}" "${BINARY}${{ matrix.debug && '-debug' || '' }}${{ matrix.mimalloc && '-mimalloc' || '' }}" | |
| env: | |
| BINARY: frankenphp-linux-${{ matrix.platform == 'linux/amd64' && 'x86_64' || 'aarch64' }} | |
| - name: Upload artifact | |
| if: ${{ !fromJson(needs.prepare.outputs.push) }} | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: frankenphp-linux-${{ matrix.platform == 'linux/amd64' && 'x86_64' || 'aarch64' }}${{ matrix.debug && '-debug' || '' }}${{ matrix.mimalloc && '-mimalloc' || '' }} | |
| path: frankenphp-linux-${{ matrix.platform == 'linux/amd64' && 'x86_64' || 'aarch64' }}${{ matrix.debug && '-debug' || '' }}${{ matrix.mimalloc && '-mimalloc' || '' }} | |
| compression-level: 0 | |
| - name: Upload assets | |
| if: fromJson(needs.prepare.outputs.push) && (needs.prepare.outputs.ref || github.ref_type == 'tag') | |
| run: gh release upload "${REF}" frankenphp-linux-${{ matrix.platform == 'linux/amd64' && 'x86_64' || 'aarch64' }}${{ matrix.debug && '-debug' || '' }}${{ matrix.mimalloc && '-mimalloc' || '' }} --repo dunglas/frankenphp --clobber | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REF: ${{ (github.ref_type == 'tag' && github.ref_name) || needs.prepare.outputs.ref }} | |
| - if: fromJson(needs.prepare.outputs.push) && (needs.prepare.outputs.ref || github.ref_type == 'tag') | |
| uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 | |
| with: | |
| subject-path: ${{ github.workspace }}/frankenphp-linux-* | |
| - name: Run sanity checks | |
| run: | | |
| "${BINARY}" version | |
| "${BINARY}" build-info | |
| "${BINARY}" list-modules | grep frankenphp | |
| "${BINARY}" list-modules | grep http.encoders.br | |
| "${BINARY}" list-modules | grep http.handlers.mercure | |
| "${BINARY}" list-modules | grep http.handlers.mercure | |
| "${BINARY}" list-modules | grep http.handlers.vulcain | |
| "${BINARY}" php-cli -r "echo 'Sanity check passed';" | |
| env: | |
| BINARY: ./frankenphp-linux-${{ matrix.platform == 'linux/amd64' && 'x86_64' || 'aarch64' }}${{ matrix.debug && '-debug' || '' }}${{ matrix.mimalloc && '-mimalloc' || '' }} | |
| build-linux-gnu: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| attestations: write | |
| artifact-metadata: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: ${{ fromJson(needs.prepare.outputs.platforms) }} | |
| name: Build ${{ matrix.platform }} static GNU binary | |
| runs-on: ${{ startsWith(matrix.platform, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} | |
| needs: [prepare] | |
| steps: | |
| # Inspired by https://gist.github.com/antiphishfish/1e3fbc3f64ef6f1ab2f47457d2da5d9d and https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh | |
| - name: Free disk space | |
| run: | | |
| set -xe | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/share/swift | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /usr/local/.ghcup | |
| sudo rm -rf "/usr/local/share/boost" | |
| sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
| sudo rm -rf /opt/hostedtoolcache/ | |
| sudo rm -rf /usr/local/graalvm/ | |
| sudo rm -rf /usr/local/share/powershell | |
| sudo rm -rf /usr/local/share/chromium | |
| sudo rm -rf /usr/local/lib/node_modules | |
| sudo docker image prune --all --force | |
| APT_PARAMS='sudo apt -y -qq -o=Dpkg::Use-Pty=0' | |
| $APT_PARAMS remove -y '^dotnet-.*' | |
| $APT_PARAMS remove -y '^llvm-.*' | |
| $APT_PARAMS remove -y '^php.*' | |
| $APT_PARAMS remove -y '^mongodb-.*' | |
| $APT_PARAMS remove -y '^mysql-.*' | |
| $APT_PARAMS remove -y azure-cli firefox powershell mono-devel libgl1-mesa-dri | |
| $APT_PARAMS autoremove --purge -y | |
| $APT_PARAMS autoclean | |
| $APT_PARAMS clean | |
| - name: Prepare | |
| id: prepare | |
| run: echo "sanitized_platform=${PLATFORM//\//-}" >> "${GITHUB_OUTPUT}" | |
| env: | |
| PLATFORM: ${{ matrix.platform }} | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| ref: ${{ needs.prepare.outputs.ref }} | |
| persist-credentials: false | |
| - name: Set VERSION | |
| run: | | |
| if [ "${GITHUB_REF_TYPE}" == "tag" ]; then | |
| export VERSION=${GITHUB_REF_NAME:1} | |
| elif [ "${GITHUB_EVENT_NAME}" == "schedule" ]; then | |
| export VERSION="${REF}" | |
| else | |
| export VERSION=${GITHUB_SHA} | |
| fi | |
| echo "VERSION=${VERSION}" >> "${GITHUB_ENV}" | |
| env: | |
| REF: ${{ needs.prepare.outputs.ref }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 | |
| with: | |
| platforms: ${{ matrix.platform }} | |
| - name: Login to DockerHub | |
| uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0 | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
| with: | |
| username: ${{ vars.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} # zizmor: ignore[secrets-outside-env] TODO: drop once super-linter ships zizmor >=1.24.0, then the allowlist in zizmor.yaml takes over | |
| - name: Build | |
| id: build | |
| uses: docker/bake-action@59cb1203cd42bcefd40a1b6d73b589e48c86040e # v7.5.0 | |
| with: | |
| pull: true | |
| load: true | |
| source: . | |
| targets: static-builder-gnu | |
| set: | | |
| *.tags=frankenphp-static-builder-gnu:ci | |
| *.platform=${{ matrix.platform }} | |
| ${{ !fromJson(needs.prepare.outputs.push) && format('*.cache-from=type=gha,scope={0}-static-builder-gnu', needs.prepare.outputs.ref || github.ref) || '' }} | |
| ${{ !fromJson(needs.prepare.outputs.push) && '*.cache-from=type=gha,scope=refs/heads/main-static-builder-gnu' || '' }} | |
| ${{ format('*.cache-to=type=gha,scope={0}-static-builder-gnu,ignore-error=true', needs.prepare.outputs.ref || github.ref) }} | |
| env: | |
| SHA: ${{ github.sha }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build FrankenPHP | |
| run: | | |
| mkdir -p output | |
| docker run --rm --platform="${PLATFORM}" --ulimit nofile=8192:8192 -v "${PWD}/output:/output" -e OUTPUT_DIR=/output -e SPC_LOGS_DIR=/output/log -e GITHUB_TOKEN frankenphp-static-builder-gnu:ci | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PLATFORM: ${{ matrix.platform }} | |
| - name: Upload static-php-cli logs | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: static-php-cli-log-gnu-${{ steps.prepare.outputs.sanitized_platform }}-${{ github.sha }} | |
| path: output/log | |
| if-no-files-found: warn | |
| - name: Push the builder image | |
| id: push | |
| if: fromJson(needs.prepare.outputs.push) | |
| uses: docker/bake-action@59cb1203cd42bcefd40a1b6d73b589e48c86040e # v7.5.0 | |
| with: | |
| source: . | |
| targets: static-builder-gnu | |
| set: | | |
| *.tags= | |
| *.platform=${{ matrix.platform }} | |
| *.output=type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true | |
| env: | |
| SHA: ${{ github.sha }} | |
| - # Workaround for https://github.com/actions/runner/pull/2477#issuecomment-1501003600 | |
| name: Export metadata | |
| if: fromJson(needs.prepare.outputs.push) | |
| run: | | |
| mkdir -p /tmp/metadata-gnu | |
| # shellcheck disable=SC2086 | |
| digest=$(jq -r '."static-builder-gnu"."containerimage.digest"' <<< "${METADATA}") | |
| touch "/tmp/metadata-gnu/${digest#sha256:}" | |
| env: | |
| METADATA: ${{ steps.push.outputs.metadata }} | |
| - name: Upload metadata | |
| if: fromJson(needs.prepare.outputs.push) | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: metadata-static-builder-gnu-${{ steps.prepare.outputs.sanitized_platform }} | |
| path: /tmp/metadata-gnu/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| - name: Copy all frankenphp* files | |
| run: | | |
| mkdir -p gh-output | |
| cp output/frankenphp* gh-output/ | |
| mv "gh-output/${BINARY}" "gh-output/${BINARY}-gnu" | |
| env: | |
| BINARY: frankenphp-linux-${{ matrix.platform == 'linux/amd64' && 'x86_64' || 'aarch64' }} | |
| - name: Upload artifact | |
| if: ${{ !fromJson(needs.prepare.outputs.push) }} | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: frankenphp-linux-${{ matrix.platform == 'linux/amd64' && 'x86_64' || 'aarch64' }}-gnu-files | |
| path: gh-output/* | |
| - name: Upload assets | |
| if: fromJson(needs.prepare.outputs.push) && (needs.prepare.outputs.ref || github.ref_type == 'tag') | |
| run: gh release upload "${REF}" gh-output/* --repo dunglas/frankenphp --clobber | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REF: ${{ (github.ref_type == 'tag' && github.ref_name) || needs.prepare.outputs.ref }} | |
| - if: fromJson(needs.prepare.outputs.push) && (needs.prepare.outputs.ref || github.ref_type == 'tag') | |
| uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 | |
| with: | |
| subject-path: ${{ github.workspace }}/gh-output/frankenphp-linux-*-gnu | |
| - name: Run sanity checks | |
| run: | | |
| "${BINARY}" version | |
| "${BINARY}" list-modules | grep frankenphp | |
| "${BINARY}" list-modules | grep http.encoders.br | |
| "${BINARY}" list-modules | grep http.handlers.mercure | |
| "${BINARY}" list-modules | grep http.handlers.mercure | |
| "${BINARY}" list-modules | grep http.handlers.vulcain | |
| "${BINARY}" php-cli -r "echo 'Sanity check passed';" | |
| env: | |
| BINARY: ./gh-output/frankenphp-linux-${{ matrix.platform == 'linux/amd64' && 'x86_64' || 'aarch64' }}-gnu | |
| # Adapted from https://docs.docker.com/build/ci/github-actions/multi-platform/ | |
| push: | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - prepare | |
| - build-linux-musl | |
| - build-linux-gnu | |
| if: fromJson(needs.prepare.outputs.push) | |
| steps: | |
| - name: Download metadata | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| pattern: metadata-static-builder-musl-* | |
| path: /tmp/metadata | |
| merge-multiple: true | |
| - name: Download GNU metadata | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| pattern: metadata-static-builder-gnu-* | |
| path: /tmp/metadata-gnu | |
| merge-multiple: true | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0 | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
| with: | |
| username: ${{ vars.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} # zizmor: ignore[secrets-outside-env] TODO: drop once super-linter ships zizmor >=1.24.0, then the allowlist in zizmor.yaml takes over | |
| - name: Create manifest list and push | |
| working-directory: /tmp/metadata | |
| run: | | |
| # shellcheck disable=SC2046,SC2086 | |
| docker buildx imagetools create $(jq -cr '.target."static-builder-musl".tags | map("-t " + .) | join(" ")' <<< "${METADATA}") \ | |
| $(printf "${IMAGE_NAME}@sha256:%s " *) | |
| env: | |
| METADATA: ${{ needs.prepare.outputs.metadata }} | |
| - name: Create GNU manifest list and push | |
| working-directory: /tmp/metadata-gnu | |
| run: | | |
| # shellcheck disable=SC2046,SC2086 | |
| docker buildx imagetools create $(jq -cr '.target."static-builder-gnu".tags | map("-t " + .) | join(" ")' <<< "${GNU_METADATA}") \ | |
| $(printf "${IMAGE_NAME}@sha256:%s " *) | |
| env: | |
| GNU_METADATA: ${{ needs.prepare.outputs.gnu_metadata }} | |
| - name: Inspect image | |
| run: | | |
| # shellcheck disable=SC2046,SC2086 | |
| docker buildx imagetools inspect "$(jq -cr '.target."static-builder-musl".tags | first' <<< "${METADATA}")" | |
| env: | |
| METADATA: ${{ needs.prepare.outputs.metadata }} | |
| - name: Inspect GNU image | |
| run: | | |
| # shellcheck disable=SC2046,SC2086 | |
| docker buildx imagetools inspect "$(jq -cr '.target."static-builder-gnu".tags | first' <<< "${GNU_METADATA}")" | |
| env: | |
| GNU_METADATA: ${{ needs.prepare.outputs.gnu_metadata }} | |
| build-mac: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| attestations: write | |
| artifact-metadata: write | |
| name: Build macOS arm64 binaries | |
| runs-on: macos-15 | |
| needs: [prepare] | |
| env: | |
| HOMEBREW_NO_AUTO_UPDATE: 1 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| ref: ${{ needs.prepare.outputs.ref }} | |
| persist-credentials: false | |
| - uses: ./.github/actions/setup-go | |
| with: | |
| cache: ${{ !(needs.prepare.outputs.ref || github.ref_type == 'tag') }} | |
| - id: version | |
| uses: ./.github/actions/version | |
| with: | |
| ref: ${{ needs.prepare.outputs.ref }} | |
| - name: Build FrankenPHP | |
| run: ./build-static.sh | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| FRANKENPHP_VERSION: ${{ steps.version.outputs.version }} | |
| RELEASE: ${{ (needs.prepare.outputs.ref || github.ref_type == 'tag') && '1' || '' }} | |
| - name: Upload logs | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| path: dist/log | |
| name: static-php-cli-log-arm64-${{ github.sha }} | |
| - if: needs.prepare.outputs.ref || github.ref_type == 'tag' | |
| uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 | |
| with: | |
| subject-path: ${{ github.workspace }}/dist/frankenphp-mac-* | |
| - name: Upload artifact | |
| if: github.ref_type == 'branch' | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: frankenphp-mac-arm64 | |
| path: dist/frankenphp-mac-arm64 | |
| compression-level: 0 | |
| - name: Run sanity checks | |
| run: | | |
| "${BINARY}" version | |
| "${BINARY}" build-info | |
| "${BINARY}" list-modules | grep frankenphp | |
| "${BINARY}" list-modules | grep http.encoders.br | |
| "${BINARY}" list-modules | grep http.handlers.mercure | |
| "${BINARY}" list-modules | grep http.handlers.mercure | |
| "${BINARY}" list-modules | grep http.handlers.vulcain | |
| "${BINARY}" php-cli -r "echo 'Sanity check passed';" | |
| env: | |
| BINARY: dist/frankenphp-mac-arm64 |