Repository navigation
Build and test conda packages and wheels #14
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
| # Builds and tests dpctl's conda packages and wheels, see ci/README.md | |
| name: Intel CI | |
| on: | |
| push: | |
| branches: [master] | |
| tags: ['*'] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| # A push or tag run gets a group of its own, so a queued master push is never dropped. | |
| concurrency: | |
| group: intel-ci-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| matrix: | |
| name: Platforms and Python versions | |
| runs-on: ${{ vars.GH_CI_RUNNER || 'ubuntu-latest' }} | |
| timeout-minutes: 10 | |
| outputs: | |
| matrix: ${{ steps.declared.outputs.matrix }} | |
| wheel: ${{ steps.declared.outputs.wheel }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.14" | |
| - name: Read the declared platforms and Python versions | |
| id: declared | |
| run: | | |
| python ci/matrix.py --event "$GITHUB_EVENT_NAME" --github-output matrix | |
| python ci/matrix.py --system wheel --event "$GITHUB_EVENT_NAME" --github-output wheel | |
| # The recipe and pyproject.toml declare no macOS, as SYCL has none. | |
| build: | |
| name: ${{ matrix.name }} Python ${{ matrix.python }} | |
| needs: matrix | |
| runs-on: ${{ matrix.platform == 'windows' && (vars.GH_CI_WINDOWS_RUNNER || 'windows-2022') || matrix.platform == 'macos' && (vars.GH_CI_MACOS_RUNNER || 'macos-26-intel') || (vars.GH_CI_RUNNER || 'ubuntu-latest') }} | |
| timeout-minutes: 150 | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }} | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| # The recipe takes its version from git describe. | |
| fetch-depth: 0 | |
| # Miniforge 26.9.4-0 fails setup-miniconda's conda init on Windows runners; 26.7.2-0 works. | |
| - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 | |
| with: | |
| miniforge-version: 26.7.2-0 | |
| activate-environment: "" | |
| conda-remove-defaults: "true" | |
| - name: Install conda-build | |
| run: conda install -y -q -n base --override-channels -c conda-forge conda-build | |
| - name: Build and run the recipe tests | |
| env: | |
| PYTHON_VERSION: ${{ matrix.python }} | |
| run: python ci/build.py --python "$PYTHON_VERSION" --output "$RUNNER_TEMP/output" | |
| - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: dpctl ${{ matrix.name }} Python ${{ matrix.python }} | |
| path: ${{ runner.temp }}/output/*.conda | |
| if-no-files-found: error | |
| # Tags keep them 30 days, pull requests and pushes to master 3. | |
| retention-days: ${{ startsWith(github.ref, 'refs/tags/') && 30 || 3 }} | |
| test: | |
| name: Test ${{ matrix.name }} Python ${{ matrix.python }} | |
| needs: [matrix, build] | |
| runs-on: ${{ matrix.platform == 'windows' && (vars.GH_CI_WINDOWS_RUNNER || 'windows-2022') || matrix.platform == 'macos' && (vars.GH_CI_MACOS_RUNNER || 'macos-26-intel') || (vars.GH_CI_RUNNER || 'ubuntu-latest') }} | |
| timeout-minutes: 60 | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }} | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: dpctl ${{ matrix.name }} Python ${{ matrix.python }} | |
| path: ${{ runner.temp }}/artifacts | |
| - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 | |
| with: | |
| miniforge-version: 26.7.2-0 | |
| activate-environment: "" | |
| conda-remove-defaults: "true" | |
| - name: Install the package and run ci/test.py | |
| env: | |
| PYTHON_VERSION: ${{ matrix.python }} | |
| EVENT: ${{ startsWith(github.ref, 'refs/tags/') && 'tag' || github.event_name == 'pull_request' && 'pr' || 'push' }} | |
| COMMIT: ${{ github.event.pull_request.head.sha || github.sha }} | |
| run: >- | |
| python ci/hooks.py --python "$PYTHON_VERSION" --artifacts "$RUNNER_TEMP/artifacts" | |
| --work "$RUNNER_TEMP/hooks" --event "$EVENT" --commit "$COMMIT" | |
| build-wheel: | |
| name: ${{ matrix.name }} Wheels Python ${{ matrix.python }} | |
| needs: matrix | |
| runs-on: ${{ matrix.platform == 'windows' && (vars.GH_CI_WINDOWS_RUNNER || 'windows-2022') || matrix.platform == 'macos' && (vars.GH_CI_MACOS_RUNNER || 'macos-26-intel') || (vars.GH_CI_RUNNER || 'ubuntu-latest') }} | |
| timeout-minutes: 150 | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.matrix.outputs.wheel) }} | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| # versioneer takes the version from git describe. | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.14" | |
| # CMake builds with Ninja and icx, which need MSVC's environment. | |
| - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
| if: matrix.platform == 'windows' | |
| - name: Install cibuildwheel | |
| run: python -m pip install --no-input cibuildwheel==4.3.5 | |
| - name: Build the wheel | |
| env: | |
| PYTHON_VERSION: ${{ matrix.python }} | |
| run: python ci/build.py --system wheel --python "$PYTHON_VERSION" --output "$RUNNER_TEMP/output" | |
| - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: dpctl ${{ matrix.name }} Wheels Python ${{ matrix.python }} | |
| path: ${{ runner.temp }}/output/*.whl | |
| if-no-files-found: error | |
| retention-days: ${{ startsWith(github.ref, 'refs/tags/') && 30 || 3 }} | |
| test-wheel: | |
| name: Test ${{ matrix.name }} Wheels Python ${{ matrix.python }} | |
| needs: [matrix, build-wheel] | |
| runs-on: ${{ matrix.platform == 'windows' && (vars.GH_CI_WINDOWS_RUNNER || 'windows-2022') || matrix.platform == 'macos' && (vars.GH_CI_MACOS_RUNNER || 'macos-26-intel') || (vars.GH_CI_RUNNER || 'ubuntu-latest') }} | |
| timeout-minutes: 60 | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.matrix.outputs.wheel) }} | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: dpctl ${{ matrix.name }} Wheels Python ${{ matrix.python }} | |
| path: ${{ runner.temp }}/artifacts | |
| - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 | |
| with: | |
| miniforge-version: 26.7.2-0 | |
| activate-environment: "" | |
| conda-remove-defaults: "true" | |
| - name: Install the wheel and run ci/test.py | |
| env: | |
| PYTHON_VERSION: ${{ matrix.python }} | |
| EVENT: ${{ startsWith(github.ref, 'refs/tags/') && 'tag' || github.event_name == 'pull_request' && 'pr' || 'push' }} | |
| COMMIT: ${{ github.event.pull_request.head.sha || github.sha }} | |
| run: >- | |
| python ci/hooks.py --kind wheel --python "$PYTHON_VERSION" --artifacts "$RUNNER_TEMP/artifacts" | |
| --work "$RUNNER_TEMP/hooks" --event "$EVENT" --commit "$COMMIT" | |
| # The dev channel on anaconda.org, which docs and the nightly run-tests-from-dppy-bits.yaml read. | |
| upload: | |
| name: Upload to anaconda.org | |
| needs: [test, test-wheel] | |
| if: | | |
| github.repository == 'IntelPython/dpctl' && | |
| github.event_name == 'push' && | |
| (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) | |
| runs-on: ${{ vars.GH_CI_RUNNER || 'ubuntu-latest' }} | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| pattern: dpctl * | |
| merge-multiple: true | |
| path: ${{ runner.temp }}/packages | |
| - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.14" | |
| - name: Install anaconda-client | |
| run: python -m pip install --no-input anaconda-client | |
| - name: Upload the conda packages and the wheels | |
| env: | |
| ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
| PACKAGES: ${{ runner.temp }}/packages | |
| run: | | |
| cd "$PACKAGES" | |
| shopt -s nullglob | |
| conda_packages=(dpctl-*.conda) | |
| wheels=(dpctl-*.whl) | |
| if (( ${#conda_packages[@]} == 0 || ${#wheels[@]} == 0 )); then | |
| echo "::error::no dpctl conda package or wheel to upload" | |
| exit 1 | |
| fi | |
| anaconda --token "$ANACONDA_TOKEN" upload --user dppy --label dev "${conda_packages[@]}" | |
| for wheel in "${wheels[@]}"; do | |
| # The version is the file name's second field (PEP 427) | |
| version=${wheel#dpctl-} | |
| version=${version%%-*} | |
| anaconda --token "$ANACONDA_TOKEN" upload --user dppy --label dev "$wheel" --version "$version" | |
| done | |
| cleanup: | |
| name: Clean up anaconda.org | |
| needs: upload | |
| if: | | |
| github.repository == 'IntelPython/dpctl' && | |
| github.event_name == 'push' && | |
| (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) | |
| runs-on: ${{ vars.GH_CI_RUNNER || 'ubuntu-latest' }} | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| repository: IntelPython/devops-tools | |
| ref: 08ffddf88627957e8b094817aac4ce0bde7cff63 # main | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.11" | |
| - name: Install anaconda-client | |
| run: python -m pip install --no-input anaconda-client | |
| - name: Remove the old dev packages | |
| env: | |
| ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
| run: python scripts/cleanup-old-packages.py --verbose --force --token "$ANACONDA_TOKEN" --package dppy/dpctl --label dev |