Skip to content
Open
Show file tree
Hide file tree
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
37 changes: 22 additions & 15 deletions .github/workflows/conda-package-cf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,13 @@ jobs:

- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
conda-remove-defaults: true
channels: conda-forge
miniforge-variant: Miniforge3
miniforge-version: latest
auto-activate: true
activate-environment: base
channels: conda-forge
conda-remove-defaults: true
python-version: ${{ matrix.python }}

- name: Cache conda packages
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
Expand All @@ -123,16 +126,19 @@ jobs:
- name: Install conda-build
run: conda install -n base -y conda-build

- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- name: Store conda paths as envs
shell: bash -el {0}
run: |
echo "CONDA_BLD=${CONDA_PREFIX}\\conda-bld\\win-64\\" >> "$GITHUB_ENV"

- name: Build conda package
run: conda build --no-test --python ${{ matrix.python }} --numpy ${{ matrix.numpy }} -c conda-forge --override-channels conda-recipe-cf

- name: Upload artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.conda
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda

test_linux:
needs: build_linux
Expand Down Expand Up @@ -245,20 +251,22 @@ jobs:

- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
conda-remove-defaults: true
miniforge-version: latest
channels: conda-forge
auto-activate: true
activate-environment: base
conda-remove-defaults: true
activate-environment: ${{ env.TEST_ENV_NAME }}
python-version: ${{ matrix.python }}

- name: Install conda-build
# Needed to be able to run conda index
run: conda install conda-build
- name: Install conda-index
run: |
conda install conda-index

- name: Create conda channel
run: |
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.GITHUB_WORKSPACE }}\channel\win-64
conda index ${{ env.GITHUB_WORKSPACE }}/channel
python -m conda_index ${{ env.GITHUB_WORKSPACE }}/channel

# Test channel
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels --info --json > ${{ env.GITHUB_WORKSPACE }}\ver.json
more ${{ env.GITHUB_WORKSPACE }}\ver.json
Expand All @@ -272,8 +280,7 @@ jobs:
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
SET PACKAGE_VERSION=%%F
)
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
more lockfile
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile

- name: Cache conda packages
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
Expand Down Expand Up @@ -302,5 +309,5 @@ jobs:

- name: Run tests
run: |
conda activate -n ${{ env.TEST_ENV_NAME }}
conda activate ${{ env.TEST_ENV_NAME }}
pytest -v --pyargs ${{ env.MODULE_NAME }}
20 changes: 10 additions & 10 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,20 @@ jobs:
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
miniforge-version: latest
use-mamba: 'true'
conda-remove-defaults: 'true'
activate-environment: 'test'
python-version: '3.13' # no python 3.14 support by conda-index
channels: conda-forge
conda-remove-defaults: true
activate-environment: ${{ env.TEST_ENV_NAME }}
python-version: ${{ matrix.python }}

- name: Install conda-index
run: conda install conda-index
run: |
conda install conda-index

- name: Create conda channel
run: |
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.GITHUB_WORKSPACE }}\channel\win-64
python -m conda_index "${{ env.GITHUB_WORKSPACE }}/channel"
python -m conda_index ${{ env.GITHUB_WORKSPACE }}/channel

# Test channel
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels --info --json > ${{ env.GITHUB_WORKSPACE }}\ver.json
Expand All @@ -274,8 +275,7 @@ jobs:
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
SET PACKAGE_VERSION=%%F
)
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
more lockfile
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile

- name: Cache conda packages
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
Expand All @@ -302,12 +302,12 @@ jobs:
)
SET "WORKAROUND_DEPENDENCIES=intel-openmp"
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %WORKAROUND_DEPENDENCIES% pytest python=${{ matrix.python }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }}
conda activate -n ${{ env.TEST_ENV_NAME }}
conda activate ${{ env.TEST_ENV_NAME }}

# Test installed packages
conda list

- name: Run tests
run: |
conda activate -n "${{ env.TEST_ENV_NAME }}"
conda activate "${{ env.TEST_ENV_NAME }}"
pytest -v --pyargs ${{ env.MODULE_NAME }}
14 changes: 12 additions & 2 deletions conda-recipe-cf/bld.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
@rem Remember to source the compiler

set MKLROOT=%CONDA_PREFIX%
%PYTHON% -m pip install --no-build-isolation --no-deps .
if errorlevel 1 exit 1

rem Build wheel package
if NOT "%WHEELS_OUTPUT_FOLDER%"=="" (
%PYTHON% -m pip wheel --no-build-isolation --no-deps .
if errorlevel 1 exit 1
copy mkl_random*.whl %WHEELS_OUTPUT_FOLDER%
if errorlevel 1 exit 1
) ELSE (
rem Build conda package
%PYTHON% -m pip install --no-build-isolation --no-deps .
if errorlevel 1 exit 1
)
15 changes: 14 additions & 1 deletion conda-recipe-cf/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
#!/bin/bash -x

export CFLAGS="-I$PREFIX/include $CFLAGS"
export LDFLAGS="-Wl,-rpath,\$ORIGIN/../.. -Wl,-rpath,\$ORIGIN/../../.. -L${PREFIX}/lib ${LDFLAGS}"
export MKLROOT=$CONDA_PREFIX
$PYTHON -m pip install --no-build-isolation --no-deps .

read -r GLIBC_MAJOR GLIBC_MINOR <<<"$(conda list '^sysroot_linux-64$' \
| tail -n 1 | awk '{print $2}' | grep -oP '\d+' | head -n 2 | tr '\n' ' ')"

# Build wheel package
if [ -n "${WHEELS_OUTPUT_FOLDER}" ]; then
$PYTHON -m pip wheel --no-build-isolation --no-deps .
${PYTHON} -m wheel tags --remove --platform-tag "manylinux_${GLIBC_MAJOR}_${GLIBC_MINOR}_x86_64" mkl_random*.whl
cp mkl_random*.whl "${WHEELS_OUTPUT_FOLDER}"
else
# Build conda package
$PYTHON -m pip install --no-build-isolation --no-deps .
fi
16 changes: 16 additions & 0 deletions conda-recipe-cf/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
c_compiler: # [linux]
- gcc # [linux]
cxx_compiler: # [linux]
- gxx # [linux]
cxx_compiler_version: # [linux]
- '14' # [linux]
c_stdlib: # [linux]
- sysroot # [linux]
c_stdlib_version: # [linux]
- '2.28' # [linux]
c_stdlib: # [win]
- vs # [win]
cxx_compiler: # [win]
- vs2022 # [win]
c_compiler: # [win]
- vs2022 # [win]
24 changes: 18 additions & 6 deletions conda-recipe-cf/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
{% set version = "1.4.0dev1" %}
{% set buildnumber = 0 %}

package:
name: mkl_random
version: {{ version }}
version: {{ GIT_DESCRIBE_TAG }}

source:
path: ..

build:
number: {{buildnumber}}
number: {{ GIT_DESCRIBE_NUMBER }}
script_env:
- WHEELS_OUTPUT_FOLDER
ignore_run_exports:
- blas

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ stdlib('c') }}
host:
- python
- python-gil # [py>=314]
- setuptools >=77
- mkl-devel
- cython
- numpy
- pip
- wheel >=0.41.3
run:
- python
- numpy
- python-gil [py>=314]
- {{ pin_compatible('numpy', min_pin="x.x", max_pin="x") }}
- {{ pin_compatible('mkl', min_pin="x.x", max_pin="x") }}

test:
Expand All @@ -43,3 +46,12 @@ about:
license: BSD-3-Clause
license_file: LICENSE.txt
summary: NumPy-based implementation of random number generation sampling using Intel (R) Math Kernel Library, mirroring numpy.random, but exposing all choices of sampling algorithms available in MKL.
description: |
<strong>LEGAL NOTICE: Use of this software package is subject to the
software license agreement (as set forth above, in the license section of
the installed Conda package and/or the README file) and all notices,
disclaimers or license terms for third party or open source software
included in or with the software.</strong>
<br/><br/>
EULA: <a href="https://opensource.org/licenses/BSD-3-Clause" target="_blank">BSD-3-Clause</a>
<br/><br/>
Loading