From 1f612e7c3610a4317411932a34bd2a208c3e4013 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Tue, 23 Apr 2024 16:49:00 +0100 Subject: [PATCH 01/13] Create build-windows-x86_64.yml --- .github/workflows/build-windows-x86_64.yml | 112 +++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 .github/workflows/build-windows-x86_64.yml diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml new file mode 100644 index 000000000..54f2fa388 --- /dev/null +++ b/.github/workflows/build-windows-x86_64.yml @@ -0,0 +1,112 @@ +name: CI on x86_64 Windows + +on: + workflow_dispatch: + inputs: + version: + required: true + description: php version to compile + default: '8.2' + type: choice + options: + - '8.3' + - '8.2' + - '8.1' + - '8.0' + - '7.4' + build-cli: + description: build cli binary + default: true + type: boolean + build-micro: + description: build phpmicro binary + type: boolean + build-fpm: + description: build fpm binary + type: boolean + extensions: + description: extensions to compile (comma separated) + required: true + type: string + debug: + type: boolean + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build: + name: build ${{ inputs.version }} on Windows x86_64 + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + + # Cache composer dependencies + - id: cache-composer-deps + uses: actions/cache@v3 + with: + path: vendor + key: composer-dependencies + + # If there's no Composer cache, install dependencies + - if: steps.cache-composer-deps.outputs.cache-hit != 'true' + run: composer update --no-dev --classmap-authoritative + + # Cache downloaded source + - id: cache-download + uses: actions/cache@v3 + with: + path: downloads + key: php-${{ inputs.version }}-dependencies-${{ inputs.extensions }} + + # With or without debug + - if: inputs.debug == true + run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV + + # With target select: cli, micro or both + - if: ${{ inputs.build-cli == true }} + run: echo "SPC_BUILD_CLI=--build-cli" >> $GITHUB_ENV + - if: ${{ inputs.build-micro == true }} + run: echo "SPC_BUILD_MICRO=--build-micro" >> $GITHUB_ENV + - if: ${{ inputs.build-fpm == true }} + run: echo "SPC_BUILD_FPM=--build-fpm" >> $GITHUB_ENV + + # If there's no dependencies cache, fetch sources, with or without debug + - if: steps.cache-download.outputs.cache-hit != 'true' + run: ./bin/spc download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} + + # Run build command + - run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }} + + # Upload cli executable + - if: ${{ inputs.build-cli == true }} + uses: actions/upload-artifact@v3 + with: + name: php-${{ inputs.version }}-${{ env.SPC_BUILD_OS }} + path: buildroot/bin/php + + # Upload micro self-extracted executable + - if: ${{ inputs.build-micro == true }} + uses: actions/upload-artifact@v3 + with: + name: micro-${{ inputs.version }}-${{ env.SPC_BUILD_OS }} + path: buildroot/bin/micro.sfx + + # Upload fpm executable + - if: ${{ inputs.build-fpm == true }} + uses: actions/upload-artifact@v3 + with: + name: php-fpm-${{ inputs.version }}-${{ env.SPC_BUILD_OS }} + path: buildroot/bin/php-fpm + + # Upload extensions metadata + - uses: actions/upload-artifact@v3 + with: + name: license-files + path: buildroot/license/ + - uses: actions/upload-artifact@v3 + with: + name: build-meta + path: | + buildroot/build-extensions.json + buildroot/build-libraries.json From 3c0c3f7ad586082ec81d4a5065890be41826af12 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Tue, 23 Apr 2024 17:13:47 +0100 Subject: [PATCH 02/13] Update build-windows-x86_64.yml --- .github/workflows/build-windows-x86_64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml index 54f2fa388..3a50dba1e 100644 --- a/.github/workflows/build-windows-x86_64.yml +++ b/.github/workflows/build-windows-x86_64.yml @@ -73,7 +73,7 @@ jobs: # If there's no dependencies cache, fetch sources, with or without debug - if: steps.cache-download.outputs.cache-hit != 'true' - run: ./bin/spc download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} + run: ./bin/spc download --with-php="${{ inputs.version }}" --for-extensions="${{ inputs.extensions }}" ${{ env.SPC_BUILD_DEBUG }} # Run build command - run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }} From 3deb44b79fe849d4dc9b025c7829e8212a58c923 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Tue, 23 Apr 2024 17:20:00 +0100 Subject: [PATCH 03/13] Fix CLI param --- .github/workflows/build-windows-x86_64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml index 3a50dba1e..728f4a57d 100644 --- a/.github/workflows/build-windows-x86_64.yml +++ b/.github/workflows/build-windows-x86_64.yml @@ -76,7 +76,7 @@ jobs: run: ./bin/spc download --with-php="${{ inputs.version }}" --for-extensions="${{ inputs.extensions }}" ${{ env.SPC_BUILD_DEBUG }} # Run build command - - run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }} + - run: ./bin/spc build "${{ inputs.extensions }}" ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }} # Upload cli executable - if: ${{ inputs.build-cli == true }} From b87e1dca3a0658aa8634d8237782867b7ade79e0 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Tue, 23 Apr 2024 17:32:24 +0100 Subject: [PATCH 04/13] Fix env writing in Powershell --- .github/workflows/build-windows-x86_64.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml index 728f4a57d..3f5318742 100644 --- a/.github/workflows/build-windows-x86_64.yml +++ b/.github/workflows/build-windows-x86_64.yml @@ -61,15 +61,15 @@ jobs: # With or without debug - if: inputs.debug == true - run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV + run: echo "SPC_BUILD_DEBUG=--debug" >> $env:GITHUB_ENV # With target select: cli, micro or both - if: ${{ inputs.build-cli == true }} - run: echo "SPC_BUILD_CLI=--build-cli" >> $GITHUB_ENV + run: echo "SPC_BUILD_CLI=--build-cli" >> $env:GITHUB_ENV - if: ${{ inputs.build-micro == true }} - run: echo "SPC_BUILD_MICRO=--build-micro" >> $GITHUB_ENV + run: echo "SPC_BUILD_MICRO=--build-micro" >> $env:GITHUB_ENV - if: ${{ inputs.build-fpm == true }} - run: echo "SPC_BUILD_FPM=--build-fpm" >> $GITHUB_ENV + run: echo "SPC_BUILD_FPM=--build-fpm" >> $env:GITHUB_ENV # If there's no dependencies cache, fetch sources, with or without debug - if: steps.cache-download.outputs.cache-hit != 'true' From 6804092cd8a51a721353279141cc779b3b76032c Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Tue, 23 Apr 2024 18:14:59 +0100 Subject: [PATCH 05/13] Run doctor first, per docs --- .github/workflows/build-windows-x86_64.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml index 3f5318742..759d89220 100644 --- a/.github/workflows/build-windows-x86_64.yml +++ b/.github/workflows/build-windows-x86_64.yml @@ -71,6 +71,8 @@ jobs: - if: ${{ inputs.build-fpm == true }} run: echo "SPC_BUILD_FPM=--build-fpm" >> $env:GITHUB_ENV + - run: ./bin/spc doctor + # If there's no dependencies cache, fetch sources, with or without debug - if: steps.cache-download.outputs.cache-hit != 'true' run: ./bin/spc download --with-php="${{ inputs.version }}" --for-extensions="${{ inputs.extensions }}" ${{ env.SPC_BUILD_DEBUG }} From 910e8231156713e9c271d80dca8322aeacdc3d8c Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Tue, 23 Apr 2024 21:42:55 +0100 Subject: [PATCH 06/13] Fix file paths --- .github/workflows/build-windows-x86_64.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml index 759d89220..21af0568a 100644 --- a/.github/workflows/build-windows-x86_64.yml +++ b/.github/workflows/build-windows-x86_64.yml @@ -85,7 +85,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: php-${{ inputs.version }}-${{ env.SPC_BUILD_OS }} - path: buildroot/bin/php + path: buildroot/bin/php.exe # Upload micro self-extracted executable - if: ${{ inputs.build-micro == true }} @@ -99,7 +99,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: php-fpm-${{ inputs.version }}-${{ env.SPC_BUILD_OS }} - path: buildroot/bin/php-fpm + path: buildroot/bin/php-fpm.exe # Upload extensions metadata - uses: actions/upload-artifact@v3 From e1b9f9ac5dbfcb85ae99e95fb0b227672ad6444b Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Tue, 23 Apr 2024 21:58:10 +0100 Subject: [PATCH 07/13] Generate an acceptable cache key --- .github/workflows/build-windows-x86_64.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml index 21af0568a..7fe022417 100644 --- a/.github/workflows/build-windows-x86_64.yml +++ b/.github/workflows/build-windows-x86_64.yml @@ -52,12 +52,18 @@ jobs: - if: steps.cache-composer-deps.outputs.cache-hit != 'true' run: composer update --no-dev --classmap-authoritative + - name: Generate hashed key for cache + id: cache-key + run: | + INPUT_HASH=$(echo "${{ inputs.version }}-dependencies-${{ inputs.extensions }}" | sha256sum | awk '{print $1}') + echo "::set-output name=hash::$INPUT_HASH" + # Cache downloaded source - id: cache-download uses: actions/cache@v3 with: path: downloads - key: php-${{ inputs.version }}-dependencies-${{ inputs.extensions }} + key: php-${{ steps.cache-key.outputs.hash }} # With or without debug - if: inputs.debug == true From 53b52fde30fc966cb7009978f48fbb90dadadd59 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Tue, 23 Apr 2024 22:04:21 +0100 Subject: [PATCH 08/13] Change shell --- .github/workflows/build-windows-x86_64.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml index 7fe022417..d6baba230 100644 --- a/.github/workflows/build-windows-x86_64.yml +++ b/.github/workflows/build-windows-x86_64.yml @@ -54,6 +54,7 @@ jobs: - name: Generate hashed key for cache id: cache-key + shell: bash run: | INPUT_HASH=$(echo "${{ inputs.version }}-dependencies-${{ inputs.extensions }}" | sha256sum | awk '{print $1}') echo "::set-output name=hash::$INPUT_HASH" From ae3898cdca694dddc7ff39851b2e557dff3c1eb3 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Tue, 23 Apr 2024 22:09:59 +0100 Subject: [PATCH 09/13] Improve cache key generation --- .github/workflows/build-windows-x86_64.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml index d6baba230..cbdb5870b 100644 --- a/.github/workflows/build-windows-x86_64.yml +++ b/.github/workflows/build-windows-x86_64.yml @@ -52,19 +52,18 @@ jobs: - if: steps.cache-composer-deps.outputs.cache-hit != 'true' run: composer update --no-dev --classmap-authoritative - - name: Generate hashed key for cache - id: cache-key + - name: Generate hashed key for download cache shell: bash run: | - INPUT_HASH=$(echo "${{ inputs.version }}-dependencies-${{ inputs.extensions }}" | sha256sum | awk '{print $1}') - echo "::set-output name=hash::$INPUT_HASH" + INPUT_HASH=$(echo "${{ runner.os }}-${{ inputs.version }}-${{ inputs.extensions }}" | sha256sum | awk '{print $1}') + echo "INPUT_HASH=${INPUT_HASH}" >> $env:GITHUB_ENV # Cache downloaded source - id: cache-download uses: actions/cache@v3 with: path: downloads - key: php-${{ steps.cache-key.outputs.hash }} + key: php-${{ env.INPUT_HASH }} # With or without debug - if: inputs.debug == true From 4687be72459124e11afc351def7c8c64a38a0bee Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Tue, 23 Apr 2024 23:49:41 +0100 Subject: [PATCH 10/13] Update upload-artifact action --- .github/workflows/build-windows-x86_64.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml index cbdb5870b..81bd1a267 100644 --- a/.github/workflows/build-windows-x86_64.yml +++ b/.github/workflows/build-windows-x86_64.yml @@ -88,31 +88,31 @@ jobs: # Upload cli executable - if: ${{ inputs.build-cli == true }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: php-${{ inputs.version }}-${{ env.SPC_BUILD_OS }} + name: php-${{ inputs.version }} path: buildroot/bin/php.exe # Upload micro self-extracted executable - if: ${{ inputs.build-micro == true }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: micro-${{ inputs.version }}-${{ env.SPC_BUILD_OS }} + name: micro-${{ inputs.version }} path: buildroot/bin/micro.sfx # Upload fpm executable - if: ${{ inputs.build-fpm == true }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: php-fpm-${{ inputs.version }}-${{ env.SPC_BUILD_OS }} + name: php-fpm-${{ inputs.version }} path: buildroot/bin/php-fpm.exe # Upload extensions metadata - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: license-files path: buildroot/license/ - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: build-meta path: | From be5df9a1537217238bbb6cce89bf69129a0c5506 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Wed, 24 Apr 2024 00:17:40 +0100 Subject: [PATCH 11/13] Update actions --- .github/workflows/build-windows-x86_64.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml index 81bd1a267..a23993c97 100644 --- a/.github/workflows/build-windows-x86_64.yml +++ b/.github/workflows/build-windows-x86_64.yml @@ -39,11 +39,11 @@ jobs: name: build ${{ inputs.version }} on Windows x86_64 runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Cache composer dependencies - id: cache-composer-deps - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: vendor key: composer-dependencies @@ -60,7 +60,7 @@ jobs: # Cache downloaded source - id: cache-download - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: downloads key: php-${{ env.INPUT_HASH }} From abfa4c9373c0a512577ae182c2bccc6fa9cfc0cc Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Fri, 26 Apr 2024 14:47:34 +0100 Subject: [PATCH 12/13] Attempt to fix cache key storage --- .github/workflows/build-windows-x86_64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml index a23993c97..659a931a9 100644 --- a/.github/workflows/build-windows-x86_64.yml +++ b/.github/workflows/build-windows-x86_64.yml @@ -56,7 +56,7 @@ jobs: shell: bash run: | INPUT_HASH=$(echo "${{ runner.os }}-${{ inputs.version }}-${{ inputs.extensions }}" | sha256sum | awk '{print $1}') - echo "INPUT_HASH=${INPUT_HASH}" >> $env:GITHUB_ENV + echo "INPUT_HASH=${INPUT_HASH}" >> "$GITHUB_ENV" # Cache downloaded source - id: cache-download From 9f066702cd66c724c00942f2cf031598f1cd60ac Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Mon, 6 May 2024 04:37:28 +0100 Subject: [PATCH 13/13] Remove FPM build option --- .github/workflows/build-windows-x86_64.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml index 659a931a9..e6665d669 100644 --- a/.github/workflows/build-windows-x86_64.yml +++ b/.github/workflows/build-windows-x86_64.yml @@ -21,9 +21,6 @@ on: build-micro: description: build phpmicro binary type: boolean - build-fpm: - description: build fpm binary - type: boolean extensions: description: extensions to compile (comma separated) required: true @@ -74,8 +71,6 @@ jobs: run: echo "SPC_BUILD_CLI=--build-cli" >> $env:GITHUB_ENV - if: ${{ inputs.build-micro == true }} run: echo "SPC_BUILD_MICRO=--build-micro" >> $env:GITHUB_ENV - - if: ${{ inputs.build-fpm == true }} - run: echo "SPC_BUILD_FPM=--build-fpm" >> $env:GITHUB_ENV - run: ./bin/spc doctor @@ -100,13 +95,6 @@ jobs: name: micro-${{ inputs.version }} path: buildroot/bin/micro.sfx - # Upload fpm executable - - if: ${{ inputs.build-fpm == true }} - uses: actions/upload-artifact@v4 - with: - name: php-fpm-${{ inputs.version }} - path: buildroot/bin/php-fpm.exe - # Upload extensions metadata - uses: actions/upload-artifact@v4 with: