Skip to content

[CI] Use oneAPI for Windows postcommit builds #2

[CI] Use oneAPI for Windows postcommit builds

[CI] Use oneAPI for Windows postcommit builds #2

name: SYCL Windows setup oneAPI env
on:
workflow_call:
inputs:
runner:
type: string
required: True
jobs:
set-env-vars-job:
runs-on: ${{ fromJSON(inputs.runner) }}
steps:
- name: Setup oneAPI env
shell: powershell
run: |
batchFilePath = "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
$githubEnvFilePath = $env:GITHUB_ENV
$envBefore = Get-ChildItem Env: | ForEach-Object { "$($_.Name)=$($_.Value)" }
$envVars = & cmd.exe /c "call `"$batchFilePath`" && set" | Out-String
$envAfter = $envVars -split "`r`n" | Where-Object { $_ -match "^(.*?)=(.*)$" }
foreach ($envVar in $envAfter) {
if ($envVar -match "^(.*?)=(.*)$") {
$name = $matches[1]
$value = $matches[2]
$envBeforeVar = $envBefore | Where-Object { $_ -like "$name=*" }
if (-not $envBeforeVar -or $envBeforeVar -ne "$name=$value") {
Add-Content -Path $githubEnvFilePath -Value "$name=$value"
}
}
}