From 6b01a1f1a7b43837eb607b9c50b2030fa95484b6 Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Thu, 19 Sep 2024 09:16:01 +0100 Subject: [PATCH 1/4] Added a composer.json to enable support for PIE --- composer.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 236acbc..767f666 100644 --- a/composer.json +++ b/composer.json @@ -4,15 +4,16 @@ "license": "PHP-3.01", "description": "Bindings for the libmcrypt library.", "require": { - "php": ">=7.2" + "php": ">= 7.2.0, <= 8.6.0" }, "php-ext": { "priority": 20, + "extension-name": "mcrypt", "configure-options": [ { "name": "with-mcrypt", - "description": "libmcrypt prefix?", - "needs-value": false + "description": "Include mcrypt support", + "needs-value": true } ] } From 75a8364642c98f86ca77bbb437156f55b910ea15 Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Wed, 9 Oct 2024 21:27:30 +0100 Subject: [PATCH 2/4] Use appropriate windows machines in CI builds using exclude matrix --- .github/workflows/build.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d2197e..1b543f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ on: jobs: windows: - runs-on: windows-latest + runs-on: ${{matrix.os}} name: "Windows: Build and test" defaults: run: @@ -18,10 +18,20 @@ jobs: strategy: fail-fast: false matrix: + os: [ windows-2019, windows-2022 ] php: ["7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4", "8.5"] arch: [x86, x64] ts: [nts, ts] experimental: [false] + exclude: + - { os: windows-2019, php: "8.5" } + - { os: windows-2019, php: "8.4" } + - { os: windows-2019, php: "8.3" } + - { os: windows-2019, php: "8.2" } + - { os: windows-2019, php: "8.1" } + - { os: windows-2019, php: "8.0" } + - { os: windows-2022, php: "7.4" } + - { os: windows-2022, php: "7.3" } steps: - name: Checkout Repository uses: actions/checkout@v3 @@ -36,7 +46,7 @@ jobs: echo $extension_version >> $env:GITHUB_ENV - name: Setup PHP id: setup-php - uses: cmb69/setup-php-sdk@v0.7 + uses: php/setup-php-sdk@v0.10 with: version: ${{matrix.php}} arch: ${{matrix.arch}} @@ -88,7 +98,7 @@ jobs: echo $extension_artifact >> $env:GITHUB_ENV - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{env.ARTIFACT_NAME}} path: ${{env.ARTIFACT}} From d43e8edbc5c99ea1bb7148c56560b99b435a7e0b Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Tue, 5 Aug 2025 09:55:28 +0100 Subject: [PATCH 3/4] Make use of new pecl builder --- .github/workflows/build.yml | 145 +++++++++++++++--------------------- 1 file changed, 62 insertions(+), 83 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b543f8..cf6e52d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,96 +9,75 @@ on: create: jobs: + get-extension-matrix: + runs-on: ubuntu-latest + name: "Windows Build Matrix" + outputs: + matrix: ${{ steps.extension-matrix.outputs.matrix }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Get The Extension Matrix + id: extension-matrix + uses: php/php-windows-builder/extension-matrix@v1 + with: + php-version-list: '8.0, 8.1, 8.2, 8.3, 8.4, 8.5' + arch-list: 'x64' + windows: - runs-on: ${{matrix.os}} - name: "Windows: Build and test" - defaults: - run: - shell: cmd + needs: get-extension-matrix + runs-on: ${{ matrix.os }} + name: "Windows" + strategy: + matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Build The Extension + uses: php/php-windows-builder/extension@v1 + with: + php-version: ${{ matrix.php-version }} + arch: ${{ matrix.arch }} + ts: ${{ matrix.ts }} + args: --with-mcrypt + libs: libmcrypt + + linux: + runs-on: ubuntu-latest + name: "Linux" strategy: fail-fast: false matrix: - os: [ windows-2019, windows-2022 ] - php: ["7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4", "8.5"] - arch: [x86, x64] - ts: [nts, ts] + php: [8.0, 8.1, 8.2, 8.3, 8.4, 8.5] + use-opcache: [true, false] experimental: [false] - exclude: - - { os: windows-2019, php: "8.5" } - - { os: windows-2019, php: "8.4" } - - { os: windows-2019, php: "8.3" } - - { os: windows-2019, php: "8.2" } - - { os: windows-2019, php: "8.1" } - - { os: windows-2019, php: "8.0" } - - { os: windows-2022, php: "7.4" } - - { os: windows-2022, php: "7.3" } steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - name: Extract Version - shell: powershell - run: | - chcp 65001 - $r = Select-String -Path php_mcrypt.h -Pattern 'PHP_MCRYPT_VERSION\s+"(.*)"' - $s = $r.Matches[0].Groups[1] - echo "$s" - $extension_version = 'EXTENSION_VERSION=' + $s - echo $extension_version >> $env:GITHUB_ENV - - name: Setup PHP - id: setup-php - uses: php/setup-php-sdk@v0.10 - with: - version: ${{matrix.php}} - arch: ${{matrix.arch}} - ts: ${{matrix.ts}} - deps: "libmcrypt" - - name: Enable Developer Command Prompt - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: ${{matrix.arch}} - toolset: ${{steps.setup-php.outputs.toolset}} - - name: Generate Build Files - run: phpize - - name: Configure Build - run: configure --with-mcrypt --with-prefix=${{steps.setup-php.outputs.prefix}} - - name: Build - run: nmake - - name: Define Module Env - shell: powershell - run: | - chcp 65001 + - uses: actions/checkout@v4 - $dir = (Get-Location).Path + '\' - if ('x64' -eq '${{matrix.arch}}') { $dir = $dir + 'x64\' } - $dir = $dir + 'Release' - if ('ts' -eq '${{matrix.ts}}') { $dir = $dir + '_TS' } + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php }}" + coverage: none + tools: pecl + deps: "libmcrypt" - $artifact_name = 'php_mcrypt-${{env.EXTENSION_VERSION}}-${{matrix.php}}' + - name: Compile + run: phpize && ./configure && make all - if ('7.2' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' } - if ('7.3' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' } - if ('7.4' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' } - if ('8.0' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } - if ('8.1' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } - if ('8.2' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } - if ('8.3' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } - if ('8.4' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs17' } - if ('8.5' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs17' } + - name: Run tests + continue-on-error: ${{ matrix.experimental }} + run: | + make test - if ('nts' -eq '${{matrix.ts}}') { $artifact_name = $artifact_name + '-nts' } - if ('x64' -eq '${{matrix.arch}}') { $artifact_name = $artifact_name + '-x86_64' } - - $extension_artifact_name = "ARTIFACT_NAME=" + $artifact_name - echo $extension_artifact_name >> $env:GITHUB_ENV - - $from = $dir + '\php_mcrypt.dll' - $to = $dir + '\' + $artifact_name + ".dll" - Copy-Item $from -Destination $to - $extension_artifact = "ARTIFACT=" + $to - echo $extension_artifact >> $env:GITHUB_ENV - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: ${{env.ARTIFACT_NAME}} - path: ${{env.ARTIFACT}} + release: + runs-on: ubuntu-latest + name: "PIE Release Artifacts" + needs: windows + if: ${{ github.event_name == 'release' }} + steps: + - name: Upload artifact to the release + uses: php/php-windows-builder/release@v1 + with: + release: ${{ github.event.release.tag_name }} + token: ${{ secrets.GITHUB_TOKEN }} From bd4bb01832b3acb9666892f0bb88a11ce12d6382 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Tue, 5 Aug 2025 09:59:40 +0100 Subject: [PATCH 4/4] See which ones would work --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cf6e52d..90d0070 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,6 +29,7 @@ jobs: runs-on: ${{ matrix.os }} name: "Windows" strategy: + fail-fast: false matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}} steps: - name: Checkout