Skip to content

Commit 4ec0ad5

Browse files
authored
Merge pull request #130 from IntelPython/fix-conda-package-workflow
Fix conda-package workflow
2 parents aa1ad7f + 625d461 commit 4ec0ad5

1 file changed

Lines changed: 97 additions & 44 deletions

File tree

.github/workflows/conda-package.yml

Lines changed: 97 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,25 @@ env:
1313
TEST_ENV_NAME: test_mkl_random
1414
VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); "
1515
VER_SCRIPT2: "d = j['mkl_random'][0]; print('='.join((d[s] for s in ('version', 'build'))))"
16+
CONDA_BUILD_VERSION: 26.3.0
1617

1718
jobs:
1819
build_linux:
1920
runs-on: ubuntu-latest
2021

2122
strategy:
2223
matrix:
23-
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
24+
include:
25+
- python: "3.10"
26+
numpy: "2.2"
27+
- python: "3.11"
28+
numpy: "2.3"
29+
- python: "3.12"
30+
numpy: "2.3"
31+
- python: "3.13"
32+
numpy: "2.3"
33+
- python: "3.14"
34+
numpy: "2.3"
2435

2536
steps:
2637
- name: Cancel Previous Runs
@@ -51,8 +62,20 @@ jobs:
5162
- name: Add conda to system path
5263
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
5364

65+
- name: Update conda
66+
run: |
67+
conda update -n base --all
68+
5469
- name: Install conda-build
55-
run: conda install conda-build
70+
run: conda install -n base conda-build=${{ env.CONDA_BUILD_VERSION }} -c conda-forge --override-channels
71+
72+
- name: Show Conda info
73+
run: |
74+
conda info --all
75+
76+
- name: List base environment packages
77+
run: |
78+
conda list -n base
5679
5780
- name: Store conda paths as envs
5881
shell: bash -el {0}
@@ -62,7 +85,7 @@ jobs:
6285
- name: Build conda package
6386
run: |
6487
CHANNELS=(-c https://software.repos.intel.com/python/conda -c conda-forge --override-channels)
65-
VERSIONS=(--python "${{ matrix.python }}")
88+
VERSIONS=(--python "${{ matrix.python }}" --numpy "${{ matrix.numpy }}")
6689
TEST=(--no-test)
6790
6891
conda build \
@@ -84,7 +107,17 @@ jobs:
84107
shell: cmd /C CALL {0}
85108
strategy:
86109
matrix:
87-
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
110+
include:
111+
- python: "3.10"
112+
numpy: "2.2"
113+
- python: "3.11"
114+
numpy: "2.3"
115+
- python: "3.12"
116+
numpy: "2.3"
117+
- python: "3.13"
118+
numpy: "2.3"
119+
- python: "3.14"
120+
numpy: "2.3"
88121

89122
steps:
90123
- name: Cancel Previous Runs
@@ -98,10 +131,12 @@ jobs:
98131

99132
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
100133
with:
134+
auto-update-conda: true
101135
miniforge-version: latest
102136
activate-environment: build
103137
channels: conda-forge
104138
python-version: ${{ matrix.python }}
139+
conda-build-version: ${{ env.CONDA_BUILD_VERSION }}
105140

106141
- name: Cache conda packages
107142
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
@@ -120,13 +155,16 @@ jobs:
120155
run: |
121156
echo "CONDA_BLD=$CONDA/conda-bld/win-64/" | tr "\\\\" '/' >> "$GITHUB_ENV"
122157
123-
- name: Install conda build
158+
- name: Show Conda info
159+
run: |
160+
conda info --all
161+
162+
- name: List base environment packages
124163
run: |
125-
conda install -n base -y conda-build
126164
conda list -n base
127165
128166
- name: Build conda package
129-
run: conda build --no-test --python "${{ matrix.python }}" -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe
167+
run: conda build --no-test --python "${{ matrix.python }}" --numpy "${{ matrix.numpy }}" -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe
130168

131169
- name: Upload artifact
132170
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
@@ -136,22 +174,13 @@ jobs:
136174

137175
test_linux:
138176
needs: build_linux
139-
140-
runs-on: ubuntu-latest
177+
runs-on: ubuntu-latest
141178

142179
strategy:
143180
matrix:
144-
include:
145-
- python: "3.10"
146-
numpy: "2.2"
147-
- python: "3.11"
148-
numpy: "2.3"
149-
- python: "3.12"
150-
numpy: "2.3"
151-
- python: "3.13"
152-
numpy: "2.3"
153-
- python: "3.14"
154-
numpy: "2.3"
181+
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
182+
numpy: ['numpy">=2"']
183+
experimental: [false]
155184

156185
env:
157186
CHANNELS: -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels
@@ -165,8 +194,21 @@ jobs:
165194
- name: Add conda to system path
166195
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
167196

168-
- name: Install conda-build
169-
run: conda install conda-build
197+
- name: Update conda
198+
run: |
199+
conda update -n base --all
200+
201+
- name: Install conda-index
202+
run: |
203+
conda install -n base conda-index -c conda-forge --override-channels
204+
205+
- name: Show Conda info
206+
run: |
207+
conda info --all
208+
209+
- name: List base environment packages
210+
run: |
211+
conda list -n base
170212
171213
- name: Create conda channel
172214
run: |
@@ -183,7 +225,7 @@ jobs:
183225
. "$CONDA/etc/profile.d/conda.sh"
184226
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
185227
export PACKAGE_VERSION
186-
conda create -n "${{ env.TEST_ENV_NAME }}" "${PACKAGE_NAME}=${PACKAGE_VERSION}" "python=${{ matrix.python }}" "numpy=${{ matrix.numpy }}" -c "$GITHUB_WORKSPACE/channel" -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels --only-deps --dry-run > lockfile
228+
conda create -n "${{ env.TEST_ENV_NAME }}" "${PACKAGE_NAME}=${PACKAGE_VERSION}" "python=${{ matrix.python }}" ${{ matrix.numpy }} -c "$GITHUB_WORKSPACE/channel" -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels --only-deps --dry-run > lockfile
187229
cat lockfile
188230
189231
- name: Set pkgs_dirs
@@ -207,7 +249,7 @@ jobs:
207249
. "$CONDA/etc/profile.d/conda.sh"
208250
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
209251
export PACKAGE_VERSION
210-
conda create -n "${{ env.TEST_ENV_NAME }}" "${PACKAGE_NAME}=${PACKAGE_VERSION}" pytest "python=${{ matrix.python }}" "numpy=${{ matrix.numpy }}" -c "$GITHUB_WORKSPACE/channel" -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels
252+
conda create -n "${{ env.TEST_ENV_NAME }}" "${PACKAGE_NAME}=${PACKAGE_VERSION}" pytest "python=${{ matrix.python }}" ${{ matrix.numpy }} -c "$GITHUB_WORKSPACE/channel" -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels
211253
conda activate "${{ env.TEST_ENV_NAME }}"
212254
213255
# Test installed packages
@@ -221,22 +263,13 @@ jobs:
221263
222264
test_windows:
223265
needs: build_windows
224-
225-
runs-on: windows-latest
266+
runs-on: windows-latest
226267

227268
strategy:
228269
matrix:
229-
include:
230-
- python: "3.10"
231-
numpy: "2.2"
232-
- python: "3.11"
233-
numpy: "2.3"
234-
- python: "3.12"
235-
numpy: "2.3"
236-
- python: "3.13"
237-
numpy: "2.3"
238-
- python: "3.14"
239-
numpy: "2.3"
270+
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
271+
numpy: ['numpy">=2"']
272+
experimental: [false]
240273

241274
env:
242275
CHANNELS: -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels
@@ -249,35 +282,55 @@ jobs:
249282

250283
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
251284
with:
285+
auto-update-conda: true
252286
miniforge-version: latest
253287
channels: conda-forge
254288
activate-environment: ${{ env.TEST_ENV_NAME }}
255289
python-version: ${{ matrix.python }}
256290

257291
- name: Install conda-index
258292
run: |
259-
conda install conda-index
293+
conda install -n base conda-index
294+
295+
- name: Show Conda info
296+
run: |
297+
conda info --all
298+
299+
- name: List base environment packages
300+
run: |
301+
conda list -n base
260302
261303
- name: Create conda channel
262304
run: |
263305
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
264306
move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.GITHUB_WORKSPACE }}\channel\win-64
265-
python -m conda_index ${{ env.GITHUB_WORKSPACE }}/channel
307+
dir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
266308
267-
# Test channel
309+
- name: Index the channel
310+
shell: cmd /C CALL {0}
311+
run: conda index ${{ env.GITHUB_WORKSPACE }}\channel
312+
313+
- name: Dump mkl_random version info from created channel into ver.json
314+
shell: cmd /C CALL {0}
315+
run: |
268316
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels --info --json > ${{ env.GITHUB_WORKSPACE }}\ver.json
269-
more ${{ env.GITHUB_WORKSPACE }}\ver.json
317+
318+
- name: Output content of produced ver.json
319+
shell: pwsh
320+
run: Get-Content -Path ${{ env.GITHUB_WORKSPACE }}\ver.json
270321

271322
- name: Collect dependencies
272323
shell: cmd
273324
run: |
274325
@ECHO ON
275-
copy /Y ${{ env.GITHUB_WORKSPACE }}\ver.json .
326+
IF NOT EXIST ver.json (
327+
copy /Y ${{ env.workdir }}\ver.json .
328+
)
276329
set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%"
277330
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
278331
SET PACKAGE_VERSION=%%F
279332
)
280-
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
333+
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} ${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
281334
282335
- name: Cache conda packages
283336
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
@@ -303,7 +356,7 @@ jobs:
303356
SET PACKAGE_VERSION=%%F
304357
)
305358
SET "WORKAROUND_DEPENDENCIES=intel-openmp"
306-
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 }}
359+
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %WORKAROUND_DEPENDENCIES% pytest python=${{ matrix.python }} ${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }}
307360
conda activate ${{ env.TEST_ENV_NAME }}
308361
309362
# Test installed packages

0 commit comments

Comments
 (0)