-
Notifications
You must be signed in to change notification settings - Fork 39
130 lines (112 loc) · 4.06 KB
/
windows-tests.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
name: Windows (tests)
on:
pull_request:
branches:
- "master"
push:
tags:
- "*"
branches:
- "master"
jobs:
windows:
defaults:
run:
shell: cmd
strategy:
fail-fast: false
matrix:
version: ["7.4", "8.0", "8.1", "8.2", "8.3"]
arch: [x64, x86]
ts: [ts, nts]
experimental: [false]
runs-on: windows-2019
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Setup PHP
id: setup-php
uses: php/[email protected]
with:
version: ${{matrix.version}}
arch: ${{matrix.arch}}
ts: ${{matrix.ts}}
deps: 'libxml2,libcurl,libiconv,libssh2,openssl,nghttp2'
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{matrix.arch}}
toolset: ${{steps.setup-php.outputs.toolset}}
# install extra package deps (zlib) (static: _a.lib, and dynamic .lib)
- name: cache vcpkg libraries
id: cache-vcpkg
uses: actions/cache@v2
with:
path: |
${{github.workspace}}/vcpkg
${{github.workspace}}/vcpkg/installed
key: vcpkg-${{matrix.version}}-${{matrix.arch}}-${{ hashFiles('**/vcpkg.json') }}
restore-keys: |
vcpkg-${{matrix.version}}-${{matrix.arch}}-
- name: install zlib with vcpkg
uses: omars44/pecl-windows-deps-installer@master
with:
cache-hit: ${{ steps.cache-vcpkg.outputs.cache-hit }}
libraries: 'zlib'
arch: ${{matrix.arch}}
# start compiling
- name: phpize
run: |
phpize
- name: configure
run: |
configure --enable-solr --with-php-build=.\..\deps --with-prefix=${{steps.setup-php.outputs.prefix}}
- name: extract variables from Makefile (build_dir and dll_file)
shell: powershell
run: |
$makefileContent = Get-Content -Path ./Makefile -Raw
$buildDirsSub = [regex]::Match($makefileContent, "BUILD_DIRS_SUB=(.*)").Groups[1].Value.Trim()
$dllFullPath = Join-Path -Path $buildDirsSub -ChildPath "php_solr.dll"
echo "dll_full_path=$dllFullPath" | Out-File -Append -Encoding utf8 -FilePath $env:GITHUB_ENV
- name: make
run: nmake
- name: Did it compile successfully?
shell: powershell
run: |
$dll = $env:dll_full_path
Write-Host "`"Full DLL path:`" $dll`""
if (!(Test-Path $dll)) {
Write-Host "The path '$dll' does not exist."
exit 1
}
- name: test
env:
SOLR_SERVER_CONFIGURED: 0
run: nmake test TESTS="--show-diff -g FAIL,BORK,WARN,LEAK tests"
- name: Copy DLL to CWD and sign it
if: startsWith(github.ref, 'refs/tags/')
shell: powershell
run: |
Copy-Item -Path $env:dll_full_path -Destination "."
$checksum = Get-FileHash -Path "php_solr.dll" -Algorithm SHA256
$checksumHashLowercase = $checksum.Hash.ToLower()
[System.IO.File]::WriteAllText("php_solr.dll.sha256", $checksumHashLowercase)
Write-Host "SHA256: $checksumHashLowercase"
- name: Upload DLL to release
if: startsWith(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: php_solr.dll
asset_name: php_solr-dll-${{ matrix.version }}-${{ matrix.ts }}-${{ matrix.arch }}.dll
tag: ${{ github.ref }}
overwrite: true
- name: Upload SHA256 Checksum to release
if: startsWith(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: php_solr.dll.sha256
asset_name: php_solr-dll-${{ matrix.version }}-${{ matrix.ts }}-${{ matrix.arch }}.sha256
tag: ${{ github.ref }}
overwrite: true