/
action.yml
133 lines (114 loc) · 5.04 KB
/
action.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
name: 'Phalcon PHP extension build action'
description: 'Build Phalcon Framework for Windows according to various PHP versions.'
inputs:
pecl:
description: 'PECL package path'
required: true
php_version:
description: 'PHP version to build for (e.g: 7.4, 8.0)'
required: true
ts:
description: 'Thread Safety'
required: false
default: 'nts'
msvc:
description: 'Microsoft Visual C++ compiler toolset prefix (e.g: vc14, vs15, vs16)'
required: true
arch:
description: 'Target architecture (x64, x86)'
required: false
default: 'x64'
runs:
using: 'composite'
steps:
- name: Setup Downloads Cache
uses: actions/cache@v3
with:
path: ${{ env.CACHE_DIR }}
key: ${{ runner.os }}-downloads-${{ hashFiles('**/.github/actions/build-phalcon-win/action.yml') }}
restore-keys: |
${{ runner.os }}-downloads-${{ env.cache-name }}-
${{ runner.os }}-downloads-
${{ runner.os }}
- name: Setup Prerequisites
shell: powershell
run: |
Write-Output "::group::Install dependencies"
choco install --no-progress -y --cache-location=${{ env.CACHE_DIR }}\Choco re2c
Write-Output "::endgroup::"
Write-Output "Install PowerShell PHP Manager module"
if (Get-Module -ListAvailable -Name PhpManager) {
Write-Host "PhpManager powershell module exist, skip install"
} else {
Install-Module -Name PhpManager -Repository PSGallery -Force
}
Write-Output "::endgroup::"
$OsName = "${{ matrix.os }}".replace('-','').ToLower()
$ReleaseFolder = if ("${{ inputs.ts }}" -eq "ts") { "Release_TS" } else { "Release" }
$ReleaseFolder = if ("${{ inputs.arch }}" -eq "x64") { "x64\${ReleaseFolder}" } else { "${ReleaseFolder}" }
$ReleaseDllPath = "${{ env.TOOLS_DIR }}\pecl\phalcon\phalcon-${{ env.PHALCON_VERSION }}\${ReleaseFolder}\php_phalcon.dll"
$ReleaseZipBall = "phalcon-php${{ inputs.php_version }}-${{ inputs.ts }}-${OsName}-${{ inputs.msvc }}-${{ inputs.arch }}"
Write-Output "RELEASE_FOLDER=$ReleaseFolder" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "RELEASE_DLL_PATH=$ReleaseDllPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "RELEASE_ZIPBALL=$ReleaseZipBall" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "PHP_ROOT=${{ env.TOOLS_DIR }}\php" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "PHP_PECL_PATH=${{ env.TOOLS_DIR }}\pecl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "PHP_DEVPACK=${{ env.TOOLS_DIR }}\php-devpack" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup PHP SDK tool kit
uses: zephir-lang/setup-php-sdk@v1
with:
php_version: ${{ inputs.php_version }}
ts: ${{ inputs.ts }}
msvc: ${{ inputs.msvc }}
arch: ${{ inputs.arch }}
install_dir: ${{ env.TOOLS_DIR }}
cache_dir: ${{ env.CACHE_DIR }}
- name: Configure Developer Command Prompt for MSVC compiler
uses: ilammy/msvc-dev-cmd@v1.12.1
with:
arch: ${{ inputs.arch }}
# Workaround for
# PHP Warning: PHP Startup: Can't load module 'C:\tools\php\ext\php_zephir_parser.dll'
# as it's linked with 14.29, but the core is linked with 14.16 in Unknown on line 0
- name: Configure Developer Command Prompt for MSVC compiler
uses: ilammy/msvc-dev-cmd@v1.12.1
if: ${{ inputs.php_version }} == '7.4'
with:
arch: ${{ inputs.arch }}
toolset: 14.16
- name: Getting Details About Installed PHP
shell: powershell
run: |
Get-Php (Get-Command php).Path
- name: Install PECL Package
shell: powershell
run: |
.\.github\actions\build-phalcon-win\Expand-Item7zip.ps1 "${{ inputs.pecl }}" "${env:TEMP}"
.\.github\actions\build-phalcon-win\Expand-Item7zip.ps1 "${env:TEMP}\phalcon-pecl.tar" "${{ env.PHP_PECL_PATH }}\phalcon"
- name: Phalcon | phpize
working-directory: '${{ env.PHP_PECL_PATH }}\phalcon\phalcon-${{ env.PHALCON_VERSION }}'
shell: powershell
run: |
phpize
- name: Phalcon | Configure Project
working-directory: '${{ env.PHP_PECL_PATH }}\phalcon\phalcon-${{ env.PHALCON_VERSION }}'
shell: powershell
run: |
.\configure.bat --enable-phalcon
- name: Phalcon | Build Project
working-directory: '${{ env.PHP_PECL_PATH }}\phalcon\phalcon-${{ env.PHALCON_VERSION }}'
shell: powershell
run: |
nmake
- name: Inspecting Phalcon Extension DLL File
shell: powershell
run: |
Get-PhpExtension "${{ env.RELEASE_DLL_PATH }}"
- name: Enable Phalcon Extension
shell: powershell
run: |
Copy-Item -Path "${{ env.RELEASE_DLL_PATH }}" -Destination "${{ env.PHP_ROOT }}\ext\"
Enable-PhpExtension -Extension 'phalcon' -Path "${{ env.PHP_ROOT }}"
- name: Check Extension
shell: powershell
run: php --ri phalcon