diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index ee60e61..1c1429b 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -29,7 +29,8 @@ jobs: with: access_token: ${{ github.token }} - - uses: actions/checkout@v4.1.7 + - name: Checkout repo + uses: actions/checkout@v4.2.2 with: fetch-depth: 0 @@ -38,7 +39,7 @@ jobs: echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc - name: Cache conda packages - uses: actions/cache@v4 + uses: actions/cache@v4.2.3 env: CACHE_NUMBER: 0 # Increase to reset cache with: @@ -57,9 +58,10 @@ jobs: - name: Build conda package run: | - CHANNELS="-c conda-forge -c https://software.repos.intel.com/python/conda --override-channels" + CHANNELS="-c https://software.repos.intel.com/python/conda -c conda-forge --override-channels" VERSIONS="--python ${{ matrix.python }}" TEST="--no-test" + echo "CONDA_BLD=${CONDA}/conda-bld/linux-64" >> $GITHUB_ENV conda build \ $TEST \ @@ -71,55 +73,7 @@ jobs: uses: actions/upload-artifact@v4.6.2 with: name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} - path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.conda - - build_windows: - runs-on: windows-2019 - - strategy: - matrix: - python: ['3.9', '3.10', '3.11', '3.12', '3.13'] - env: - conda-bld: C:\Miniconda\conda-bld\win-64\ - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - - uses: actions/checkout@v4.1.7 - with: - fetch-depth: 0 - - uses: conda-incubator/setup-miniconda@v3 - with: - conda-remove-defaults: true - auto-activate-base: true - activate-environment: "" - - - name: Cache conda packages - uses: actions/cache@v4 - env: - CACHE_NUMBER: 3 # 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: Install conda-build - run: conda install conda-build - - - 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: Upload artifact - uses: actions/upload-artifact@v4.6.2 - 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 @@ -132,11 +86,11 @@ jobs: runner: [ubuntu-latest] continue-on-error: ${{ matrix.experimental }} env: - CHANNELS: -c conda-forge -c https://software.repos.intel.com/python/conda --override-channels + CHANNELS: -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels steps: - name: Download artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v4.3.0 with: name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} @@ -149,8 +103,7 @@ jobs: - name: Create conda channel run: | mkdir -p $GITHUB_WORKSPACE/channel/linux-64 - conda index $GITHUB_WORKSPACE/channel || exit 1 - mv ${PACKAGE_NAME}-*.conda $GITHUB_WORKSPACE/channel/linux-64 || exit 1 + mv ${PACKAGE_NAME}-*.conda $GITHUB_WORKSPACE/channel/linux-64 conda index $GITHUB_WORKSPACE/channel || exit 1 # Test channel conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels --info --json > $GITHUB_WORKSPACE/ver.json @@ -162,14 +115,16 @@ jobs: CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}" export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}") conda create -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME=${PACKAGE_VERSION} python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile - cat lockfile + + - name: Display lockfile + run: cat lockfile - name: Set pkgs_dirs run: | echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc - name: Cache conda packages - uses: actions/cache@v4 + uses: actions/cache@v4.2.3 env: CACHE_NUMBER: 0 # Increase to reset cache with: @@ -187,13 +142,65 @@ jobs: export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}") conda create -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME=${PACKAGE_VERSION} pytest python=${{ matrix.python }} $CHANNELS # Test installed packages - conda list + conda list -n ${{ env.TEST_ENV_NAME }} - name: Run tests run: | - . $CONDA/etc/profile.d/conda.sh + source $CONDA/etc/profile.d/conda.sh conda activate ${{ env.TEST_ENV_NAME }} - pytest -vv --pyargs ${{ env.MODULE_NAME }} + pytest -v --pyargs ${{ env.MODULE_NAME }} + + build_windows: + runs-on: windows-2019 + + strategy: + matrix: + python: ['3.9', '3.10', '3.11', '3.12', '3.13'] + env: + conda-bld: C:\Miniconda\conda-bld\win-64\ + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: Checkout repo + uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + + - uses: conda-incubator/setup-miniconda@v3.1.1 + with: + miniforge-version: latest + activate-environment: build + python-version: ${{ matrix.python }} + channels: conda-forge + conda-remove-defaults: 'true' + + - name: Cache conda packages + uses: actions/cache@v4.2.3 + env: + CACHE_NUMBER: 3 # 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: Install conda-build + run: conda install conda-build + + - 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: Upload artifact + uses: actions/upload-artifact@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 @@ -210,10 +217,10 @@ jobs: steps: - name: Download artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v4.3.0 with: name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} - - uses: conda-incubator/setup-miniconda@v3 + - uses: conda-incubator/setup-miniconda@v3.1.1 with: conda-remove-defaults: true auto-activate-base: true @@ -241,10 +248,13 @@ jobs: SET PACKAGE_VERSION=%%F ) conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile - more lockfile + + - name: Display lockfile content + shell: pwsh + run: Get-Content -Path .\lockfile - name: Cache conda packages - uses: actions/cache@v4 + uses: actions/cache@v4.2.3 env: CACHE_NUMBER: 3 # Increase to reset cache with: @@ -268,10 +278,9 @@ jobs: ) SET "WORKAROUND_DEPENDENCIES=intel-openmp" conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %WORKAROUND_DEPENDENCIES% pytest python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} - # Test installed packages - conda list + conda list -n ${{ env.TEST_ENV_NAME }} - name: Run tests run: | conda activate -n ${{ env.TEST_ENV_NAME }} - pytest -v --pyargs ${{ env.MODULE_NAME }} + python -m pytest -v --pyargs ${{ env.MODULE_NAME }}