Skip to content

Commit aba6c78

Browse files
committed
EXPERIMENT: windows-2022 + D: drive temp/caches + OPcache file cache
1 parent 846c719 commit aba6c78

2 files changed

Lines changed: 37 additions & 2 deletions

File tree

‎.github/workflows/reusable-functional.yml‎

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ jobs:
5151
WP_CLI_TEST_OBJECT_CACHE: ${{ inputs.object_cache }}
5252

5353
steps:
54+
# EXPERIMENT: relocate all temp/cache/install I/O to the fast D: drive.
55+
# The wp-cli-tests framework derives RUN_DIR (WP installs), the core
56+
# download/install caches, the SQLite caches, and HOME/COMPOSER_HOME
57+
# (hence WP_CLI_CACHE_DIR) all from sys_get_temp_dir(), and forwards
58+
# TEMP/TMP to spawned `wp` processes. Pointing TEMP/TMP at D: moves it all.
59+
- name: Redirect temp and caches to D: drive
60+
if: ${{ startsWith(inputs.os, 'windows') }}
61+
shell: pwsh
62+
run: |
63+
Get-PSDrive -PSProvider FileSystem | Format-Table -AutoSize
64+
if (-not (Test-Path 'D:\')) { Write-Error 'D: drive is not present on this runner'; exit 1 }
65+
New-Item -ItemType Directory -Force -Path 'D:\Temp' | Out-Null
66+
New-Item -ItemType Directory -Force -Path 'D:\opcache' | Out-Null
67+
"TEMP=D:\Temp" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
68+
"TMP=D:\Temp" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
69+
Write-Host ("D: free space: {0:N1} GB" -f ((Get-PSDrive D).Free / 1GB))
70+
5471
- name: Check out source code
5572
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5673
with:
@@ -75,12 +92,30 @@ jobs:
7592
with:
7693
php-version: '${{ inputs.php }}'
7794
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
78-
extensions: gd, imagick, mysql, zip, pdo_sqlite, exif, fileinfo
95+
extensions: gd, imagick, mysql, zip, pdo_sqlite, exif, fileinfo, opcache
7996
coverage: ${{ inputs.coverage && 'xdebug' || 'none' }}
8097
tools: composer
8198
env:
8299
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83100

101+
# EXPERIMENT: enable the OPcache file cache for CLI, stored on the fast D:
102+
# drive. Windows cannot share OPcache SHM across processes, so a disk cache
103+
# is the only way the many short-lived `wp`/`php` spawns can skip
104+
# recompilation of the WP-CLI framework code on every invocation.
105+
- name: Enable OPcache file cache on D: drive
106+
if: ${{ startsWith(inputs.os, 'windows') }}
107+
shell: pwsh
108+
run: |
109+
$ini = & php -r "echo php_ini_loaded_file();"
110+
Write-Host "Loaded php.ini: $ini"
111+
@"
112+
113+
opcache.enable=1
114+
opcache.enable_cli=1
115+
opcache.file_cache=D:\opcache
116+
"@ | Add-Content -Path $ini
117+
php -i | Select-String -Pattern 'opcache\.enable|opcache\.file_cache|Opcode Caching|File Cache' | ForEach-Object { $_.Line }
118+
84119
- name: Change ImageMagick policy to allow pdf->png conversion.
85120
if: ${{ inputs.os == 'ubuntu-22.04' || inputs.os == '' }}
86121
run: |

‎.github/workflows/reusable-testing.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ jobs:
317317
"php": "8.5",
318318
"wp": "trunk",
319319
"dbtype": "sqlite",
320-
"os": "windows-latest"
320+
"os": "windows-2022"
321321
}
322322
]
323323
}

0 commit comments

Comments
 (0)