From e223fd99e2465f38f12564a1bfeb8f5e04cba407 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Fri, 24 Jan 2025 15:43:22 +0100 Subject: [PATCH 1/6] Fix GHA config yml error --- .github/workflows/nightly.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c2816d72cf18..4c8ec23b158a 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -427,7 +427,7 @@ jobs: -d zend_extension=opcache.so -d opcache.enable_cli=1 - uses: codecov/codecov-action@v4 - if: !cancelled() + if: ${{ !cancelled() }} with: fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} @@ -500,7 +500,7 @@ jobs: echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini php -v - name: Test AMPHP - if: !cancelled() + if: ${{ !cancelled() }} run: | repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server" X=0 @@ -518,7 +518,7 @@ jobs: done exit $X - name: Test Laravel - if: !cancelled() + if: ${{ !cancelled() }} run: | git clone https://github.com/laravel/framework.git --branch=master --depth=1 cd framework @@ -531,7 +531,7 @@ jobs: exit 1 fi - name: Test ReactPHP - if: !cancelled() + if: ${{ !cancelled() }} run: | repositories="async cache child-process datagram dns event-loop promise promise-stream promise-timer stream" X=0 @@ -549,7 +549,7 @@ jobs: done exit $X - name: Test Revolt PHP - if: !cancelled() + if: ${{ !cancelled() }} run: | git clone https://github.com/revoltphp/event-loop.git --depth=1 cd event-loop @@ -560,7 +560,7 @@ jobs: exit 1 fi - name: Test Symfony - if: !cancelled() && !inputs.skip_symfony + if: ${{ !cancelled() && !inputs.skip_symfony }} run: | git clone https://github.com/symfony/symfony.git --depth=1 cd symfony @@ -581,7 +581,7 @@ jobs: done exit $X - name: Test PHPUnit - if: !cancelled() + if: ${{ !cancelled() }} run: | git clone https://github.com/sebastianbergmann/phpunit.git --branch=main --depth=1 cd phpunit @@ -592,7 +592,7 @@ jobs: exit 1 fi - name: 'Symfony Preloading' - if: !cancelled() && !inputs.skip_symfony + if: ${{ !cancelled() && !inputs.skip_symfony }} run: | php /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress --ignore-platform-reqs cd symfony_demo @@ -600,7 +600,7 @@ jobs: sed -i 's/PHP_SAPI/"cli-server"/g' var/cache/dev/App_KernelDevDebugContainer.preload.php php -d opcache.preload=var/cache/dev/App_KernelDevDebugContainer.preload.php public/index.php - name: Test Wordpress - if: !cancelled() && !inputs.skip_wordpress + if: ${{ !cancelled() && !inputs.skip_wordpress }} run: | git clone https://github.com/WordPress/wordpress-develop.git wordpress --depth=1 cd wordpress From 946e5bdcd9fe28a5c65321b693bd20336c2c5541 Mon Sep 17 00:00:00 2001 From: divinity76 Date: Fri, 24 Jan 2025 16:04:52 +0100 Subject: [PATCH 2/6] backup location for mysql-8.0.31-winx64.zip in case of rate-limiting on dev.mysql.com --- .github/actions/setup-windows/action.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-windows/action.yml b/.github/actions/setup-windows/action.yml index 4786242455a1..344111d11d93 100644 --- a/.github/actions/setup-windows/action.yml +++ b/.github/actions/setup-windows/action.yml @@ -5,7 +5,20 @@ runs: - name: Setup MySQL shell: pwsh run: | - choco install mysql -y --no-progress --params="/port:3306" + try { + # Try installing MySQL from default choco + choco install mysql -y --no-progress --params="/port:3306" + } catch { + Write-Host "Default MySQL installation failed (dev.mysql.com rate-limiting?). Trying backup location..." + $backupUrl = "https://github.com/divinity76/php-src/releases/download/mysql-8.0.31-winx64.zip/mysql-8.0.31-winx64.zip" + $destination = "C:\tools\mysql-8.0.31-winx64.zip" + Invoke-WebRequest -Uri $backupUrl -OutFile $destination + # Extract and install MySQL manually + Expand-Archive -Path $destination -DestinationPath "C:\tools\mysql" + Write-Host "MySQL extracted to C:\tools\mysql" + # Add MySQL to PATH + $env:Path += ";C:\tools\mysql\bin" + } mysql.exe --port=3306 --user=root --password="" -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password12!'; FLUSH PRIVILEGES;" - name: Setup MSSQL shell: pwsh From 67d53e4824554acebd4ce0e55f8cece89a5f45e2 Mon Sep 17 00:00:00 2001 From: divinity76 Date: Fri, 24 Jan 2025 16:42:59 +0100 Subject: [PATCH 3/6] trigger catch on error --- .github/actions/setup-windows/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/setup-windows/action.yml b/.github/actions/setup-windows/action.yml index 344111d11d93..6b7c799f9895 100644 --- a/.github/actions/setup-windows/action.yml +++ b/.github/actions/setup-windows/action.yml @@ -5,6 +5,8 @@ runs: - name: Setup MySQL shell: pwsh run: | + # Force errors to be terminating so catch block is triggered + $ErrorActionPreference = 'Stop' try { # Try installing MySQL from default choco choco install mysql -y --no-progress --params="/port:3306" From c682452c820c91a8f18516d369b8e3071e086429 Mon Sep 17 00:00:00 2001 From: divinity76 Date: Fri, 24 Jan 2025 16:52:39 +0100 Subject: [PATCH 4/6] TIL choco does a lot behind-the-scene attempt to replicate choco setup --- .github/actions/setup-windows/action.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup-windows/action.yml b/.github/actions/setup-windows/action.yml index 6b7c799f9895..aab1e587e33a 100644 --- a/.github/actions/setup-windows/action.yml +++ b/.github/actions/setup-windows/action.yml @@ -11,15 +11,23 @@ runs: # Try installing MySQL from default choco choco install mysql -y --no-progress --params="/port:3306" } catch { - Write-Host "Default MySQL installation failed (dev.mysql.com rate-limiting?). Trying backup location..." + Write-Host "Default MySQL installation failed (likely 403 from dev.mysql.com). Fallback to backup ZIP..." $backupUrl = "https://github.com/divinity76/php-src/releases/download/mysql-8.0.31-winx64.zip/mysql-8.0.31-winx64.zip" $destination = "C:\tools\mysql-8.0.31-winx64.zip" Invoke-WebRequest -Uri $backupUrl -OutFile $destination - # Extract and install MySQL manually + # 3) Expand the ZIP into C:\tools\mysql Expand-Archive -Path $destination -DestinationPath "C:\tools\mysql" - Write-Host "MySQL extracted to C:\tools\mysql" - # Add MySQL to PATH - $env:Path += ";C:\tools\mysql\bin" + # 4) Point to the MySQL bin directory in the environment PATH (for the current session) + $mysqlDir = "C:\tools\mysql\mysql-8.0.31-winx64" + $env:Path += ";$mysqlDir\bin" + # 5) Initialize the MySQL data directory (insecure init => empty root password) + & "$mysqlDir\bin\mysqld.exe" --initialize-insecure --datadir="$mysqlDir\data" + # 6) Install MySQL as a Windows service named "MySQL80" + & "$mysqlDir\bin\mysqld.exe" --install MySQL80 --datadir="$mysqlDir\data" + # 7) Start the MySQL service + Start-Service MySQL80 + # (Optional) Wait a few seconds to ensure MySQL is fully up: + Start-Sleep -Seconds 2 } mysql.exe --port=3306 --user=root --password="" -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password12!'; FLUSH PRIVILEGES;" - name: Setup MSSQL From 3b3dfaaff9e85ce12f1bf6e5c8b904a137b7026c Mon Sep 17 00:00:00 2001 From: divinity76 Date: Fri, 24 Jan 2025 16:58:45 +0100 Subject: [PATCH 5/6] does choco return 0 on failure? --- .github/actions/setup-windows/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/setup-windows/action.yml b/.github/actions/setup-windows/action.yml index aab1e587e33a..a2a47e000fd9 100644 --- a/.github/actions/setup-windows/action.yml +++ b/.github/actions/setup-windows/action.yml @@ -9,7 +9,9 @@ runs: $ErrorActionPreference = 'Stop' try { # Try installing MySQL from default choco + echo before $? choco install mysql -y --no-progress --params="/port:3306" + echo after $? } catch { Write-Host "Default MySQL installation failed (likely 403 from dev.mysql.com). Fallback to backup ZIP..." $backupUrl = "https://github.com/divinity76/php-src/releases/download/mysql-8.0.31-winx64.zip/mysql-8.0.31-winx64.zip" From 3a25acbc784f41aebff5ba2d215d6cac2bd2a079 Mon Sep 17 00:00:00 2001 From: divinity76 Date: Fri, 24 Jan 2025 17:01:50 +0100 Subject: [PATCH 6/6] wtf --- .github/actions/setup-windows/action.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/actions/setup-windows/action.yml b/.github/actions/setup-windows/action.yml index a2a47e000fd9..aa3b12c76bcf 100644 --- a/.github/actions/setup-windows/action.yml +++ b/.github/actions/setup-windows/action.yml @@ -5,13 +5,12 @@ runs: - name: Setup MySQL shell: pwsh run: | - # Force errors to be terminating so catch block is triggered - $ErrorActionPreference = 'Stop' try { # Try installing MySQL from default choco - echo before $? choco install mysql -y --no-progress --params="/port:3306" - echo after $? + if (-not $?) { + throw "Chocolatey MySQL installation failed. Falling back to manual installation." + } } catch { Write-Host "Default MySQL installation failed (likely 403 from dev.mysql.com). Fallback to backup ZIP..." $backupUrl = "https://github.com/divinity76/php-src/releases/download/mysql-8.0.31-winx64.zip/mysql-8.0.31-winx64.zip"