Run tests suite #641
Workflow file for this run
This file contains hidden or 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: Run tests suite | |
| on: | |
| # For Branch-Protection check. Only the default branch is supported. See | |
| # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection | |
| branch_protection_rule: | |
| # To guarantee Maintained check is occasionally updated. See | |
| # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained | |
| schedule: | |
| - cron: '28 2 * * *' | |
| workflow_dispatch: | |
| permissions: read-all | |
| env: | |
| PACKAGE_NAME: dpctl | |
| MODULE_NAME: dpctl | |
| TEST_ENV_NAME: test_dpctl | |
| INTEL_CHANNEL: "https://software.repos.intel.com/python/conda/" | |
| jobs: | |
| test_linux: | |
| # disable scheduled workflow to be run in forks | |
| if: github.event.repository.fork == false | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 45 | |
| strategy: | |
| matrix: | |
| python: ['3.10', '3.11', '3.12', '3.13'] | |
| python_spec: [''] | |
| include: | |
| - python: '3.14' | |
| python_spec: '3.14.* *_cp314' | |
| experimental: false | |
| runner: ubuntu-22.04 | |
| - python: '3.14' | |
| python_spec: '3.14.* *_cp314t' | |
| experimental: false | |
| runner: ubuntu-22.04 | |
| - python: '3.14' | |
| python_spec: '3.14.* *_cp314' | |
| experimental: false | |
| runner: ubuntu-24.04 | |
| - python: '3.14' | |
| python_spec: '3.14.* *_cp314t' | |
| experimental: false | |
| runner: ubuntu-24.04 | |
| experimental: [false] | |
| runner: [ubuntu-22.04, ubuntu-24.04] | |
| continue-on-error: ${{ matrix.experimental }} | |
| steps: | |
| - name: Construct channels line | |
| run: | | |
| echo "CHANNELS=-c ${{ env.INTEL_CHANNEL }} -c conda-forge --override-channels" >> "$GITHUB_ENV" | |
| - name: Display channels line | |
| run: | | |
| echo "${{ env.CHANNELS }}" | |
| - name: Set pkgs_dirs | |
| run: | | |
| echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc | |
| - name: Install dpctl | |
| run: | | |
| PYTHON_SPEC="${{ matrix.python_spec }}" | |
| if [ -z "${PYTHON_SPEC}" ]; then | |
| PYTHON_SPEC="${{ matrix.python }}" | |
| fi | |
| # shellcheck disable=SC2086 | |
| conda create -n "${{ env.TEST_ENV_NAME }}" -c dppy/label/dev ${{ env.CHANNELS }} dpctl pytest cython setuptools c-compiler cxx-compiler python="${PYTHON_SPEC}" | |
| - name: Smoke test | |
| run: | | |
| . "$CONDA/etc/profile.d/conda.sh" | |
| conda activate "${{ env.TEST_ENV_NAME }}" | |
| python -m dpctl -f | |
| - name: Create test temp dir | |
| # create temporary empty folder to runs tests from | |
| # https://github.com/pytest-dev/pytest/issues/11904 | |
| run: mkdir -p "${GITHUB_WORKSPACE}/test_tmp" | |
| - name: Run tests | |
| working-directory: ${{ github.workspace }}/test_tmp | |
| env: | |
| SYCL_CACHE_PERSISTENT: 1 | |
| run: | | |
| . "$CONDA/etc/profile.d/conda.sh" | |
| conda activate "${{ env.TEST_ENV_NAME }}" | |
| python -m pytest -v --pyargs "${{ env.MODULE_NAME }}" | |
| test_windows: | |
| # disable scheduled workflow to be run in forks | |
| if: github.event.repository.fork == false | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 60 | |
| defaults: | |
| run: | |
| shell: cmd /C CALL {0} | |
| strategy: | |
| matrix: | |
| python: ['3.10', '3.11', '3.12', '3.13'] | |
| python_spec: [''] | |
| include: | |
| - python: '3.14' | |
| python_spec: '3.14.* *_cp314' | |
| experimental: false | |
| runner: windows-latest | |
| - python: '3.14' | |
| python_spec: '3.14.* *_cp314t' | |
| experimental: false | |
| runner: windows-latest | |
| experimental: [false] | |
| runner: [windows-latest] | |
| continue-on-error: ${{ matrix.experimental }} | |
| env: | |
| workdir: '${{ github.workspace }}' | |
| steps: | |
| - name: Construct channels line | |
| shell: pwsh | |
| run: | | |
| echo "CHANNELS=-c ${{ env.INTEL_CHANNEL }} -c conda-forge --override-channels" >> $env:GITHUB_ENV | |
| - name: Display channels line | |
| run: | | |
| echo "${{ env.CHANNELS }}" | |
| - uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1 | |
| with: | |
| miniforge-version: latest | |
| channels: conda-forge | |
| conda-remove-defaults: true | |
| activate-environment: ${{ env.TEST_ENV_NAME }} | |
| python-version: ${{ matrix.python }} | |
| - name: Install dpctl | |
| run: | | |
| SET "PYTHON_SPEC=${{ matrix.python_spec }}" | |
| IF "%PYTHON_SPEC%"=="" SET "PYTHON_SPEC=${{ matrix.python }}" | |
| conda install -n ${{ env.TEST_ENV_NAME }} -c dppy/label/dev ${{ env.CHANNELS }} dpctl pytest cython setuptools c-compiler cxx-compiler python="%PYTHON_SPEC%" | |
| - name: Report content of test environment | |
| shell: cmd /C CALL {0} | |
| run: | | |
| conda info && conda list -n ${{ env.TEST_ENV_NAME }} | |
| # The OpenCL ICD loader finds the CPU driver either through OCL_ICD_FILENAMES, | |
| # which a conda activation script sets, or through the registry. Under the | |
| # elevated privileges that GitHub Actions runners have, only the registry is | |
| # consulted. How the key gets written depends on which build of | |
| # intel-opencl-rt the solver picks, and it picks both across this matrix: the | |
| # Intel channel build ships a script that writes it, while the conda-forge | |
| # repack of the same name instead installs ICD vendor files and leaves | |
| # discovery to khronos-opencl-icd-loader, so those have to be registered here. | |
| - name: Register the OpenCL CPU driver with the ICD loader | |
| shell: pwsh | |
| run: | | |
| $vendors = "HKLM:\SOFTWARE\Khronos\OpenCL\Vendors" | |
| $script = "$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1" | |
| $icds = @(Get-ChildItem -ErrorAction SilentlyContinue -Path "$env:CONDA_PREFIX\Library\etc\OpenCL\vendors\*.icd") | |
| if (Test-Path $script) { | |
| Write-Host "running $script" | |
| & $script | |
| } elseif ($icds.Count -gt 0) { | |
| if (-not (Test-Path $vendors)) { New-Item -Path $vendors -Force | Out-Null } | |
| foreach ($icd in $icds) { | |
| # conda substitutes the environment prefix into these text files with | |
| # forward slashes, which LoadLibrary does not accept as a separator | |
| $dll = (Get-Content -Path $icd.FullName -TotalCount 1).Trim().Replace("/", "\") | |
| if (-not (Test-Path $dll)) { throw "driver $dll named by $($icd.Name) does not exist" } | |
| Write-Host "registering $dll" | |
| New-ItemProperty -Path $vendors -Name $dll -Value 0 -PropertyType DWord -Force | Out-Null | |
| } | |
| } else { | |
| throw "intel-opencl-rt provided neither $script nor any ICD vendor file" | |
| } | |
| Get-ItemProperty -Path $vendors | |
| - name: Smoke test | |
| shell: cmd /C CALL {0} | |
| env: | |
| SYCL_UR_TRACE: 1 | |
| run: | | |
| call conda activate ${{ env.TEST_ENV_NAME }} | |
| python -m dpctl -f | |
| python -c "import dpctl; assert dpctl.has_cpu_devices(), 'no SYCL CPU device found'" | |
| - name: Create empty temporary directory to run tests from | |
| shell: cmd /C CALL {0} | |
| # create temporary empty folder to runs tests from | |
| # https://github.com/pytest-dev/pytest/issues/11904 | |
| run: >- | |
| mkdir "${{ env.workdir }}\test_tmp" | |
| - name: Run tests | |
| shell: cmd /C CALL {0} | |
| env: | |
| SYCL_CACHE_PERSISTENT: 1 | |
| working-directory: ${{ env.workdir }}\test_tmp | |
| run: | | |
| call conda activate ${{ env.TEST_ENV_NAME }} | |
| python -m pytest -v -s --pyargs ${{ env.MODULE_NAME }} |