wip #67
Workflow file for this run
This file contains 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: windows | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test_windows: | |
if: "!contains(github.event.head_commit.message, 'ci skip')" | |
name: PHP ${{ matrix.php-versions }} / ${{ matrix.ts }} / ${{ matrix.operating-system }} | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: ["windows-latest"] | |
php-versions: ["8.1", "8.2", "8.3"] | |
ts: ["ts", "nts"] | |
vc_num: ["vs16"] | |
build_type: ["Win32"] | |
arch: ["x64"] | |
steps: | |
- name: Disable Git autocrlf | |
run: git config --global core.autocrlf false | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
ini-values: apc.enable_cli=on, session.save_path=C:\temp | |
tools: pecl | |
env: | |
PHPTS: ${{ matrix.ts }} | |
- name: Setup Environment Variables | |
run: | | |
Write-Output "PHP_SDK_VERSION=2.2.0" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "PHP_DEVPACK=C:\tools\php-devpack" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "PHP_SDK_PATH=C:\tools\php-sdk" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "PHP_PECL_PATH=C:\tools\pecl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
# FIXME: phpversion() return 7.4.3 but windows.php.net has only 7.4.4 | |
# We should parse the following file to get the correct version: | |
# https://windows.php.net/downloads/releases/sha256sum.txt | |
If ("${{ matrix.php-versions }}" -eq "7.4") { | |
Write-Output "PHP_VERSION=7.4.4" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
} Else { | |
Write-Output "PHP_VERSION=$(php -r 'echo phpversion();')" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
} | |
Write-Output "PHP_MINOR=${{ matrix.php-versions }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "TEST_PHP_EXECUTABLE=${env:PHPROOT}\php.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "VC_VERSION=${{ matrix.vc_num }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "PHP_ARCH=${{ matrix.arch }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "PACKAGE_PREFIX=psr" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "EXTENSION_NAME=psr" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "EXTENSION_FILE=php_psr.dll" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "PHPTS=${{ matrix.ts }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
If ("${{ matrix.ts }}" -eq "nts") { | |
Write-Output "BUILD_TYPE=nts-${{ matrix.build_type }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
} Else { | |
Write-Output "BUILD_TYPE=${{ matrix.build_type }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
} | |
- name: Setup Common Environment | |
run: | | |
Import-Module .\.ci\win-ci-tools.psm1 | |
SetupCommonEnvironment | |
- name: Install PHP SDK Binary Tools | |
run: | | |
Import-Module .\.ci\win-ci-tools.psm1 | |
InstallPhpSdk | |
- name: Install PHP Dev pack | |
run: | | |
Import-Module .\.ci\win-ci-tools.psm1 | |
InstallPhpDevPack | |
- name: Getting Details About Installed PHP | |
run: | | |
Import-Module .\.ci\win-ci-tools.psm1 | |
Get-Php "${env:PHPROOT}" | |
- name: Install System Dependencies | |
run: choco install -y --cache-location=C:\Downloads\Choco re2c | |
- name: Initialize Release Variables | |
run: | | |
Import-Module .\.ci\win-ci-tools.psm1 | |
InitializeReleaseVars | |
- name: "Setup Visual Studio Command Line for PHP SDK ${{ matrix.arch }}" | |
run: .ci\vsenv.bat -arch=${{ matrix.arch }} -host_arch=${{ matrix.arch }} | |
- name: Fix Environment Variables | |
shell: powershell | |
run: | | |
$v = "${env:WindowsSDKVersion}" -replace '\\$', '' | |
Write-Output "WindowsSDKVersion=$v" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
$v = "${env:WindowsSDKLibVersion}" -replace '\\$', '' | |
Write-Output "WindowsSDKLibVersion=$v" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: PSR extension | init, phpize | |
shell: cmd | |
run: | | |
set PATH=%PATH%;%PHP_DEVPACK% | |
phpize | |
- name: PSR extension | configure | |
shell: cmd | |
run: | | |
set PATH=%PATH%;%PHP_DEVPACK% | |
configure --disable-all --enable-psr --with-prefix=%PHPROOT% | |
- name: PSR extension | build | |
shell: cmd | |
run: | | |
set PATH=%PATH%;%PHP_DEVPACK% | |
nmake | |
nmake install | |
- name: PSR extension | test | |
shell: cmd | |
run: | | |
set PATH=%PATH%;%PHP_DEVPACK% | |
nmake test | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.RELEASE_ZIPBALL }} | |
path: ${{ env.RELEASE_DLL_PATH }} | |
- name: Upload build artifacts after Failure | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: workspace | |
path: ${{ github.workspace }} | |
retention-days: 1 |