diff --git a/.github/workflows/conda-package-cf.yml b/.github/workflows/conda-package-cf.yml index a2f0fb5..c5a20af 100644 --- a/.github/workflows/conda-package-cf.yml +++ b/.github/workflows/conda-package-cf.yml @@ -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 @@ -123,8 +126,11 @@ 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 @@ -132,7 +138,7 @@ jobs: 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 @@ -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 @@ -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 @@ -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 }} diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index cd15370..f747ebe 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -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 @@ -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 @@ -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 }} diff --git a/conda-recipe-cf/bld.bat b/conda-recipe-cf/bld.bat index 5d64fa2..29a732b 100644 --- a/conda-recipe-cf/bld.bat +++ b/conda-recipe-cf/bld.bat @@ -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 +) diff --git a/conda-recipe-cf/build.sh b/conda-recipe-cf/build.sh index 55964cb..f513746 100644 --- a/conda-recipe-cf/build.sh +++ b/conda-recipe-cf/build.sh @@ -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 diff --git a/conda-recipe-cf/conda_build_config.yaml b/conda-recipe-cf/conda_build_config.yaml new file mode 100644 index 0000000..822fd77 --- /dev/null +++ b/conda-recipe-cf/conda_build_config.yaml @@ -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] diff --git a/conda-recipe-cf/meta.yaml b/conda-recipe-cf/meta.yaml index 47c4634..ba58267 100644 --- a/conda-recipe-cf/meta.yaml +++ b/conda-recipe-cf/meta.yaml @@ -1,15 +1,14 @@ -{% 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 @@ -17,16 +16,20 @@ 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: @@ -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: | + 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. +

+ EULA: BSD-3-Clause +