diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c137fd3..9357834 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,13 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest] + include: + - os: ubuntu-latest + cmake_extra_args: -DCMAKE_INSTALL_PREFIX=/usr/local + install_cmd: sudo cmake --install level-zero-build && sudo ldconfig + - os: windows-latest + cmake_extra_args: "" + install_cmd: 'for dll in $(find level-zero-build -name "*.dll"); do cp "$dll" /c/Windows/System32/; done' steps: - uses: actions/checkout@v4 @@ -62,44 +68,26 @@ jobs: with: go-version-file: go.mod - - name: Install Intel Level Zero (Linux) - if: runner.os == 'Linux' + - name: Download Intel Level Zero Source Code + shell: bash run: | - # The apt runtime package (libze1) does NOT ship libze_null.so, which is + # The apt runtime package (libze1) does NOT ship libze_null, which is # required for ZE_ENABLE_NULL_DRIVER=1. Build from source instead so the - # loader and the null driver are both present, matching the Windows approach. + # loader and the null driver are both present RELEASE=$(curl -sf https://api.github.com/repos/oneapi-src/level-zero/releases/latest \ | jq -r '.tag_name') git clone https://github.com/oneapi-src/level-zero.git --depth=1 \ --branch "$RELEASE" level-zero-src + + - name: Build & Install Intel Level Zero + shell: bash + run: | cmake -S level-zero-src -B level-zero-build \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/usr/local \ - -DBUILD_TESTING=OFF - cmake --build level-zero-build --parallel - sudo cmake --install level-zero-build - sudo ldconfig - - - name: Install Intel Level Zero (Windows) - if: runner.os == 'Windows' - shell: pwsh - run: | - # The win-sdk zip only contains headers + import .lib files, no runtime DLLs. - # Build ze_loader.dll / ze_null.dll from source using the bundled MSVC toolchain. - $release = Invoke-RestMethod "https://api.github.com/repos/oneapi-src/level-zero/releases/latest" - $tag = $release.tag_name - Write-Host "Building level-zero $tag from source" - git clone https://github.com/oneapi-src/level-zero.git --depth=1 --branch $tag level-zero-src - cmake -S level-zero-src -B level-zero-build ` - -DCMAKE_BUILD_TYPE=Release ` - -DBUILD_TESTING=OFF + -DBUILD_TESTING=OFF \ + ${{ matrix.cmake_extra_args }} cmake --build level-zero-build --config Release --parallel - # Install all produced DLLs (ze_loader, ze_null, ze_validation_layer, ze_tracing_layer) - $dlls = Get-ChildItem -Recurse -Filter "*.dll" -Path level-zero-build - foreach ($dll in $dlls) { - Copy-Item $dll.FullName "$env:SystemRoot\System32\" -Force - Write-Host "Installed $($dll.Name) to System32" - } + ${{ matrix.install_cmd }} - name: Run examples shell: bash