[CI] Use oneAPI for Windows postcommit builds #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
} | |
} | |
} |