Skip to content

Commit cf6e2e0

Browse files
cataphractclaude
andcommitted
release.yml: replace manual libarchive build with vcpkg install
Mirror the approach from tests.yml: drop the build-libarchive-windows precursor job and use vcpkg install libarchive directly in the windows-build job. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6b2b514 commit cf6e2e0

1 file changed

Lines changed: 20 additions & 73 deletions

File tree

.github/workflows/release.yml

Lines changed: 20 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ jobs:
3232
echo "Versions match: $TAG_VERSION"
3333
3434
create-draft-release:
35-
if: startsWith(github.ref, 'refs/tags/')
3635
needs: [check-version]
3736
runs-on: ubuntu-latest
3837
permissions:
@@ -48,71 +47,6 @@ jobs:
4847
GH_TOKEN: ${{ github.token }}
4948
run: gh release create "${{ github.ref_name }}" --title "${{ github.ref_name }}" --draft --notes-from-tag
5049

51-
build-libarchive-windows:
52-
runs-on: windows-2022
53-
outputs:
54-
cache-key: ${{ steps.cache-key.outputs.key }}
55-
steps:
56-
- name: Checkout libarchive
57-
uses: actions/checkout@v4
58-
with:
59-
repository: libarchive/libarchive
60-
path: libarchive-src
61-
62-
- name: Compute cache key
63-
id: cache-key
64-
shell: pwsh
65-
run: |
66-
$sha = git -C libarchive-src rev-parse HEAD
67-
"key=libarchive-windows-x64-static-full-v1-$sha" >> $env:GITHUB_OUTPUT
68-
69-
- name: Restore cached build
70-
id: cache
71-
uses: actions/cache@v4
72-
with:
73-
path: C:\libarchive-install
74-
key: ${{ steps.cache-key.outputs.key }}
75-
76-
- name: Install vcpkg dependencies
77-
if: steps.cache.outputs.cache-hit != 'true'
78-
shell: pwsh
79-
env:
80-
VCPKG_BINARY_SOURCES: clear;x-gha,readwrite
81-
run: |
82-
vcpkg install zlib bzip2 liblzma lz4 zstd openssl `
83-
--triplet x64-windows-static-md
84-
85-
- name: Build and install libarchive
86-
if: steps.cache.outputs.cache-hit != 'true'
87-
shell: pwsh
88-
run: |
89-
$vcpkg_root = $env:VCPKG_INSTALLATION_ROOT
90-
cmake -B libarchive-build -S libarchive-src `
91-
-G "Visual Studio 17 2022" -A x64 `
92-
"-DCMAKE_TOOLCHAIN_FILE=$vcpkg_root\scripts\buildsystems\vcpkg.cmake" `
93-
-DVCPKG_TARGET_TRIPLET=x64-windows-static-md `
94-
-DCMAKE_INSTALL_PREFIX=C:\libarchive-install `
95-
-DBUILD_SHARED_LIBS=OFF `
96-
-DENABLE_TEST=OFF `
97-
-DENABLE_TAR=OFF `
98-
-DENABLE_CAT=OFF `
99-
-DENABLE_CPIO=OFF
100-
cmake --build libarchive-build --config Release
101-
cmake --install libarchive-build --config Release
102-
103-
# Copy dep static libs into the install prefix so the
104-
# extension build can resolve them via --with-libarchive.
105-
$src = "$vcpkg_root\installed\x64-windows-static-md\lib"
106-
$dst = 'C:\libarchive-install\lib'
107-
foreach ($lib in @(
108-
'zlib.lib', 'bz2.lib', 'liblzma.lib',
109-
'lz4.lib', 'zstd.lib', 'zstd_static.lib',
110-
'libssl.lib', 'libcrypto.lib'
111-
)) {
112-
$src_lib = Join-Path $src $lib
113-
if (Test-Path $src_lib) { Copy-Item $src_lib $dst }
114-
}
115-
11650
windows-extension-matrix:
11751
runs-on: ubuntu-latest
11852
outputs:
@@ -128,28 +62,41 @@ jobs:
12862
arch: x64
12963

13064
windows-build:
131-
needs: [build-libarchive-windows, windows-extension-matrix]
65+
needs: [windows-extension-matrix]
13266
runs-on: ${{ matrix.os }}
13367
strategy:
13468
fail-fast: false
13569
matrix: ${{ fromJson(needs.windows-extension-matrix.outputs.matrix) }}
13670
steps:
13771
- uses: actions/checkout@v4
13872

139-
- name: Restore libarchive
140-
uses: actions/cache/restore@v4
73+
- name: Cache vcpkg packages
74+
id: vcpkg-cache
75+
uses: actions/cache@v4
14176
with:
142-
path: C:\libarchive-install
143-
key: ${{ needs.build-libarchive-windows.outputs.cache-key }}
144-
fail-on-cache-miss: true
77+
path: C:\vcpkg\installed\x64-windows-static-md
78+
key: vcpkg-x64-windows-static-md-libarchive-v1
79+
80+
- name: Install libarchive via vcpkg
81+
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
82+
shell: pwsh
83+
run: |
84+
$tripletDir = "$env:RUNNER_TEMP\vcpkg-triplets"
85+
New-Item -ItemType Directory -Force -Path $tripletDir | Out-Null
86+
Set-Content "$tripletDir\x64-windows-static-md.cmake" `
87+
"set(VCPKG_TARGET_ARCHITECTURE x64)`nset(VCPKG_CRT_LINKAGE dynamic)`nset(VCPKG_LIBRARY_LINKAGE static)`nset(VCPKG_BUILD_TYPE release)"
88+
C:\vcpkg\vcpkg.exe install libarchive `
89+
--triplet x64-windows-static-md `
90+
--overlay-triplets="$tripletDir" `
91+
--vcpkg-root C:\vcpkg
14592
14693
- name: Build the extension for Windows
14794
uses: php/php-windows-builder/extension@v1
14895
with:
14996
php-version: ${{ matrix.php-version }}
15097
arch: ${{ matrix.arch }}
15198
ts: ${{ matrix.ts }}
152-
args: --with-libarchive=C:\libarchive-install
99+
args: --with-libarchive=C:\vcpkg\installed\x64-windows-static-md
153100

154101
windows-release:
155102
if: startsWith(github.ref, 'refs/tags/')

0 commit comments

Comments
 (0)