Skip to content

Commit 6bab64f

Browse files
committed
work on windows workflow
1 parent f08f4bb commit 6bab64f

2 files changed

Lines changed: 19 additions & 23 deletions

File tree

.github/workflows/windows.yaml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -69,43 +69,42 @@ jobs:
6969
uses: actions/cache@v5
7070
with:
7171
path: |
72-
${{ env.VCPKG_INSTALLATION_ROOT }}\installed
72+
frankenphp\vcpkg_installed
7373
${{ env.VCPKG_INSTALLATION_ROOT }}\downloads
74-
key: ${{ runner.os }}-vcpkg-libs-${{ hashFiles('vcpkg/ports/**') }}
74+
key: ${{ runner.os }}-vcpkg-libs-${{ hashFiles('frankenphp/vcpkg.json') }}
7575
restore-keys: |
7676
${{ runner.os }}-vcpkg-libs-
77-
lookup-only: true
7877
7978
- name: Install Vcpkg Libraries
8079
working-directory: frankenphp
81-
run: '& "$env:VCPKG_INSTALLATION_ROOT\vcpkg.exe" install'
80+
run: 'vcpkg install'
8281

8382
- name: Download Watcher
8483
run: |
8584
$latestTag = gh release list --repo e-dant/watcher --limit 1 --exclude-drafts --exclude-pre-releases --json tagName --jq '.[0].tagName'
8685
Write-Host "Latest Watcher version: $latestTag"
8786
88-
gh release download $latestTag --repo e-dant/watcher --pattern "*x86_64-pc-windows-msvc.tar" --dir "$env:TEMP" -O watcher.tar
87+
gh release download $latestTag --repo e-dant/watcher --pattern "*x86_64-pc-windows-msvc.tar" -O watcher.tar
8988
90-
tar -xf "$env:TEMP\watcher.tar" -C "$env:GITHUB_WORKSPACE"
89+
tar -xf "watcher.tar" -C "$env:GITHUB_WORKSPACE"
9190
Rename-Item -Path "$env:GITHUB_WORKSPACE\x86_64-pc-windows-msvc" -NewName "watcher"
9291
9392
# See https://github.com/e-dant/watcher/issues/108
94-
New-Item -Path .\watcher\wtr -ItemType Directory
95-
Move-Item -Path .\watcher-c.h -Destination .\watcher\wtr\watcher-c.h
93+
New-Item -Path .\watcher\wtr -ItemType Directory -Force
94+
Move-Item -Path .\watcher\watcher-c.h -Destination .\watcher\wtr\watcher-c.h
9695
env:
9796
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9897

9998
- name: Download PHP
10099
run: |
101100
$webContent = Invoke-WebRequest -Uri $env:PHP_DOWNLOAD_BASE -UseBasicParsing
102-
$links = $webContent.Links.Href | Where-Object { $_ -match "php-(\d+\.\d+\.\d+)-Win32-vs17-x64\.zip" }
101+
$links = $webContent.Links.Href | Where-Object { $_ -match "php-\d+\.\d+\.\d+-Win32-vs17-x64\.zip$" }
103102
104103
if (-not $links) { throw "Could not find PHP zip files at $env:PHP_DOWNLOAD_BASE" }
105104
106-
$latestFile = $links | Sort-Object { [version]($_ -replace 'php-', '' -replace '-Win32-vs17-x64.zip', '') } | Select-Object -Last 1
105+
$latestFile = $links | Sort-Object { if ($_ -match '(\d+\.\d+\.\d+)') { [version]$matches[1] } } | Select-Object -Last 1
107106
108-
$version = $latestFile -replace 'php-', '' -replace '-Win32-vs17-x64.zip', ''
107+
$version = if ($latestFile -match '(\d+\.\d+\.\d+)') { $matches[1] }
109108
Write-Host "Detected latest PHP version: $version"
110109
111110
"PHP_VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Append
@@ -121,30 +120,30 @@ jobs:
121120
122121
- name: Prepare env
123122
run: |
124-
$vcpkgRoot = "$env:VCPKG_INSTALLATION_ROOT\installed\x64-windows"
123+
$vcpkgRoot = "$env:GITHUB_WORKSPACE\frankenphp\vcpkg_installed\x64-windows"
125124
$watcherRoot = "$env:GITHUB_WORKSPACE\watcher"
126125
$phpBin = "$env:GITHUB_WORKSPACE\php-bin"
127126
$phpDevel = "$env:GITHUB_WORKSPACE\php-devel\php-$env:PHP_VERSION-devel-vs17-x64"
128127
129128
echo "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
130-
echo "$env:VCPKG_INSTALLATION_ROOT\installed\x64-windows\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
131-
echo "$env:VCPKG_INSTALLATION_ROOT\watcher" | Out-File -FilePath $env:GITHUB_PATH -Append
129+
echo "$vcpkgRoot\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
130+
echo "$env:GITHUB_WORKSPACE\watcher" | Out-File -FilePath $env:GITHUB_PATH -Append
132131
echo "$env:GITHUB_WORKSPACE\php-bin" | Out-File -FilePath $env:GITHUB_PATH -Append
133132
134133
echo "CGO_CFLAGS=-I$vcpkgRoot\include -I$watcherRoot -I$phpDevel\include -I$phpDevel\include\main -I$phpDevel\include\TSRM -I$phpDevel\include\Zend -I$phpDevel\include\ext" | Out-File -FilePath $env:GITHUB_ENV -Append
135134
echo "CGO_LDFLAGS=-L$vcpkgRoot\lib -lbrotlienc -L$watcherRoot -llibwatcher-c -L$phpBin -L$phpDevel\lib -lphp8ts -lphp8embed" | Out-File -FilePath $env:GITHUB_ENV -Append
136135
137136
- name: Build FrankenPHP
138137
run: go build -ldflags '-extldflags="-fuse-ld=lld"' -tags nobadger,nomysql,nopgx
139-
working-directory: ${{ env.GITHUB_WORKSPACE }}/frankenphp
138+
working-directory: frankenphp\caddy\frankenphp
140139

141140
- name: Create Zip Archive
142141
run: |
143142
Move-Item frankenphp\caddy\frankenphp\frankenphp.exe php-bin
144143
Move-Item watcher\libwatcher-c.dll php-bin
145-
Move-Item "$env:VCPKG_INSTALLATION_ROOT\installed\x64-windows\bin\brotlienc.dll" php-bin
146-
Move-Item "$env:VCPKG_INSTALLATION_ROOT\installed\x64-windows\bin\brotlicommon.dll" php-bin
147-
Move-Item "$env:VCPKG_INSTALLATION_ROOT\installed\x64-windows\bin\pthreadVC3.dll" php-bin
144+
Move-Item "frankenphp\vcpkg_installed\x64-windows\bin\brotlienc.dll" php-bin
145+
Move-Item "frankenphp\vcpkg_installed\x64-windows\bin\brotlicommon.dll" php-bin
146+
Move-Item "frankenphp\vcpkg_installed\x64-windows\bin\pthreadVC3.dll" php-bin
148147
149148
$version = $env:PHP_VERSION
150149
$zipName = "frankenphp-php-$version-Win32-vs17-x64.zip"
@@ -176,4 +175,4 @@ jobs:
176175
go test -ldflags '-extldflags="-fuse-ld=lld"' ./...
177176
cd caddy
178177
go test -ldflags '-extldflags="-fuse-ld=lld"' -tags nobadger,nomysql,nopgx ./...
179-
working-directory: ${{ env.GITHUB_WORKSPACE }}/frankenphp
178+
working-directory: ${{ env.GITHUB_WORKSPACE }}\frankenphp

vcpkg.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
{
2-
"dependencies": [
3-
"brotli",
4-
"pthreads"
5-
]
2+
"dependencies": ["brotli", "pthreads"]
63
}

0 commit comments

Comments
 (0)