forked from zephir-lang/zephir
-
Notifications
You must be signed in to change notification settings - Fork 1
230 lines (193 loc) · 7.12 KB
/
build-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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name: Windows CI
on:
push:
branches:
- development
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
branches:
- master
- development
env:
PARSER_VERSION: 1.3.6
PARSER_RELEASE: 559
PHP_SDK_VERSION: 2.2.0
PHP_DEVPACK: C:\tools\php-devpack
PHP_SDK_PATH: C:\tools\php-sdk
PACKAGE_PREFIX: stub
EXTENSION_NAME: stub
EXTENSION_FILE: php_stub.dll
jobs:
windows:
name: "Windows: PHP v${{ matrix.php }}"
runs-on: windows-2016
strategy:
fail-fast: false
matrix:
php:
- '7.4'
#- '8.0'
include:
- php: '7.4'
vc_num: '15'
arch: x64
build_type: nts
#- php: '8.0'
# vc_num: '15'
# arch: x64
# build_type: nts
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr, zip, mysqli
coverage: none
# variables_order: https://github.com/zephir-lang/zephir/pull/1537
# enable_dl: https://github.com/zephir-lang/zephir/pull/1654
# allow_url_fopen: https://github.com/zephir-lang/zephir/issues/1713
# error_reporting: https://github.com/zendframework/zend-code/issues/160
ini-values: >-
variables_order=EGPCS,
enable_dl=On,
allow_url_fopen=On,
error_reporting=-1,
memory_limit=1G,
date.timezone=UTC,
xdebug.max_nesting_level=256
env:
PHPTS: ${{ matrix.build_type }}
- name: Set Environment Variables
run: |
Write-Output "PHP_VERSION=$(php -r 'echo phpversion();')" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "PHP_MINOR=${{ matrix.php }}" | 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 "BUILD_TYPE=${{ matrix.build_type }}" | 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
- name: Checkout Code
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Setup Downloads Cache
uses: actions/cache@v1
with:
path: C:\Downloads
key: ${{ runner.os }}-downloads-${{ hashFiles('**/.github/workflows/build-windows.yml') }}
restore-keys: |
${{ runner.os }}-downloads-${{ env.cache-name }}-
${{ runner.os }}-downloads-
${{ runner.os }}
- name: Setup Common Environmet
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: Get-Php "${env:PHPROOT}"
- name: Install System Dependencies
run: choco install -y --cache-location=C:\Downloads\Choco re2c
- name: Install Zephir Parser
run: |
Import-Module .\.ci\win-ci-tools.psm1
InstallZephirParser
- name: Enable Zephir Parser
run: Enable-PhpExtension -Extension 'Zephir Parser' -Path "${env:PHPROOT}"
- name: Minimal Zephir Parser Load Test
run: php --ri 'Zephir Parser'
- 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: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Setup Composer Cache
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Setup GitHub Token
shell: bash
run: |
# To increase the GitHub rate limit we're use GitHub authentication
if [ ! -z '${{ secrets.COMPOSER_TOKEN }}' ]; then
composer config github-oauth.github.com ${{ secrets.COMPOSER_TOKEN }}
fi
- name: Install Project Dependencies
run: composer install --prefer-dist --no-interaction --no-ansi --no-progress --no-suggest
- name: Initialize Release Variables
run: |
Import-Module .\.ci\win-ci-tools.psm1
InitializeReleaseVars
- name: Fast Commands Test
# TODO(klay): Enable all commands
run: |
.\zephir.bat --help
# .\zephir.bat clean
# .\zephir.bat fullclean
# .\zephir.bat generate
# .\zephir.bat stubs
# .\zephir.bat api
- name: Compile Stub Project
run: |
.\zephir.bat generate
.\zephir.bat compile `
-Wnonexistent-function `
-Wnonexistent-class `
-Wunused-variable `
-Wnonexistent-constant `
-Wunreachable-code `
-Wnot-supported-magic-constant `
-Wnon-valid-decrement
- name: Make Stub Extension
shell: cmd
run: |
cd ext
nmake 2> "%GITHUB_WORKSPACE%\compile-errors.log" 1> "%GITHUB_WORKSPACE%\compile.log"
- name: Inspecting Stub Extension DLL File
run: Get-PhpExtension "${env:RELEASE_DLL_PATH}"
- name: Enable Stub Extension
run: |
Import-Module .\.ci\win-ci-tools.psm1
EnableTestExtension
- name: Minimal Load Test for Stub Extension
run: php --ri "${env:EXTENSION_NAME}"
- name: Unit Testing - Extension
if: always()
run: |
.\vendor\bin\phpunit `
--colors=always `
--bootstrap tests\ext-bootstrap.php `
--testsuite Extension
- name: Unit Testing - Zephir
if: always()
run: vendor/bin/phpunit --colors=always --testsuite Zephir
- name: After Failure
if: failure()
run: |
Import-Module .\.ci\win-ci-tools.psm1
PrintLogs
PrintEnvVars
PrintDirectoriesContent
- name: After Success
if: success()
run: |
Import-Module .\.ci\win-ci-tools.psm1
PrintBuildDetails