Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 84 additions & 24 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,28 @@ permissions: read-all

env:
PACKAGE_NAME: mkl_umath
MODULE_NAME: mkl_umath
TEST_ENV_NAME: test_mkl_umath
VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); d = j['mkl_umath'][0];"
VER_SCRIPT2: "print('='.join((d[s] for s in ('version', 'build'))))"
CONDA_BUILD_VERSION: 26.3.0

jobs:
build_linux:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
include:
- python: "3.10"
numpy: "2.2"
- python: "3.11"
numpy: "2.3"
- python: "3.12"
numpy: "2.3"
- python: "3.13"
numpy: "2.3"
- python: "3.14"
numpy: "2.3"
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1
Expand Down Expand Up @@ -47,13 +60,25 @@ jobs:
- name: Add conda to system path
run: echo "$CONDA/bin" >> "$GITHUB_PATH"

- name: Update conda
run: |
conda update -n base --all

- name: Install conda-build
run: conda install conda-build
run: conda install -n base conda-build=${{ env.CONDA_BUILD_VERSION }} -c conda-forge --override-channels

- name: Show Conda info
run: |
conda info --all

- name: List base environment packages
run: |
conda list -n base

- name: Build conda package
run: |
CHANNELS=(-c "https://software.repos.intel.com/python/conda" -c "conda-forge" --override-channels)
VERSIONS=(--python "${{ matrix.python }}")
VERSIONS=(--python "${{ matrix.python }}" --numpy "${{ matrix.numpy }}")
TEST=(--no-test)
echo "CONDA_BLD=${CONDA}/conda-bld/linux-64" >> "$GITHUB_ENV"

Expand All @@ -76,6 +101,7 @@ jobs:
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
numpy: ['numpy">=2"']
experimental: [false]
runner: [ubuntu-latest]
continue-on-error: ${{ matrix.experimental }}
Expand All @@ -87,22 +113,36 @@ jobs:
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- name: Update conda
run: |
conda update -n base --all
- name: Install conda-index
run: |
conda install -n base conda-index -c conda-forge --override-channels
- name: Show Conda info
run: |
conda info --all
- name: List base environment packages
run: |
conda list -n base
- name: Add conda to system path
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
- name: Install conda-build
run: conda install conda-build
- name: Create conda channel
run: |
mkdir -p "$GITHUB_WORKSPACE/channel/linux-64"
mv "${PACKAGE_NAME}"-*.conda "$GITHUB_WORKSPACE/channel/linux-64"
conda index "$GITHUB_WORKSPACE/channel"
# Test channel
conda search "$PACKAGE_NAME" -c "$GITHUB_WORKSPACE/channel" --override-channels

- name: Test conda channel
run: |
conda search "$PACKAGE_NAME" -c "$GITHUB_WORKSPACE"/channel --override-channels --info --json > "$GITHUB_WORKSPACE"/ver.json
cat "$GITHUB_WORKSPACE"/ver.json
- name: Collect dependencies
run: |
CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c "https://software.repos.intel.com/python/conda" -c "conda-forge" --override-channels)
conda create -n test_mkl_umath "$PACKAGE_NAME" "python=${{ matrix.python }}" "${CHANNELS[@]}" --only-deps --dry-run > lockfile
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
conda create -n "${{ env.TEST_ENV_NAME }}" "${PACKAGE_NAME}=${PACKAGE_VERSION}" "python=${{ matrix.python }}" ${{ matrix.numpy }} "${CHANNELS[@]}" --only-deps --dry-run > lockfile
- name: Display lockfile
run: cat lockfile

Expand All @@ -125,28 +165,39 @@ jobs:
- name: Install mkl_umath
run: |
CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c "https://software.repos.intel.com/python/conda" -c "conda-forge" --override-channels)
conda create -n test_mkl_umath "python=${{ matrix.python }}" "$PACKAGE_NAME" pytest "${CHANNELS[@]}"
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
conda create -n "${{ env.TEST_ENV_NAME }}" "python=${{ matrix.python }}" ${{ matrix.numpy }} "$PACKAGE_NAME=${PACKAGE_VERSION}" pytest "${CHANNELS[@]}"
# Test installed packages
conda list -n test_mkl_umath
conda list -n "${{ env.TEST_ENV_NAME }}"

- name: Smoke test
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate test_mkl_umath
conda activate "${{ env.TEST_ENV_NAME }}"
python -c "import mkl_umath, numpy as np; mkl_umath.patch_numpy_umath(); np.sin(np.linspace(0, 1, num=10**6));"

- name: Run tests
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate test_mkl_umath
pytest -v --pyargs ${{ env.PACKAGE_NAME }}
conda activate "${{ env.TEST_ENV_NAME }}"
pytest -v --pyargs ${{ env.MODULE_NAME }}

build_windows:
runs-on: windows-latest

strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
include:
- python: "3.10"
numpy: "2.2"
- python: "3.11"
numpy: "2.3"
- python: "3.12"
numpy: "2.3"
- python: "3.13"
numpy: "2.3"
- python: "3.14"
numpy: "2.3"
env:
conda-bld: C:\Miniconda\conda-bld\win-64\
steps:
Expand All @@ -160,12 +211,12 @@ jobs:

- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
with:
miniforge-variant: Miniforge3
auto-update-conda: true
miniforge-version: latest
activate-environment: build
channels: conda-forge
conda-remove-defaults: "true"
python-version: ${{ matrix.python }}
conda-build-version: ${{ env.CONDA_BUILD_VERSION }}

- name: Cache conda packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
Expand Down Expand Up @@ -193,7 +244,7 @@ jobs:
- name: Build conda package
run: |
conda activate
conda build --no-test --python ${{ matrix.python }} -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe
conda build --no-test --python ${{ matrix.python }} --numpy ${{ matrix.numpy }} -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe

- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
Expand All @@ -210,6 +261,7 @@ jobs:
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
numpy: ['numpy">=2"']
experimental: [false]
runner: [windows-latest]
continue-on-error: ${{ matrix.experimental }}
Expand All @@ -225,9 +277,9 @@ jobs:

- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
with:
miniforge-variant: Miniforge3
auto-update-conda: true
miniforge-version: latest
activate-environment: mkl_umath_test
activate-environment: ${{ env.TEST_ENV_NAME }}
channels: conda-forge
conda-remove-defaults: "true"
python-version: ${{ matrix.python }}
Expand All @@ -236,6 +288,14 @@ jobs:
run: |
conda install -n base conda-index

- name: Show Conda info
run: |
conda info --all

- name: List base environment packages
run: |
conda list -n base

- name: Create conda channel with the artifact bit
shell: cmd /C CALL {0}
run: |
Expand Down Expand Up @@ -279,7 +339,7 @@ jobs:
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
SET PACKAGE_VERSION=%%F
)
conda install -n mkl_umath_test ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} ${{ matrix.numpy }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile

- name: Display lockfile content
shell: pwsh
Expand Down Expand Up @@ -313,25 +373,25 @@ jobs:
SET "TEST_DEPENDENCIES=pytest pytest-cov"
SET "WORKAROUND_DEPENDENCIES=intel-openmp"
SET "DEPENDENCIES=%TEST_DEPENDENCIES% %WORKAROUND_DEPENDENCIES%"
conda install -n mkl_umath_test ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %DEPENDENCIES% python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %DEPENDENCIES% python=${{ matrix.python }} ${{ matrix.numpy }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}

- name: Report content of test environment
shell: cmd /C CALL {0}
run: |
conda activate
echo "Value of CONDA environment variable was: " %CONDA%
echo "Value of CONDA_PREFIX environment variable was: " %CONDA_PREFIX%
conda info && conda list -n mkl_umath_test
conda info && conda list -n ${{ env.TEST_ENV_NAME }}

- name: Smoke test
shell: cmd /C CALL {0}
run: |
@ECHO ON
conda activate mkl_umath_test
conda activate ${{ env.TEST_ENV_NAME }}
python -c "import mkl_umath, numpy as np; mkl_umath.patch_numpy_umath(); np.sin(np.linspace(0, 1, num=10**6));"

- name: Run tests
shell: cmd /C CALL {0}
run: |
conda activate mkl_umath_test
python -m pytest -v -s --pyargs ${{ env.PACKAGE_NAME }}
conda activate ${{ env.TEST_ENV_NAME }}
python -m pytest -v -s --pyargs ${{ env.MODULE_NAME }}
Loading