-
Notifications
You must be signed in to change notification settings - Fork 32
144 lines (129 loc) · 6.42 KB
/
windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
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-2019"]
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