Skip to content

Commit 9a76577

Browse files
committed
fix conda-package workflow
1 parent 20eae70 commit 9a76577

1 file changed

Lines changed: 53 additions & 19 deletions

File tree

.github/workflows/conda-package.yml

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ permissions: read-all
1010

1111
env:
1212
PACKAGE_NAME: mkl_umath
13+
MODULE_NAME: mkl_umath
14+
TEST_ENV_NAME: test_mkl_umath
1315
VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); d = j['mkl_umath'][0];"
1416
VER_SCRIPT2: "print('='.join((d[s] for s in ('version', 'build'))))"
17+
USE_NUMPY_BASE: "false"
18+
CONDA_BUILD_VERSION: 26.3.0
1519

1620
jobs:
1721
build_linux:
@@ -47,8 +51,20 @@ jobs:
4751
- name: Add conda to system path
4852
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
4953

54+
- name: Update conda
55+
run: |
56+
conda update -n base --all
57+
5058
- name: Install conda-build
51-
run: conda install conda-build
59+
run: conda install -n base conda-build=${{ env.CONDA_BUILD_VERSION }} -c conda-forge --override-channels
60+
61+
- name: Show Conda info
62+
run: |
63+
conda info --all
64+
65+
- name: List base environment packages
66+
run: |
67+
conda list -n base
5268
5369
- name: Build conda package
5470
run: |
@@ -87,10 +103,20 @@ jobs:
87103
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
88104
with:
89105
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
106+
- name: Update conda
107+
run: |
108+
conda update -n base --all
109+
- name: Install conda-index
110+
run: |
111+
conda install -n base conda-index -c conda-forge --override-channels
112+
- name: Show Conda info
113+
run: |
114+
conda info --all
115+
- name: List base environment packages
116+
run: |
117+
conda list -n base
90118
- name: Add conda to system path
91119
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
92-
- name: Install conda-build
93-
run: conda install conda-build
94120
- name: Create conda channel
95121
run: |
96122
mkdir -p "$GITHUB_WORKSPACE/channel/linux-64"
@@ -103,7 +129,7 @@ jobs:
103129
run: |
104130
CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c "https://software.repos.intel.com/python/conda" -c "conda-forge" --override-channels)
105131
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
106-
conda create -n test_mkl_umath "${PACKAGE_NAME}=${PACKAGE_VERSION}" "python=${{ matrix.python }}" "${CHANNELS[@]}" --only-deps --dry-run > lockfile
132+
conda create -n "${{ env.TEST_ENV_NAME }}" "${PACKAGE_NAME}=${PACKAGE_VERSION}" "python=${{ matrix.python }}" "${CHANNELS[@]}" --only-deps --dry-run > lockfile
107133
- name: Display lockfile
108134
run: cat lockfile
109135

@@ -127,21 +153,21 @@ jobs:
127153
run: |
128154
CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c "https://software.repos.intel.com/python/conda" -c "conda-forge" --override-channels)
129155
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
130-
conda create -n test_mkl_umath "python=${{ matrix.python }}" "$PACKAGE_NAME=${PACKAGE_VERSION}" pytest "${CHANNELS[@]}"
156+
conda create -n "${{ env.TEST_ENV_NAME }}" "python=${{ matrix.python }}" "$PACKAGE_NAME=${PACKAGE_VERSION}" pytest "${CHANNELS[@]}"
131157
# Test installed packages
132-
conda list -n test_mkl_umath
158+
conda list -n "${{ env.TEST_ENV_NAME }}"
133159
134160
- name: Smoke test
135161
run: |
136162
source "$CONDA/etc/profile.d/conda.sh"
137-
conda activate test_mkl_umath
163+
conda activate "${{ env.TEST_ENV_NAME }}"
138164
python -c "import mkl_umath, numpy as np; mkl_umath.patch_numpy_umath(); np.sin(np.linspace(0, 1, num=10**6));"
139165
140166
- name: Run tests
141167
run: |
142168
source "$CONDA/etc/profile.d/conda.sh"
143-
conda activate test_mkl_umath
144-
pytest -v --pyargs ${{ env.PACKAGE_NAME }}
169+
conda activate "${{ env.TEST_ENV_NAME }}"
170+
pytest -v --pyargs ${{ env.MODULE_NAME }}
145171
146172
build_windows:
147173
runs-on: windows-latest
@@ -162,12 +188,12 @@ jobs:
162188

163189
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
164190
with:
165-
miniforge-variant: Miniforge3
191+
auto-update-conda: true
166192
miniforge-version: latest
167193
activate-environment: build
168194
channels: conda-forge
169-
conda-remove-defaults: "true"
170195
python-version: ${{ matrix.python }}
196+
conda-build-version: ${{ env.CONDA_BUILD_VERSION }}
171197

172198
- name: Cache conda packages
173199
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
@@ -227,9 +253,9 @@ jobs:
227253

228254
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
229255
with:
230-
miniforge-variant: Miniforge3
256+
auto-update-conda: true
231257
miniforge-version: latest
232-
activate-environment: mkl_umath_test
258+
activate-environment: ${{ env.TEST_ENV_NAME }}
233259
channels: conda-forge
234260
conda-remove-defaults: "true"
235261
python-version: ${{ matrix.python }}
@@ -238,6 +264,14 @@ jobs:
238264
run: |
239265
conda install -n base conda-index
240266
267+
- name: Show Conda info
268+
run: |
269+
conda info --all
270+
271+
- name: List base environment packages
272+
run: |
273+
conda list -n base
274+
241275
- name: Create conda channel with the artifact bit
242276
shell: cmd /C CALL {0}
243277
run: |
@@ -281,7 +315,7 @@ jobs:
281315
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
282316
SET PACKAGE_VERSION=%%F
283317
)
284-
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
318+
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
285319
286320
- name: Display lockfile content
287321
shell: pwsh
@@ -315,25 +349,25 @@ jobs:
315349
SET "TEST_DEPENDENCIES=pytest pytest-cov"
316350
SET "WORKAROUND_DEPENDENCIES=intel-openmp"
317351
SET "DEPENDENCIES=%TEST_DEPENDENCIES% %WORKAROUND_DEPENDENCIES%"
318-
conda install -n mkl_umath_test ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %DEPENDENCIES% python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
352+
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %DEPENDENCIES% python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
319353
320354
- name: Report content of test environment
321355
shell: cmd /C CALL {0}
322356
run: |
323357
conda activate
324358
echo "Value of CONDA environment variable was: " %CONDA%
325359
echo "Value of CONDA_PREFIX environment variable was: " %CONDA_PREFIX%
326-
conda info && conda list -n mkl_umath_test
360+
conda info && conda list -n ${{ env.TEST_ENV_NAME }}
327361
328362
- name: Smoke test
329363
shell: cmd /C CALL {0}
330364
run: |
331365
@ECHO ON
332-
conda activate mkl_umath_test
366+
conda activate ${{ env.TEST_ENV_NAME }}
333367
python -c "import mkl_umath, numpy as np; mkl_umath.patch_numpy_umath(); np.sin(np.linspace(0, 1, num=10**6));"
334368
335369
- name: Run tests
336370
shell: cmd /C CALL {0}
337371
run: |
338-
conda activate mkl_umath_test
339-
python -m pytest -v -s --pyargs ${{ env.PACKAGE_NAME }}
372+
conda activate ${{ env.TEST_ENV_NAME }}
373+
python -m pytest -v -s --pyargs ${{ env.MODULE_NAME }}

0 commit comments

Comments
 (0)