update workflows to pin python-3.12 when installing conda-build #385
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: Conda package | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| permissions: read-all | |
| env: | |
| PACKAGE_NAME: mkl_fft | |
| TEST_ENV_NAME: test_mkl_fft | |
| VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); d = j['mkl_fft'][0];" | |
| VER_SCRIPT2: "print('='.join((d[s] for s in ('version', 'build'))))" | |
| jobs: | |
| build_linux: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python: ['3.9', '3.10', '3.11', '3.12'] | |
| steps: | |
| - name: Cancel Previous Runs | |
| uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1 | |
| with: | |
| access_token: ${{ github.token }} | |
| - name: Checkout repo | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Cache conda packages | |
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
| env: | |
| CACHE_NUMBER: 0 # Increase to reset cache | |
| with: | |
| path: /home/runner/conda_pkgs_dir | |
| key: | |
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}- | |
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- | |
| - name: Set pkgs_dirs | |
| run: | | |
| echo "pkgs_dirs: [/home/runner/conda_pkgs_dir]" >> ~/.condarc | |
| - name: Setup miniconda | |
| uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 | |
| with: | |
| miniforge-version: latest | |
| activate-environment: build | |
| python-version: ${{ matrix.python }} | |
| channels: conda-forge | |
| conda-remove-defaults: 'true' | |
| pkgs-dirs: /home/runner/conda_pkgs_dir | |
| - name: Install conda-build | |
| run: | | |
| conda install conda-build python=3.12 # conda-build does not support python=3.13 | |
| - name: Build conda package | |
| run: | | |
| CHANNELS="-c https://software.repos.intel.com/python/conda -c conda-forge --override-channels" | |
| VERSIONS="--python ${{ matrix.python }}" | |
| TEST="--no-test" | |
| conda build \ | |
| $TEST \ | |
| $VERSIONS \ | |
| $CHANNELS \ | |
| conda-recipe | |
| - name: Store conda paths as envs | |
| run: | | |
| echo "CONDA_BLD=${CONDA}/conda-bld/linux-64" >> $GITHUB_ENV | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} | |
| path: ${{ env.CONDA_BLD }}/${{ env.PACKAGE_NAME }}-*.conda | |
| test_linux: | |
| needs: build_linux | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| matrix: | |
| python: ['3.9', '3.10', '3.11', '3.12'] | |
| experimental: [false] | |
| runner: [ubuntu-latest] | |
| continue-on-error: ${{ matrix.experimental }} | |
| env: | |
| CHANNELS: -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} | |
| - name: Cache conda packages | |
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
| env: | |
| CACHE_NUMBER: 0 # Increase to reset cache | |
| with: | |
| path: /home/runner/conda_pkgs_dir | |
| key: | |
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }} | |
| restore-keys: | | |
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}- | |
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- | |
| - name: Set pkgs_dirs | |
| run: | | |
| echo "pkgs_dirs: [/home/runner/conda_pkgs_dir]" >> ~/.condarc | |
| - name: Setup miniconda | |
| uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 | |
| with: | |
| miniforge-version: latest | |
| activate-environment: ${{ env.TEST_ENV_NAME }} | |
| python-version: ${{ matrix.python }} | |
| channels: conda-forge | |
| conda-remove-defaults: 'true' | |
| pkgs-dirs: /home/runner/conda_pkgs_dir | |
| - name: Install conda-index | |
| run: | | |
| conda install conda-index python=3.12 # conda-index does not support python=3.13 | |
| - name: Create conda channel | |
| run: | | |
| mkdir -p $GITHUB_WORKSPACE/channel/linux-64 | |
| mv ${{ env.PACKAGE_NAME }}-*.conda $GITHUB_WORKSPACE/channel/linux-64 | |
| conda index $GITHUB_WORKSPACE/channel | |
| - name: Test conda channel | |
| run: | | |
| conda search ${{ env.PACKAGE_NAME }} -c $GITHUB_WORKSPACE/channel --override-channels | |
| - name: Collect dependencies | |
| run: | | |
| CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}" | |
| conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }} python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile | |
| - name: Display lockfile content | |
| run: | | |
| cat lockfile | |
| - name: Install mkl_fft | |
| run: | | |
| CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}" | |
| conda create -n ${{ env.TEST_ENV_NAME }} python=${{ matrix.python }} ${{ env.PACKAGE_NAME }} pytest scipy $CHANNELS | |
| - name: List installed packages | |
| run: | | |
| conda list -n ${{ env.TEST_ENV_NAME }} | |
| - name: Run tests | |
| run: | | |
| source $CONDA/etc/profile.d/conda.sh | |
| conda activate ${{ env.TEST_ENV_NAME }} | |
| python -m pytest -v --pyargs ${{ env.PACKAGE_NAME }}.tests | |
| build_windows: | |
| runs-on: windows-2019 | |
| strategy: | |
| matrix: | |
| python: ['3.9', '3.10', '3.11', '3.12'] | |
| steps: | |
| - name: Cancel Previous Runs | |
| uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1 | |
| with: | |
| access_token: ${{ github.token }} | |
| - name: Checkout repo | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Cache conda packages | |
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
| env: | |
| CACHE_NUMBER: 0 # Increase to reset cache | |
| with: | |
| path: /home/runner/conda_pkgs_dir | |
| key: | |
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}- | |
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- | |
| - name: Set pkgs_dirs | |
| run: | | |
| echo "pkgs_dirs: [/home/runner/conda_pkgs_dir]" >> ~/.condarc | |
| - name: Setup miniconda | |
| uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 | |
| with: | |
| miniforge-version: latest | |
| activate-environment: build | |
| python-version: ${{ matrix.python }} | |
| channels: conda-forge | |
| conda-remove-defaults: 'true' | |
| pkgs-dirs: /home/runner/conda_pkgs_dir | |
| - name: Install conda-build | |
| run: | | |
| conda install conda-build python=3.12 # conda-build does not support python=3.13 | |
| - name: Build conda package | |
| run: | | |
| conda build --no-test --python ${{ matrix.python }} -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe | |
| - name: Store conda paths as envs | |
| shell: bash -l {0} | |
| run: | | |
| echo "CONDA_BLD=$CONDA/conda-bld/win-64/" | tr "\\\\" '/' >> $GITHUB_ENV | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} | |
| path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda | |
| test_windows: | |
| needs: build_windows | |
| runs-on: ${{ matrix.runner }} | |
| defaults: | |
| run: | |
| shell: cmd /C CALL {0} | |
| strategy: | |
| matrix: | |
| python: ['3.9', '3.10', '3.11', '3.12'] | |
| experimental: [false] | |
| runner: [windows-2019] | |
| continue-on-error: ${{ matrix.experimental }} | |
| env: | |
| workdir: '${{ github.workspace }}' | |
| CHANNELS: -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} | |
| - name: Cache conda packages | |
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
| env: | |
| CACHE_NUMBER: 0 # Increase to reset cache | |
| with: | |
| path: /home/runner/conda_pkgs_dir | |
| key: | |
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }} | |
| restore-keys: | | |
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}- | |
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- | |
| - name: Set pkgs_dirs | |
| run: | | |
| echo "pkgs_dirs: [/home/runner/conda_pkgs_dir]" >> ~/.condarc | |
| - name: Setup miniconda | |
| uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 | |
| with: | |
| miniforge-version: latest | |
| activate-environment: ${{ env.TEST_ENV_NAME }} | |
| python-version: ${{ matrix.python }} | |
| channels: conda-forge | |
| conda-remove-defaults: 'true' | |
| pkgs-dirs: /home/runner/conda_pkgs_dir | |
| - name: Create conda channel | |
| run: | | |
| echo ${{ env.workdir }} | |
| mkdir ${{ env.workdir }}\channel | |
| mkdir ${{ env.workdir }}\channel\win-64 | |
| move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.workdir }}\channel\win-64 | |
| dir ${{ env.workdir }}\channel\win-64 | |
| - name: Install conda-index | |
| run: | | |
| conda install conda-index python=3.12 # conda-index does not support python=3.13 | |
| - name: Create conda channel | |
| run: | | |
| python -m conda_index ${{ env.workdir }}\channel | |
| - name: Test conda channel | |
| run: | | |
| conda search ${{ env.PACKAGE_NAME }} -c ${{ env.workdir }}\channel --override-channels | |
| - name: Dump mkl_fft version info from created channel into ver.json | |
| run: | | |
| conda search ${{ env.PACKAGE_NAME }} -c ${{ env.workdir }}/channel --override-channels --info --json > ${{ env.workdir }}\ver.json | |
| - name: Output content of produced ver.json | |
| shell: pwsh | |
| run: Get-Content -Path ${{ env.workdir }}\ver.json | |
| - name: Collect dependencies | |
| run: | | |
| @ECHO ON | |
| IF NOT EXIST ver.json ( | |
| copy /Y ${{ env.workdir }}\ver.json . | |
| ) | |
| SET "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%" | |
| FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO ( | |
| SET PACKAGE_VERSION=%%F | |
| ) | |
| conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile | |
| - name: Display lockfile content | |
| shell: pwsh | |
| run: Get-Content -Path .\lockfile | |
| - name: Install mkl_fft | |
| run: | | |
| @ECHO ON | |
| IF NOT EXIST ver.json ( | |
| copy /Y ${{ env.workdir }}\ver.json . | |
| ) | |
| set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%" | |
| FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO ( | |
| SET PACKAGE_VERSION=%%F | |
| ) | |
| SET "TEST_DEPENDENCIES=pytest scipy" | |
| conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %TEST_DEPENDENCIES% python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }} | |
| - name: Report content of test environment | |
| run: | | |
| echo "Value of CONDA environment variable was: " %CONDA% | |
| echo "Value of CONDA_PREFIX environment variable was: " %CONDA_PREFIX% | |
| conda info && conda list -n ${{ env.TEST_ENV_NAME }} | |
| - name: Run tests | |
| run: | | |
| conda activate ${{ env.TEST_ENV_NAME }} | |
| python -m pytest -v -s --pyargs ${{ env.PACKAGE_NAME }}.tests |