|
10 | 10 | - "master" |
11 | 11 |
|
12 | 12 | jobs: |
13 | | - windows: |
14 | | - defaults: |
15 | | - run: |
16 | | - shell: cmd |
| 13 | + get-extension-matrix: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + matrix: ${{ steps.extension-matrix.outputs.matrix }} |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + - name: Get the extension matrix |
| 21 | + id: extension-matrix |
| 22 | + uses: php/php-windows-builder/extension-matrix@v1 |
| 23 | + build: |
| 24 | + needs: get-extension-matrix |
| 25 | + runs-on: ${{ matrix.os }} |
17 | 26 | strategy: |
18 | 27 | fail-fast: false |
19 | | - matrix: |
20 | | - version: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4", "8.5"] |
21 | | - arch: [x64, x86] |
22 | | - ts: [ts, nts] |
23 | | - os: [windows-2022] |
24 | | - exclude: |
25 | | - - { os: windows-2022, version: "7.4" } |
26 | | - |
27 | | - runs-on: ${{matrix.os}} |
| 28 | + matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}} |
28 | 29 | steps: |
29 | | - - name: Checkout the code |
30 | | - uses: actions/checkout@v2 |
31 | | - |
32 | | - - name: Setup PHP |
33 | | - id: setup-php |
34 | | - uses: php/setup-php-sdk@v0.12 |
35 | | - with: |
36 | | - version: ${{matrix.version}} |
37 | | - arch: ${{matrix.arch}} |
38 | | - ts: ${{matrix.ts}} |
39 | | - deps: 'libxml2,libcurl,libiconv,libssh2,openssl,nghttp2' |
40 | | - cache: true |
41 | | - |
42 | | - - name: Enable Developer Command Prompt |
43 | | - uses: ilammy/msvc-dev-cmd@v1 |
44 | | - with: |
45 | | - arch: ${{matrix.arch}} |
46 | | - toolset: ${{steps.setup-php.outputs.toolset}} |
47 | | - |
48 | | - # install extra package deps (zlib) (static: _a.lib, and dynamic .lib) |
49 | | - - name: cache vcpkg libraries |
50 | | - id: cache-vcpkg |
51 | | - uses: actions/cache@v4 |
52 | | - with: |
53 | | - path: | |
54 | | - ${{github.workspace}}/vcpkg |
55 | | - ${{github.workspace}}/vcpkg/installed |
56 | | - key: vcpkg-${{matrix.version}}-${{matrix.arch}}-${{ hashFiles('**/vcpkg.json') }} |
57 | | - restore-keys: | |
58 | | - vcpkg-${{matrix.version}}-${{matrix.arch}}- |
59 | | -
|
60 | | - - name: install zlib with vcpkg |
61 | | - uses: omars44/pecl-windows-deps-installer@master |
62 | | - with: |
63 | | - cache-hit: ${{ steps.cache-vcpkg.outputs.cache-hit }} |
64 | | - libraries: 'zlib' |
65 | | - arch: ${{matrix.arch}} |
66 | | - |
67 | | - |
68 | | - # start compiling |
69 | | - - name: phpize |
70 | | - run: | |
71 | | - phpize |
72 | | - - name: configure |
73 | | - run: | |
74 | | - configure --enable-solr --with-php-build=.\..\deps --with-prefix=${{steps.setup-php.outputs.prefix}} |
75 | | - |
76 | | - - name: extract variables from Makefile (build_dir and dll_file) |
77 | | - shell: powershell |
78 | | - run: | |
79 | | - $makefileContent = Get-Content -Path ./Makefile -Raw |
80 | | - $buildDirsSub = [regex]::Match($makefileContent, "BUILD_DIRS_SUB=(.*)").Groups[1].Value.Trim() |
81 | | - $dllFullPath = Join-Path -Path $buildDirsSub -ChildPath "php_solr.dll" |
82 | | - |
83 | | - echo "dll_full_path=$dllFullPath" | Out-File -Append -Encoding utf8 -FilePath $env:GITHUB_ENV |
84 | | - |
85 | | - - name: make |
86 | | - run: nmake |
87 | | - |
88 | | - - name: Did it compile successfully? |
89 | | - shell: powershell |
90 | | - run: | |
91 | | - $dll = $env:dll_full_path |
92 | | - Write-Host "`"Full DLL path:`" $dll`"" |
93 | | - if (!(Test-Path $dll)) { |
94 | | - Write-Host "The path '$dll' does not exist." |
95 | | - exit 1 |
96 | | - } |
97 | | - |
98 | | - - name: test |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@v4 |
| 32 | + - name: Build and test the extension |
99 | 33 | env: |
100 | | - SOLR_SERVER_CONFIGURED: 0 |
101 | | - run: nmake test TESTS="--show-diff -g FAIL,BORK,WARN,LEAK tests" |
102 | | - |
103 | | - - name: Copy DLL to CWD and sign it |
104 | | - if: startsWith(github.ref, 'refs/tags/') |
105 | | - shell: powershell |
106 | | - run: | |
107 | | - Copy-Item -Path $env:dll_full_path -Destination "." |
108 | | - $checksum = Get-FileHash -Path "php_solr.dll" -Algorithm SHA256 |
109 | | - $checksumHashLowercase = $checksum.Hash.ToLower() |
110 | | - [System.IO.File]::WriteAllText("php_solr.dll.sha256", $checksumHashLowercase) |
111 | | - Write-Host "SHA256: $checksumHashLowercase" |
112 | | -
|
113 | | -
|
114 | | - - name: Upload DLL to release |
115 | | - if: startsWith(github.ref, 'refs/tags/') |
116 | | - uses: svenstaro/upload-release-action@v2 |
| 34 | + SOLR_SERVER_CONFIGURED: 0 |
| 35 | + uses: php/php-windows-builder/extension@v1 |
117 | 36 | with: |
118 | | - repo_token: ${{ secrets.GITHUB_TOKEN }} |
119 | | - file: php_solr.dll |
120 | | - asset_name: php_solr-dll-${{ matrix.version }}-${{ matrix.ts }}-${{ matrix.arch }}.dll |
121 | | - tag: ${{ github.ref }} |
122 | | - overwrite: true |
123 | | - |
124 | | - - name: Upload SHA256 Checksum to release |
125 | | - if: startsWith(github.ref, 'refs/tags/') |
126 | | - uses: svenstaro/upload-release-action@v2 |
| 37 | + php-version: ${{ matrix.php-version }} |
| 38 | + arch: ${{ matrix.arch }} |
| 39 | + ts: ${{ matrix.ts }} |
| 40 | + libs: 'zlib,libxml2,libcurl,libiconv,libssh2,openssl,nghttp2' |
| 41 | + release: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + needs: build |
| 44 | + if: ${{ github.event_name == 'release' }} |
| 45 | + steps: |
| 46 | + - name: Upload artifact to the release |
| 47 | + uses: php/php-windows-builder/release@v1 |
127 | 48 | with: |
128 | | - repo_token: ${{ secrets.GITHUB_TOKEN }} |
129 | | - file: php_solr.dll.sha256 |
130 | | - asset_name: php_solr-dll-${{ matrix.version }}-${{ matrix.ts }}-${{ matrix.arch }}.sha256 |
131 | | - tag: ${{ github.ref }} |
132 | | - overwrite: true |
133 | | - |
| 49 | + release: ${{ github.event.release.tag_name }} |
| 50 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + |
0 commit comments