File tree Expand file tree Collapse file tree 3 files changed +59
-3
lines changed
Expand file tree Collapse file tree 3 files changed +59
-3
lines changed Original file line number Diff line number Diff line change 6262 with :
6363 name : artifacts
6464
65+ - name : Get Cache Key
66+ id : cache-key
67+ run : |
68+ $pv = '${{inputs.php-version}}'
69+ if('${{inputs.php-version}}' -ne 'master') {
70+ $pv = '${{inputs.php-version}}'.Split('.')[0..1] -join '.'
71+ }
72+ $vsVersion = (Get-Content -Raw -Path (Join-Path $(pwd).Path '\php\BuildPhp\config\vs.json') | ConvertFrom-Json).php.$pv
73+ $packagesListUrl = "https://downloads.php.net/~windows/php-sdk/deps/series/packages-$pv-$vsVersion-${{ matrix.arch }}-staging.txt"
74+ Invoke-WebRequest -OutFile packages.txt -Uri $packagesListUrl
75+ Add-Content -Value "cache-key=deps-$pv-${{ matrix.arch }}" -Path $env:GITHUB_OUTPUT
76+ Add-Content -Value "cache-dir=C:\deps-$pv-${{ matrix.arch }}" -Path $env:GITHUB_OUTPUT
77+
78+ - name : Cache Deps
79+ id : cache-deps
80+ uses : actions/cache@v4
81+ with :
82+ path : ${{ steps.cache-key.outputs.cache-dir }}
83+ key : ${{ steps.cache-key.outputs.cache-key }}-${{ hashFiles('packages.txt') }}
84+
6585 - name : Test PHP
6686 shell : pwsh
6787 continue-on-error : true
88+ env :
89+ DEPS_DIR : ${{ steps.cache-key.outputs.cache-dir }}
90+ DEPS_CACHE_HIT : ${{ steps.cache-deps.outputs.cache-hit }}
6891 run : |
6992 Import-Module (Join-Path $(pwd).Path '\php\BuildPhp') -Force
7093 Invoke-PhpTests -PhpVersion ${{inputs.php-version}} `
79102 with :
80103 name : test-results-${{matrix.arch}}-${{matrix.ts}}-${{matrix.opcache}}-${{matrix.test-type}}
81104 path : test-${{matrix.arch}}-${{matrix.ts}}-${{matrix.opcache}}-${{matrix.test-type}}.xml
105+
82106 upload :
83107 runs-on : ubuntu-latest
84108 needs : tests
Original file line number Diff line number Diff line change 2020 - name : Checkout
2121 uses : actions/checkout@v5
2222
23+ - name : Get Cache Key
24+ id : cache-key
25+ run : |
26+ $pv = '${{inputs.php-version}}'
27+ if('${{inputs.php-version}}' -ne 'master') {
28+ $pv = '${{inputs.php-version}}'.Split('.')[0..1] -join '.'
29+ }
30+ $vsVersion = (Get-Content -Raw -Path (Join-Path $(pwd).Path '\php\BuildPhp\config\vs.json') | ConvertFrom-Json).php.$pv
31+ $packagesListUrl = "https://downloads.php.net/~windows/php-sdk/deps/series/packages-$pv-$vsVersion-${{ matrix.arch }}-staging.txt"
32+ Invoke-WebRequest -OutFile packages.txt -Uri $packagesListUrl
33+ Add-Content -Value "cache-key=deps-$pv-${{ matrix.arch }}" -Path $env:GITHUB_OUTPUT
34+ Add-Content -Value "cache-dir=C:\deps-$pv-${{ matrix.arch }}" -Path $env:GITHUB_OUTPUT
35+
36+ - name : Cache Deps
37+ id : cache-deps
38+ uses : actions/cache@v4
39+ with :
40+ path : ${{ steps.cache-key.outputs.cache-dir }}
41+ key : ${{ steps.cache-key.outputs.cache-key }}-${{ hashFiles('packages.txt') }}
42+
2343 - name : Run Tests
2444 shell : pwsh
2545 continue-on-error : true
46+ env :
47+ DEPS_DIR : ${{ steps.cache-key.outputs.cache-dir }}
48+ DEPS_CACHE_HIT : ${{ steps.cache-deps.outputs.cache-hit }}
2649 run : |
2750 Import-Module (Join-Path $(pwd).Path '\php\BuildPhp') -Force
2851 Invoke-PhpTests -PhpVersion ${{inputs.php-version}} `
Original file line number Diff line number Diff line change @@ -71,13 +71,22 @@ function Add-TestRequirements {
7171 }
7272
7373 Get-PhpSdk
74- $env: DEPS_DIR = " $currentDirectory /../deps"
75- New-Item " $env: DEPS_DIR " - ItemType " directory" - Force > $null 2>&1
74+ $FetchDeps = $False
75+ if ($null -eq $env: DEPS_DIR ) {
76+ $majorMinorVersion = ($PhpVersion -split ' \.' )[0 .. 1 ] -join ' .'
77+ $env: DEPS_DIR = " C:\deps-$majorMinorVersion -$Arch "
78+ $FetchDeps = $True
79+ }
80+ if (-not (Test-Path $env: DEPS_DIR )) {
81+ New-Item " $env: DEPS_DIR " - ItemType " directory" - Force > $null 2>&1
82+ }
7683 $branch = if ($PhpVersion -eq ' master' ) {' master' } else {($PhpVersion -split ' \.' )[0 .. 1 ] -join ' .' }
7784 $env: PHP_SDK_VS = $VsVersion
7885 $env: PHP_SDK_ARCH = $Arch
7986 $bat_content = @ ()
80- $bat_content += " cmd /c phpsdk_deps --update --force --no-backup --branch $branch --stability staging --deps $env: DEPS_DIR "
87+ if ($FetchDeps -eq $True -or $null -eq $Env: DEPS_CACHE_HIT -or $Env: DEPS_CACHE_HIT -ne ' true' ) {
88+ $bat_content += " cmd /c phpsdk_deps --update --force --no-backup --branch $branch --stability staging --deps $env: DEPS_DIR "
89+ }
8190 $bat_content += " editbin /stack:8388608 $binDirectoryPath \php.exe"
8291 $bat_content += " editbin /stack:8388608 $binDirectoryPath \php-cgi.exe"
8392 Set-Content - Encoding " ASCII" - Path vs.bat - Value $bat_content
You can’t perform that action at this time.
0 commit comments