Skip to content

Commit

Permalink
improve gh path handling; fix cl version check; fix pytest_tests; fix…
Browse files Browse the repository at this point in the history
… emptu output param
  • Loading branch information
leofang committed Nov 25, 2024
1 parent bd8be7c commit 1e0896a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ jobs:
run: |
Invoke-WebRequest -Uri "$env:GH_MSI_URL" -OutFile "gh_installer.msi"
Start-Process msiexec.exe -Wait -Verbose -ArgumentList '/i "gh_installer.msi" /qn'
$env:GH_POSSIBLE_PATHS = "C:\\Program Files\\GitHub CLI;C:\\Program Files (x86)\\GitHub CLI"
echo "GH_POSSIBLE_PATHS=$env:GH_POSSIBLE_PATHS" >> $env:GITHUB_ENV
$env:Path += ";$env:GH_POSSIBLE_PATHS"
$GH_POSSIBLE_PATHS = "C:\\Program Files\\GitHub CLI", "C:\\Program Files (x86)\\GitHub CLI"
foreach ($p in $GH_POSSIBLE_PATHS) {
echo "$p" >> $env:GITHUB_PATH
$env:Path += ";$p"
}
gh --version
- name: Check system
Expand Down Expand Up @@ -139,7 +141,6 @@ jobs:
# TODO: this is dangerous because we're overwriting the global GHA cache!
# We should have another workflow that updates the global cache upon PR merge.
$env:Path += ";$env:GH_POSSIBLE_PATHS"
if ((gh cache list | Select-String -Pattern ${{ env.CACHE_KEY }}).Count -eq 1) {
gh cache delete ${{ env.CACHE_KEY }}
}
Expand Down
16 changes: 9 additions & 7 deletions .pfnci/windows/GHA-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ function FindAndCheckMSVC {
-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
-property installationPath
$clPath = Join-Path $vsPath "VC\Tools\MSVC\*\bin\Hostx64\x64\cl.exe"
$clPath = Get-ChildItem $clPath

$CL_VERSION_STRING = & $clPath /?
if ($CL_VERSION_STRING -match "Version (\d+\.\d+)\.\d+") {
$CL_VERSION = [version]$matches[1]
$clPath = (Get-ChildItem $clPath).FullName
echo "found cl.exe: $clPath"
# For some reason below just doesn't work in the CI...
Start-Process -NoNewWindow -RedirectStandardError cl.out -FilePath "$clPath"
$CL_VERSION_STRING = & type cl.out
if (($CL_VERSION_STRING -join " ") -match "Version (\d+\.\d+)\.\d+") {
$CL_VERSION = $matches[1]
echo "Detected cl.exe version: $CL_VERSION"
}
}
Expand Down Expand Up @@ -105,9 +107,9 @@ function Main {
echo "CuPy Configuration:"
RunOrDie python -c "import cupy; print(cupy); cupy.show_config()"
echo "Running test..."
$pytest_tests = "cupy_tests/core_tests/test*.py" # TODO: remove me
$pytest_tests = @("cupy_tests/core_tests/test*.py") # TODO: remove me
# TODO: pass timeout as a function argument?
$test_retval = RunWithTimeout -timeout 18000 -- python -m pytest -rfEX @pytest_opts @pytest_tests
$test_retval = RunWithTimeout -timeout 18000 -output "" -- python -m pytest -rfEX @pytest_opts --maxfail=10 @pytest_tests
popd

if ($test_retval -ne 0) {
Expand Down
5 changes: 3 additions & 2 deletions .pfnci/windows/_error_handler.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ function RunWithTimeout {
param(
[Parameter(Mandatory=$true)]
[int]$timeout,
[Parameter(Mandatory=$false)]
[Parameter(Mandatory=$true)]
[AllowEmptyString()]
[string]$output,
[Parameter(Mandatory=$true)]
[string]$command,
[Parameter(Mandatory=$true, ValueFromRemainingArguments=$true)]
[string[]]$params
)
if ($PSBoundParameters.ContainsKey('output')) {
if ($output) {
$process = Start-Process -PassThru -NoNewWindow -RedirectStandardOutput $output -FilePath $command -ArgumentList $params
} else {
$process = Start-Process -PassThru -NoNewWindow -FilePath $command -ArgumentList $params
Expand Down

0 comments on commit 1e0896a

Please sign in to comment.