From d0af505f183033ab162832ccb281ee123367b1ed Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 21 Jul 2026 16:16:20 +0200 Subject: [PATCH 01/11] :wrench: attempt to avoid using chocolatey in windows CI --- .github/workflows/_test-integrations.yml | 20 +++++++++++++++++--- .github/workflows/_test-units.yml | 21 ++++++++++++++++----- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index a9b9f102..c68b3d21 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -105,7 +105,23 @@ jobs: with: submodules: recursive - name: Install Ghostscript - run: choco install ghostscript --version 10.03.1 -y + uses: nick-fields/retry@v3 + with: + timeout_minutes: 5 + max_attempts: 3 + retry_wait_seconds: 30 + command: choco install ghostscript -y --no-progress + + - name: Locate Ghostscript + shell: pwsh + run: | + $gs = Get-ChildItem "C:\Program Files\gs\*\bin\gswin64c.exe" -ErrorAction SilentlyContinue | Select-Object -First 1 + if (-not $gs) { + Write-Error "Ghostscript not found after install." + exit 1 + } + "$($gs.Directory)" | Out-File -FilePath $env:GITHUB_PATH -Append + Write-Host "Found Ghostscript at $($gs.FullName)" - name: Set up php ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 env: @@ -113,8 +129,6 @@ jobs: with: php-version: ${{ matrix.php-version }} extensions: curl, fileinfo, json, imagick - - name: Install Ghostscript - run: choco install ghostscript -y - uses: ramsey/composer-install@v2 - name: Unit testing with phpunit run: | diff --git a/.github/workflows/_test-units.yml b/.github/workflows/_test-units.yml index befbc73e..98953246 100644 --- a/.github/workflows/_test-units.yml +++ b/.github/workflows/_test-units.yml @@ -182,12 +182,23 @@ jobs: with: submodules: recursive - name: Install Ghostscript - run: choco install ghostscript --version 10.04.0 -y - - name: Create Ghostscript alias + uses: nick-fields/retry@v3 + with: + timeout_minutes: 5 + max_attempts: 3 + retry_wait_seconds: 30 + command: choco install ghostscript -y --no-progress + + - name: Locate Ghostscript + shell: pwsh run: | - New-Item -ItemType SymbolicLink -Path "C:\Windows\gs.exe" -Target "C:\Program Files\gs\gs10.04.0\bin\gswin64c.exe" - New-Item -ItemType SymbolicLink -Path "C:\Windows\gs" -Target "C:\Program Files\gs\gs10.04.0\bin\gswin64c.exe" - shell: powershell + $gs = Get-ChildItem "C:\Program Files\gs\*\bin\gswin64c.exe" -ErrorAction SilentlyContinue | Select-Object -First 1 + if (-not $gs) { + Write-Error "Ghostscript not found after install." + exit 1 + } + "$($gs.Directory)" | Out-File -FilePath $env:GITHUB_PATH -Append + Write-Host "Found Ghostscript at $($gs.FullName)" - name: Set up php ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 env: From ffb6b3da2a556401e70967822a78dfe5bb2fb8fc Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 21 Jul 2026 16:47:26 +0200 Subject: [PATCH 02/11] debug --- .github/workflows/_test-units.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/_test-units.yml b/.github/workflows/_test-units.yml index 98953246..60d4f8e8 100644 --- a/.github/workflows/_test-units.yml +++ b/.github/workflows/_test-units.yml @@ -199,6 +199,21 @@ jobs: } "$($gs.Directory)" | Out-File -FilePath $env:GITHUB_PATH -Append Write-Host "Found Ghostscript at $($gs.FullName)" + - name: Debug PHP + extensions + shell: pwsh + run: | + where.exe php + php --version + php -m + php -r "var_dump(extension_loaded('imagick'));" + - name: Debug Ghostscript detection + shell: pwsh + run: | + php -r "var_dump(glob('C:\\Program Files\\gs\\gs*\\bin\\gswin64c.exe'));" + php -r "var_dump(glob('C:/Program Files/gs/gs*/bin/gswin64c.exe'));" + php -r "echo getenv('PATH'), PHP_EOL;" + php --version + Get-ChildItem 'C:\Program Files\gs' -Recurse -Filter gswin64c.exe -ErrorAction SilentlyContinue | ForEach-Object { $_.FullName } - name: Set up php ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 env: From 74a109287d369bcc5eeae15af8e309d69134de00 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 21 Jul 2026 17:10:33 +0200 Subject: [PATCH 03/11] attempt fix --- .github/workflows/_test-integrations.yml | 15 +++++++++--- .github/workflows/_test-units.yml | 30 ++++++++++-------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index c68b3d21..b3fc372a 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -123,12 +123,21 @@ jobs: "$($gs.Directory)" | Out-File -FilePath $env:GITHUB_PATH -Append Write-Host "Found Ghostscript at $($gs.FullName)" - name: Set up php ${{ matrix.php-version }} - uses: shivammathur/setup-php@v2 - env: - phpts: zts + uses: shivammathur/setup-php@2.35.1 with: php-version: ${{ matrix.php-version }} extensions: curl, fileinfo, json, imagick + - name: Assert PHP version and imagick + shell: pwsh + run: | + $expected = "${{ matrix.php-version }}" + $actual = (php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;") + if ($actual -ne $expected) { + Write-Error "Expected PHP $expected but got $actual at $(where.exe php)" + exit 1 + } + php -r "if (!extension_loaded('imagick')) { fwrite(STDERR, 'imagick not loaded'.PHP_EOL); exit(1); }" + Write-Host "OK: PHP $actual with imagick" - uses: ramsey/composer-install@v2 - name: Unit testing with phpunit run: | diff --git a/.github/workflows/_test-units.yml b/.github/workflows/_test-units.yml index 60d4f8e8..f3c51067 100644 --- a/.github/workflows/_test-units.yml +++ b/.github/workflows/_test-units.yml @@ -199,28 +199,22 @@ jobs: } "$($gs.Directory)" | Out-File -FilePath $env:GITHUB_PATH -Append Write-Host "Found Ghostscript at $($gs.FullName)" - - name: Debug PHP + extensions - shell: pwsh - run: | - where.exe php - php --version - php -m - php -r "var_dump(extension_loaded('imagick'));" - - name: Debug Ghostscript detection - shell: pwsh - run: | - php -r "var_dump(glob('C:\\Program Files\\gs\\gs*\\bin\\gswin64c.exe'));" - php -r "var_dump(glob('C:/Program Files/gs/gs*/bin/gswin64c.exe'));" - php -r "echo getenv('PATH'), PHP_EOL;" - php --version - Get-ChildItem 'C:\Program Files\gs' -Recurse -Filter gswin64c.exe -ErrorAction SilentlyContinue | ForEach-Object { $_.FullName } - name: Set up php ${{ matrix.php-version }} - uses: shivammathur/setup-php@v2 - env: - phpts: zts + uses: shivammathur/setup-php@2.35.1 with: php-version: ${{ matrix.php-version }} extensions: curl, fileinfo, json, imagick + - name: Assert PHP version and imagick + shell: pwsh + run: | + $expected = "${{ matrix.php-version }}" + $actual = (php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;") + if ($actual -ne $expected) { + Write-Error "Expected PHP $expected but got $actual at $(where.exe php)" + exit 1 + } + php -r "if (!extension_loaded('imagick')) { fwrite(STDERR, 'imagick not loaded'.PHP_EOL); exit(1); }" + Write-Host "OK: PHP $actual with imagick" - uses: ramsey/composer-install@v3 - name: Unit testing with phpunit env: From 6a807913f00fe2112a0af90f5a6c99d4479d021f Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 21 Jul 2026 17:19:19 +0200 Subject: [PATCH 04/11] fix --- .github/workflows/_test-integrations.yml | 15 ++------------- .github/workflows/_test-units.yml | 15 ++------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index b3fc372a..9f354464 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -123,21 +123,10 @@ jobs: "$($gs.Directory)" | Out-File -FilePath $env:GITHUB_PATH -Append Write-Host "Found Ghostscript at $($gs.FullName)" - name: Set up php ${{ matrix.php-version }} - uses: shivammathur/setup-php@2.35.1 + uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-version }} + php-version: '${{ matrix.php-version }}' extensions: curl, fileinfo, json, imagick - - name: Assert PHP version and imagick - shell: pwsh - run: | - $expected = "${{ matrix.php-version }}" - $actual = (php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;") - if ($actual -ne $expected) { - Write-Error "Expected PHP $expected but got $actual at $(where.exe php)" - exit 1 - } - php -r "if (!extension_loaded('imagick')) { fwrite(STDERR, 'imagick not loaded'.PHP_EOL); exit(1); }" - Write-Host "OK: PHP $actual with imagick" - uses: ramsey/composer-install@v2 - name: Unit testing with phpunit run: | diff --git a/.github/workflows/_test-units.yml b/.github/workflows/_test-units.yml index f3c51067..e42b4c7c 100644 --- a/.github/workflows/_test-units.yml +++ b/.github/workflows/_test-units.yml @@ -200,21 +200,10 @@ jobs: "$($gs.Directory)" | Out-File -FilePath $env:GITHUB_PATH -Append Write-Host "Found Ghostscript at $($gs.FullName)" - name: Set up php ${{ matrix.php-version }} - uses: shivammathur/setup-php@2.35.1 + uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-version }} + php-version: '${{ matrix.php-version }}' extensions: curl, fileinfo, json, imagick - - name: Assert PHP version and imagick - shell: pwsh - run: | - $expected = "${{ matrix.php-version }}" - $actual = (php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;") - if ($actual -ne $expected) { - Write-Error "Expected PHP $expected but got $actual at $(where.exe php)" - exit 1 - } - php -r "if (!extension_loaded('imagick')) { fwrite(STDERR, 'imagick not loaded'.PHP_EOL); exit(1); }" - Write-Host "OK: PHP $actual with imagick" - uses: ramsey/composer-install@v3 - name: Unit testing with phpunit env: From e32fcb3786b1250321dc6540881f495ab9622388 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 21 Jul 2026 17:25:40 +0200 Subject: [PATCH 05/11] fix...again? --- .github/workflows/_test-integrations.yml | 11 ++++++----- .github/workflows/_test-units.yml | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index 9f354464..a7864e7f 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -104,6 +104,12 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Set up php ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: '${{ matrix.php-version }}' + extensions: curl, fileinfo, json, imagick + - name: Install Ghostscript uses: nick-fields/retry@v3 with: @@ -122,11 +128,6 @@ jobs: } "$($gs.Directory)" | Out-File -FilePath $env:GITHUB_PATH -Append Write-Host "Found Ghostscript at $($gs.FullName)" - - name: Set up php ${{ matrix.php-version }} - uses: shivammathur/setup-php@v2 - with: - php-version: '${{ matrix.php-version }}' - extensions: curl, fileinfo, json, imagick - uses: ramsey/composer-install@v2 - name: Unit testing with phpunit run: | diff --git a/.github/workflows/_test-units.yml b/.github/workflows/_test-units.yml index e42b4c7c..c24619e3 100644 --- a/.github/workflows/_test-units.yml +++ b/.github/workflows/_test-units.yml @@ -181,6 +181,12 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + + - name: Set up php ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: '${{ matrix.php-version }}' + extensions: curl, fileinfo, json, imagick - name: Install Ghostscript uses: nick-fields/retry@v3 with: @@ -199,11 +205,6 @@ jobs: } "$($gs.Directory)" | Out-File -FilePath $env:GITHUB_PATH -Append Write-Host "Found Ghostscript at $($gs.FullName)" - - name: Set up php ${{ matrix.php-version }} - uses: shivammathur/setup-php@v2 - with: - php-version: '${{ matrix.php-version }}' - extensions: curl, fileinfo, json, imagick - uses: ramsey/composer-install@v3 - name: Unit testing with phpunit env: From cabd8220866871264a4c42d291463a15f47038dc Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 21 Jul 2026 20:10:04 +0200 Subject: [PATCH 06/11] idk anymore --- .github/workflows/_test-integrations.yml | 34 ++++++++++++----------- .github/workflows/_test-units.yml | 35 +++++++++++++----------- 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index a7864e7f..d30c8e52 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -111,23 +111,25 @@ jobs: extensions: curl, fileinfo, json, imagick - name: Install Ghostscript - uses: nick-fields/retry@v3 - with: - timeout_minutes: 5 - max_attempts: 3 - retry_wait_seconds: 30 - command: choco install ghostscript -y --no-progress - - - name: Locate Ghostscript - shell: pwsh + shell: powershell run: | - $gs = Get-ChildItem "C:\Program Files\gs\*\bin\gswin64c.exe" -ErrorAction SilentlyContinue | Select-Object -First 1 - if (-not $gs) { - Write-Error "Ghostscript not found after install." - exit 1 - } - "$($gs.Directory)" | Out-File -FilePath $env:GITHUB_PATH -Append - Write-Host "Found Ghostscript at $($gs.FullName)" + $gsVersion = "10.07.1" + + $gsVersionCompact = $gsVersion.Replace('.', '') + $installerUrl = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs$gsVersionCompact/gs${gsVersionCompact}w64.exe" + $installerPath = "$env:TEMP\gs_installer.exe" + + Write-Host "Downloading Ghostscript $gsVersion..." + Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath + + Write-Host "Running silent installation..." + Start-Process -FilePath $installerPath -ArgumentList "/S" -Wait -NoNewWindow + $binPath = "C:\Program Files\gs\gs$gsVersion\bin" + $libPath = "C:\Program Files\gs\gs$gsVersion\lib" + + Write-Host "Adding Ghostscript to GITHUB_PATH..." + Add-Content -Path $env:GITHUB_PATH -Value $binPath + Add-Content -Path $env:GITHUB_PATH -Value $libPath - uses: ramsey/composer-install@v2 - name: Unit testing with phpunit run: | diff --git a/.github/workflows/_test-units.yml b/.github/workflows/_test-units.yml index c24619e3..9ee2acc5 100644 --- a/.github/workflows/_test-units.yml +++ b/.github/workflows/_test-units.yml @@ -187,24 +187,27 @@ jobs: with: php-version: '${{ matrix.php-version }}' extensions: curl, fileinfo, json, imagick - - name: Install Ghostscript - uses: nick-fields/retry@v3 - with: - timeout_minutes: 5 - max_attempts: 3 - retry_wait_seconds: 30 - command: choco install ghostscript -y --no-progress - - name: Locate Ghostscript - shell: pwsh + - name: Install Ghostscript + shell: powershell run: | - $gs = Get-ChildItem "C:\Program Files\gs\*\bin\gswin64c.exe" -ErrorAction SilentlyContinue | Select-Object -First 1 - if (-not $gs) { - Write-Error "Ghostscript not found after install." - exit 1 - } - "$($gs.Directory)" | Out-File -FilePath $env:GITHUB_PATH -Append - Write-Host "Found Ghostscript at $($gs.FullName)" + $gsVersion = "10.07.1" + + $gsVersionCompact = $gsVersion.Replace('.', '') + $installerUrl = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs$gsVersionCompact/gs${gsVersionCompact}w64.exe" + $installerPath = "$env:TEMP\gs_installer.exe" + + Write-Host "Downloading Ghostscript $gsVersion..." + Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath + + Write-Host "Running silent installation..." + Start-Process -FilePath $installerPath -ArgumentList "/S" -Wait -NoNewWindow + $binPath = "C:\Program Files\gs\gs$gsVersion\bin" + $libPath = "C:\Program Files\gs\gs$gsVersion\lib" + + Write-Host "Adding Ghostscript to GITHUB_PATH..." + Add-Content -Path $env:GITHUB_PATH -Value $binPath + Add-Content -Path $env:GITHUB_PATH -Value $libPath - uses: ramsey/composer-install@v3 - name: Unit testing with phpunit env: From 902ced98340648d01cbe75156fbf26baff85ddab Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 21 Jul 2026 20:20:03 +0200 Subject: [PATCH 07/11] idk anymore 2 --- .github/workflows/_test-integrations.yml | 14 +++++++------- .github/workflows/_test-units.yml | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index d30c8e52..d7107167 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -113,23 +113,23 @@ jobs: - name: Install Ghostscript shell: powershell run: | - $gsVersion = "10.07.1" - + $gsVersion = "10.03.1" $gsVersionCompact = $gsVersion.Replace('.', '') $installerUrl = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs$gsVersionCompact/gs${gsVersionCompact}w64.exe" $installerPath = "$env:TEMP\gs_installer.exe" + $installDir = "C:\gs" Write-Host "Downloading Ghostscript $gsVersion..." Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath + + Unblock-File -Path $installerPath Write-Host "Running silent installation..." - Start-Process -FilePath $installerPath -ArgumentList "/S" -Wait -NoNewWindow - $binPath = "C:\Program Files\gs\gs$gsVersion\bin" - $libPath = "C:\Program Files\gs\gs$gsVersion\lib" + cmd.exe /c "start /wait `"`" `"$installerPath`" /S /D=$installDir" Write-Host "Adding Ghostscript to GITHUB_PATH..." - Add-Content -Path $env:GITHUB_PATH -Value $binPath - Add-Content -Path $env:GITHUB_PATH -Value $libPath + Add-Content -Path $env:GITHUB_PATH -Value "$installDir\bin" + Add-Content -Path $env:GITHUB_PATH -Value "$installDir\lib" - uses: ramsey/composer-install@v2 - name: Unit testing with phpunit run: | diff --git a/.github/workflows/_test-units.yml b/.github/workflows/_test-units.yml index 9ee2acc5..5fe8a6eb 100644 --- a/.github/workflows/_test-units.yml +++ b/.github/workflows/_test-units.yml @@ -191,23 +191,23 @@ jobs: - name: Install Ghostscript shell: powershell run: | - $gsVersion = "10.07.1" - + $gsVersion = "10.03.1" $gsVersionCompact = $gsVersion.Replace('.', '') $installerUrl = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs$gsVersionCompact/gs${gsVersionCompact}w64.exe" $installerPath = "$env:TEMP\gs_installer.exe" + $installDir = "C:\gs" Write-Host "Downloading Ghostscript $gsVersion..." Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath + + Unblock-File -Path $installerPath Write-Host "Running silent installation..." - Start-Process -FilePath $installerPath -ArgumentList "/S" -Wait -NoNewWindow - $binPath = "C:\Program Files\gs\gs$gsVersion\bin" - $libPath = "C:\Program Files\gs\gs$gsVersion\lib" + cmd.exe /c "start /wait `"`" `"$installerPath`" /S /D=$installDir" Write-Host "Adding Ghostscript to GITHUB_PATH..." - Add-Content -Path $env:GITHUB_PATH -Value $binPath - Add-Content -Path $env:GITHUB_PATH -Value $libPath + Add-Content -Path $env:GITHUB_PATH -Value "$installDir\bin" + Add-Content -Path $env:GITHUB_PATH -Value "$installDir\lib" - uses: ramsey/composer-install@v3 - name: Unit testing with phpunit env: From 9c792a338bd7f0f2ca09ce1d497fbf6d6b7614ce Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 21 Jul 2026 20:32:01 +0200 Subject: [PATCH 08/11] invoking the dark arts to make this work --- .github/workflows/_test-integrations.yml | 24 ++++++++++++++---------- .github/workflows/_test-units.yml | 23 +++++++++++++---------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index d7107167..f30c01f5 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -110,26 +110,30 @@ jobs: php-version: '${{ matrix.php-version }}' extensions: curl, fileinfo, json, imagick - - name: Install Ghostscript + + - name: Install Ghostscript (Extraction Method) shell: powershell run: | $gsVersion = "10.03.1" $gsVersionCompact = $gsVersion.Replace('.', '') $installerUrl = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs$gsVersionCompact/gs${gsVersionCompact}w64.exe" - $installerPath = "$env:TEMP\gs_installer.exe" - $installDir = "C:\gs" + $downloadPath = "$env:TEMP\gs_installer.exe" + $extractDir = "C:\gs" Write-Host "Downloading Ghostscript $gsVersion..." - Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath - - Unblock-File -Path $installerPath + Invoke-WebRequest -Uri $installerUrl -OutFile $downloadPath - Write-Host "Running silent installation..." - cmd.exe /c "start /wait `"`" `"$installerPath`" /S /D=$installDir" + Write-Host "Extracting binaries from installer without executing..." + 7z x $downloadPath -o"$extractDir" -y | Out-Null + + $binDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gswin64c.exe").Directory.FullName + $libDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gs_init.ps").Directory.FullName + Write-Host "Found bin at: $binDir" Write-Host "Adding Ghostscript to GITHUB_PATH..." - Add-Content -Path $env:GITHUB_PATH -Value "$installDir\bin" - Add-Content -Path $env:GITHUB_PATH -Value "$installDir\lib" + + Add-Content -Path $env:GITHUB_PATH -Value $binDir + Add-Content -Path $env:GITHUB_PATH -Value $libDir - uses: ramsey/composer-install@v2 - name: Unit testing with phpunit run: | diff --git a/.github/workflows/_test-units.yml b/.github/workflows/_test-units.yml index 5fe8a6eb..cc313ab5 100644 --- a/.github/workflows/_test-units.yml +++ b/.github/workflows/_test-units.yml @@ -188,26 +188,29 @@ jobs: php-version: '${{ matrix.php-version }}' extensions: curl, fileinfo, json, imagick - - name: Install Ghostscript + - name: Install Ghostscript (Extraction Method) shell: powershell run: | $gsVersion = "10.03.1" $gsVersionCompact = $gsVersion.Replace('.', '') $installerUrl = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs$gsVersionCompact/gs${gsVersionCompact}w64.exe" - $installerPath = "$env:TEMP\gs_installer.exe" - $installDir = "C:\gs" + $downloadPath = "$env:TEMP\gs_installer.exe" + $extractDir = "C:\gs" Write-Host "Downloading Ghostscript $gsVersion..." - Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath - - Unblock-File -Path $installerPath + Invoke-WebRequest -Uri $installerUrl -OutFile $downloadPath - Write-Host "Running silent installation..." - cmd.exe /c "start /wait `"`" `"$installerPath`" /S /D=$installDir" + Write-Host "Extracting binaries from installer without executing..." + 7z x $downloadPath -o"$extractDir" -y | Out-Null + + $binDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gswin64c.exe").Directory.FullName + $libDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gs_init.ps").Directory.FullName + Write-Host "Found bin at: $binDir" Write-Host "Adding Ghostscript to GITHUB_PATH..." - Add-Content -Path $env:GITHUB_PATH -Value "$installDir\bin" - Add-Content -Path $env:GITHUB_PATH -Value "$installDir\lib" + + Add-Content -Path $env:GITHUB_PATH -Value $binDir + Add-Content -Path $env:GITHUB_PATH -Value $libDir - uses: ramsey/composer-install@v3 - name: Unit testing with phpunit env: From c8c1fd866245e4c38f8d369291e1de97b12191a6 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 21 Jul 2026 20:56:07 +0200 Subject: [PATCH 09/11] the dark arts suck, I'll turn to the light orange-ish arts --- .github/workflows/_test-integrations.yml | 13 +++++++------ .github/workflows/_test-units.yml | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index f30c01f5..9250fa3d 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -120,18 +120,19 @@ jobs: $downloadPath = "$env:TEMP\gs_installer.exe" $extractDir = "C:\gs" - Write-Host "Downloading Ghostscript $gsVersion..." Invoke-WebRequest -Uri $installerUrl -OutFile $downloadPath - - Write-Host "Extracting binaries from installer without executing..." 7z x $downloadPath -o"$extractDir" -y | Out-Null - + $binDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gswin64c.exe").Directory.FullName $libDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gs_init.ps").Directory.FullName - Write-Host "Found bin at: $binDir" - Write-Host "Adding Ghostscript to GITHUB_PATH..." + Write-Host "Creating gs.exe so PHP can find it..." + Copy-Item -Path "$binDir\gswin64c.exe" -Destination "$binDir\gs.exe" + + Write-Host "Setting GS_PROG for Imagick/PHP..." + Add-Content -Path $env:GITHUB_ENV -Value "GS_PROG=$binDir\gs.exe" + Write-Host "Adding Ghostscript to GITHUB_PATH..." Add-Content -Path $env:GITHUB_PATH -Value $binDir Add-Content -Path $env:GITHUB_PATH -Value $libDir - uses: ramsey/composer-install@v2 diff --git a/.github/workflows/_test-units.yml b/.github/workflows/_test-units.yml index cc313ab5..777a9580 100644 --- a/.github/workflows/_test-units.yml +++ b/.github/workflows/_test-units.yml @@ -197,18 +197,19 @@ jobs: $downloadPath = "$env:TEMP\gs_installer.exe" $extractDir = "C:\gs" - Write-Host "Downloading Ghostscript $gsVersion..." Invoke-WebRequest -Uri $installerUrl -OutFile $downloadPath - - Write-Host "Extracting binaries from installer without executing..." 7z x $downloadPath -o"$extractDir" -y | Out-Null - + $binDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gswin64c.exe").Directory.FullName $libDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gs_init.ps").Directory.FullName - Write-Host "Found bin at: $binDir" - Write-Host "Adding Ghostscript to GITHUB_PATH..." + Write-Host "Creating gs.exe so PHP can find it..." + Copy-Item -Path "$binDir\gswin64c.exe" -Destination "$binDir\gs.exe" + + Write-Host "Setting GS_PROG for Imagick/PHP..." + Add-Content -Path $env:GITHUB_ENV -Value "GS_PROG=$binDir\gs.exe" + Write-Host "Adding Ghostscript to GITHUB_PATH..." Add-Content -Path $env:GITHUB_PATH -Value $binDir Add-Content -Path $env:GITHUB_PATH -Value $libDir - uses: ramsey/composer-install@v3 From 92cfbf99a271a77343c0b5e508c532a9af3cb0e8 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Tue, 21 Jul 2026 21:05:47 +0200 Subject: [PATCH 10/11] zzzzzzzz --- .github/workflows/_test-integrations.yml | 22 ++++++++++++++++------ .github/workflows/_test-units.yml | 22 ++++++++++++++++------ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index 9250fa3d..28b67a56 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -111,7 +111,7 @@ jobs: extensions: curl, fileinfo, json, imagick - - name: Install Ghostscript (Extraction Method) + - name: Install Ghostscript (Extraction & Registry Method) shell: powershell run: | $gsVersion = "10.03.1" @@ -120,19 +120,29 @@ jobs: $downloadPath = "$env:TEMP\gs_installer.exe" $extractDir = "C:\gs" + Write-Host "Downloading and Extracting..." Invoke-WebRequest -Uri $installerUrl -OutFile $downloadPath 7z x $downloadPath -o"$extractDir" -y | Out-Null - + $binDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gswin64c.exe").Directory.FullName $libDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gs_init.ps").Directory.FullName + $dllPath = (Get-ChildItem -Path $extractDir -Recurse -Filter "gsdll64.dll").FullName + $resourceDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "Init" | Where-Object {$_.Parent.Name -eq "Resource"}).Parent.FullName - Write-Host "Creating gs.exe so PHP can find it..." + Write-Host "Creating gs.exe for generic shell commands..." Copy-Item -Path "$binDir\gswin64c.exe" -Destination "$binDir\gs.exe" - Write-Host "Setting GS_PROG for Imagick/PHP..." - Add-Content -Path $env:GITHUB_ENV -Value "GS_PROG=$binDir\gs.exe" + Write-Host "Writing Registry Keys for PHP Imagick..." + $registryPath = "HKLM:\SOFTWARE\GPL Ghostscript\$gsVersion" + New-Item -Path $registryPath -Force | Out-Null - Write-Host "Adding Ghostscript to GITHUB_PATH..." + New-ItemProperty -Path $registryPath -Name "GS_DLL" -Value $dllPath -PropertyType String -Force | Out-Null + + $gsLibStr = "$libDir;$resourceDir\Init;$resourceDir\Font" + New-ItemProperty -Path $registryPath -Name "GS_LIB" -Value $gsLibStr -PropertyType String -Force | Out-Null + + Write-Host "Adding variables to GITHUB_ENV and GITHUB_PATH..." + Add-Content -Path $env:GITHUB_ENV -Value "GS_PROG=$binDir\gs.exe" Add-Content -Path $env:GITHUB_PATH -Value $binDir Add-Content -Path $env:GITHUB_PATH -Value $libDir - uses: ramsey/composer-install@v2 diff --git a/.github/workflows/_test-units.yml b/.github/workflows/_test-units.yml index 777a9580..3d9f5267 100644 --- a/.github/workflows/_test-units.yml +++ b/.github/workflows/_test-units.yml @@ -188,7 +188,7 @@ jobs: php-version: '${{ matrix.php-version }}' extensions: curl, fileinfo, json, imagick - - name: Install Ghostscript (Extraction Method) + - name: Install Ghostscript (Extraction & Registry Method) shell: powershell run: | $gsVersion = "10.03.1" @@ -197,19 +197,29 @@ jobs: $downloadPath = "$env:TEMP\gs_installer.exe" $extractDir = "C:\gs" + Write-Host "Downloading and Extracting..." Invoke-WebRequest -Uri $installerUrl -OutFile $downloadPath 7z x $downloadPath -o"$extractDir" -y | Out-Null - + $binDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gswin64c.exe").Directory.FullName $libDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gs_init.ps").Directory.FullName + $dllPath = (Get-ChildItem -Path $extractDir -Recurse -Filter "gsdll64.dll").FullName + $resourceDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "Init" | Where-Object {$_.Parent.Name -eq "Resource"}).Parent.FullName - Write-Host "Creating gs.exe so PHP can find it..." + Write-Host "Creating gs.exe for generic shell commands..." Copy-Item -Path "$binDir\gswin64c.exe" -Destination "$binDir\gs.exe" - Write-Host "Setting GS_PROG for Imagick/PHP..." - Add-Content -Path $env:GITHUB_ENV -Value "GS_PROG=$binDir\gs.exe" + Write-Host "Writing Registry Keys for PHP Imagick..." + $registryPath = "HKLM:\SOFTWARE\GPL Ghostscript\$gsVersion" + New-Item -Path $registryPath -Force | Out-Null - Write-Host "Adding Ghostscript to GITHUB_PATH..." + New-ItemProperty -Path $registryPath -Name "GS_DLL" -Value $dllPath -PropertyType String -Force | Out-Null + + $gsLibStr = "$libDir;$resourceDir\Init;$resourceDir\Font" + New-ItemProperty -Path $registryPath -Name "GS_LIB" -Value $gsLibStr -PropertyType String -Force | Out-Null + + Write-Host "Adding variables to GITHUB_ENV and GITHUB_PATH..." + Add-Content -Path $env:GITHUB_ENV -Value "GS_PROG=$binDir\gs.exe" Add-Content -Path $env:GITHUB_PATH -Value $binDir Add-Content -Path $env:GITHUB_PATH -Value $libDir - uses: ramsey/composer-install@v3 From 4d8e9a3e7481e5069684ae6b51f2cc0652125182 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 22 Jul 2026 15:02:53 +0200 Subject: [PATCH 11/11] trying slop --- .github/workflows/_test-integrations.yml | 19 ++++++++++++++----- .github/workflows/_test-units.yml | 20 ++++++++++++++------ 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index 28b67a56..08e59ff3 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -111,7 +111,7 @@ jobs: extensions: curl, fileinfo, json, imagick - - name: Install Ghostscript (Extraction & Registry Method) + - name: Install Ghostscript and Patch Imagick Policy shell: powershell run: | $gsVersion = "10.03.1" @@ -120,10 +120,10 @@ jobs: $downloadPath = "$env:TEMP\gs_installer.exe" $extractDir = "C:\gs" - Write-Host "Downloading and Extracting..." + Write-Host "Downloading and Extracting Ghostscript..." Invoke-WebRequest -Uri $installerUrl -OutFile $downloadPath 7z x $downloadPath -o"$extractDir" -y | Out-Null - + $binDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gswin64c.exe").Directory.FullName $libDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gs_init.ps").Directory.FullName $dllPath = (Get-ChildItem -Path $extractDir -Recurse -Filter "gsdll64.dll").FullName @@ -135,16 +135,25 @@ jobs: Write-Host "Writing Registry Keys for PHP Imagick..." $registryPath = "HKLM:\SOFTWARE\GPL Ghostscript\$gsVersion" New-Item -Path $registryPath -Force | Out-Null - New-ItemProperty -Path $registryPath -Name "GS_DLL" -Value $dllPath -PropertyType String -Force | Out-Null $gsLibStr = "$libDir;$resourceDir\Init;$resourceDir\Font" New-ItemProperty -Path $registryPath -Name "GS_LIB" -Value $gsLibStr -PropertyType String -Force | Out-Null - Write-Host "Adding variables to GITHUB_ENV and GITHUB_PATH..." + Write-Host "Adding Ghostscript to GITHUB_ENV and GITHUB_PATH..." Add-Content -Path $env:GITHUB_ENV -Value "GS_PROG=$binDir\gs.exe" Add-Content -Path $env:GITHUB_PATH -Value $binDir Add-Content -Path $env:GITHUB_PATH -Value $libDir + + Write-Host "Patching ImageMagick policy.xml on Windows..." + $policyFiles = Get-ChildItem -Path C:\tools\php -Filter policy.xml -Recurse -ErrorAction SilentlyContinue + + foreach ($file in $policyFiles) { + Write-Host "Patching PDF rights in: $($file.FullName)" + $content = Get-Content $file.FullName + $content = $content -replace 'rights="none" pattern="PDF"', 'rights="read|write" pattern="PDF"' + Set-Content -Path $file.FullName -Value $content + } - uses: ramsey/composer-install@v2 - name: Unit testing with phpunit run: | diff --git a/.github/workflows/_test-units.yml b/.github/workflows/_test-units.yml index 3d9f5267..e5525c79 100644 --- a/.github/workflows/_test-units.yml +++ b/.github/workflows/_test-units.yml @@ -187,8 +187,7 @@ jobs: with: php-version: '${{ matrix.php-version }}' extensions: curl, fileinfo, json, imagick - - - name: Install Ghostscript (Extraction & Registry Method) + - name: Install Ghostscript and Patch Imagick Policy shell: powershell run: | $gsVersion = "10.03.1" @@ -197,10 +196,10 @@ jobs: $downloadPath = "$env:TEMP\gs_installer.exe" $extractDir = "C:\gs" - Write-Host "Downloading and Extracting..." + Write-Host "Downloading and Extracting Ghostscript..." Invoke-WebRequest -Uri $installerUrl -OutFile $downloadPath 7z x $downloadPath -o"$extractDir" -y | Out-Null - + $binDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gswin64c.exe").Directory.FullName $libDir = (Get-ChildItem -Path $extractDir -Recurse -Filter "gs_init.ps").Directory.FullName $dllPath = (Get-ChildItem -Path $extractDir -Recurse -Filter "gsdll64.dll").FullName @@ -212,16 +211,25 @@ jobs: Write-Host "Writing Registry Keys for PHP Imagick..." $registryPath = "HKLM:\SOFTWARE\GPL Ghostscript\$gsVersion" New-Item -Path $registryPath -Force | Out-Null - New-ItemProperty -Path $registryPath -Name "GS_DLL" -Value $dllPath -PropertyType String -Force | Out-Null $gsLibStr = "$libDir;$resourceDir\Init;$resourceDir\Font" New-ItemProperty -Path $registryPath -Name "GS_LIB" -Value $gsLibStr -PropertyType String -Force | Out-Null - Write-Host "Adding variables to GITHUB_ENV and GITHUB_PATH..." + Write-Host "Adding Ghostscript to GITHUB_ENV and GITHUB_PATH..." Add-Content -Path $env:GITHUB_ENV -Value "GS_PROG=$binDir\gs.exe" Add-Content -Path $env:GITHUB_PATH -Value $binDir Add-Content -Path $env:GITHUB_PATH -Value $libDir + + Write-Host "Patching ImageMagick policy.xml on Windows..." + $policyFiles = Get-ChildItem -Path C:\tools\php -Filter policy.xml -Recurse -ErrorAction SilentlyContinue + + foreach ($file in $policyFiles) { + Write-Host "Patching PDF rights in: $($file.FullName)" + $content = Get-Content $file.FullName + $content = $content -replace 'rights="none" pattern="PDF"', 'rights="read|write" pattern="PDF"' + Set-Content -Path $file.FullName -Value $content + } - uses: ramsey/composer-install@v3 - name: Unit testing with phpunit env: