Skip to content

Commit 48b0d13

Browse files
committed
fix conda-package workflow
1 parent 25da175 commit 48b0d13

1 file changed

Lines changed: 63 additions & 26 deletions

File tree

.github/workflows/conda-package.yml

Lines changed: 63 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ env:
1414
TEST_ENV_NAME: test_mkl_fft
1515
VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); d = j['mkl_fft'][0];"
1616
VER_SCRIPT2: "print('='.join((d[s] for s in ('version', 'build'))))"
17+
USE_NUMPY_BASE: "false"
18+
CONDA_BUILD_VERSION: 26.3.0
1719

1820
jobs:
1921
build_linux:
@@ -50,8 +52,20 @@ jobs:
5052
- name: Add conda to system path
5153
run: echo "$CONDA"/bin >> "$GITHUB_PATH"
5254

55+
- name: Update conda
56+
run: |
57+
conda update -n base --all
58+
5359
- name: Install conda-build
54-
run: conda install conda-build
60+
run: conda install -n base conda-build=${{ env.CONDA_BUILD_VERSION }} -c conda-forge --override-channels
61+
62+
- name: Show Conda info
63+
run: |
64+
conda info --all
65+
66+
- name: List base environment packages
67+
run: |
68+
conda list -n base
5569
5670
- name: Build conda package
5771
run: |
@@ -93,8 +107,21 @@ jobs:
93107
- name: Add conda to system path
94108
run: echo "$CONDA"/bin >> "$GITHUB_PATH"
95109

96-
- name: Install conda-build
97-
run: conda install conda-build
110+
- name: Update conda
111+
run: |
112+
conda update -n base --all
113+
114+
- name: Install conda-index
115+
run: |
116+
conda install -n base conda-index -c conda-forge --override-channels
117+
118+
- name: Show Conda info
119+
run: |
120+
conda info --all
121+
122+
- name: List base environment packages
123+
run: |
124+
conda list -n base
98125
99126
- name: Create conda channel
100127
run: |
@@ -107,18 +134,12 @@ jobs:
107134
conda search "$PACKAGE_NAME" -c "$GITHUB_WORKSPACE"/channel --override-channels --info --json > "$GITHUB_WORKSPACE"/ver.json
108135
cat "$GITHUB_WORKSPACE"/ver.json
109136
110-
- name: Get package version
111-
run: |
112-
PACKAGE_VERSION=$(python -c "${{ env.VER_SCRIPT1 }} ${{ env.VER_SCRIPT2 }}")
113-
export PACKAGE_VERSION
114-
115-
echo PACKAGE_VERSION="${PACKAGE_VERSION}"
116-
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_ENV"
117-
118137
- name: Collect dependencies
119138
run: |
139+
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
140+
export PACKAGE_VERSION
120141
CHANNELS=(-c "$GITHUB_WORKSPACE"/channel ${{ env.CHANNELS }})
121-
conda create -n ${{ env.TEST_ENV_NAME }} "$PACKAGE_NAME" python=${{ matrix.python }} "${CHANNELS[@]}" --only-deps --dry-run > lockfile
142+
conda create -n ${{ env.TEST_ENV_NAME }} "${PACKAGE_NAME}=${PACKAGE_VERSION}" python=${{ matrix.python }} "${CHANNELS[@]}" --only-deps --dry-run > lockfile
122143
123144
- name: Display lockfile
124145
run: cat lockfile
@@ -142,7 +163,9 @@ jobs:
142163
- name: Install mkl_fft
143164
run: |
144165
CHANNELS=(-c "$GITHUB_WORKSPACE"/channel ${{ env.CHANNELS }})
145-
conda create -n ${{ env.TEST_ENV_NAME }} "$PACKAGE_NAME"=${{ env.PACKAGE_VERSION }} python=${{ matrix.python }} pytest "${CHANNELS[@]}"
166+
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
167+
export PACKAGE_VERSION
168+
conda create -n ${{ env.TEST_ENV_NAME }} "${PACKAGE_NAME}=${PACKAGE_VERSION}" python=${{ matrix.python }} pytest "${CHANNELS[@]}"
146169
conda install -n ${{ env.TEST_ENV_NAME }} "scipy>=1.10" "mkl-service" "${CHANNELS[@]}"
147170
# Test installed packages
148171
conda list -n ${{ env.TEST_ENV_NAME }}
@@ -173,15 +196,12 @@ jobs:
173196

174197
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
175198
with:
199+
auto-update-conda: true
176200
miniforge-version: latest
177201
activate-environment: build
178202
channels: conda-forge
179203
python-version: ${{ matrix.python }}
180-
181-
- name: Install conda-build
182-
run: |
183-
conda install -n base -y conda-build
184-
conda list -n base
204+
conda-build-version: ${{ env.CONDA_BUILD_VERSION }}
185205

186206
- name: Cache conda packages
187207
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
@@ -195,15 +215,23 @@ jobs:
195215
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
196216
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
197217
198-
- name: Build conda package
199-
run: |
200-
conda build --no-test --python ${{ matrix.python }} -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe
201-
202218
- name: Store conda paths as envs
203219
shell: bash -l {0}
204220
run: |
205221
echo "CONDA_BLD=$CONDA/conda-bld/win-64/" | tr "\\\\" '/' >> "$GITHUB_ENV"
206222
223+
- name: Show Conda info
224+
run: |
225+
conda info --all
226+
227+
- name: List base environment packages
228+
run: |
229+
conda list -n base
230+
231+
- name: Build conda package
232+
run: |
233+
conda build --no-test --python ${{ matrix.python }} -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe
234+
207235
- name: Upload artifact
208236
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
209237
with:
@@ -235,11 +263,24 @@ jobs:
235263

236264
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
237265
with:
266+
auto-update-conda: true
238267
miniforge-version: latest
239268
channels: conda-forge
240269
activate-environment: ${{ env.TEST_ENV_NAME }}
241270
python-version: ${{ matrix.python }}
242271

272+
- name: Install conda-index
273+
run: |
274+
conda install -n base conda-index
275+
276+
- name: Show Conda info
277+
run: |
278+
conda info --all
279+
280+
- name: List base environment packages
281+
run: |
282+
conda list -n base
283+
243284
- name: Create conda channel with the artifact bit
244285
shell: cmd /C CALL {0}
245286
run: |
@@ -249,10 +290,6 @@ jobs:
249290
move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.workdir }}\channel\win-64
250291
dir ${{ env.workdir }}\channel\win-64
251292
252-
- name: Install conda index
253-
shell: cmd /C CALL {0}
254-
run: conda install -n base conda-index
255-
256293
- name: Index the channel
257294
shell: cmd /C CALL {0}
258295
run: conda index ${{ env.workdir }}\channel

0 commit comments

Comments
 (0)