Skip to content

Commit 39a35b2

Browse files
committed
improve conda-forge workflow
1 parent 8d9c97b commit 39a35b2

1 file changed

Lines changed: 47 additions & 13 deletions

File tree

.github/workflows/conda-package-cf.yml

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ env:
1414
TEST_ENV_NAME: test_mkl_umath
1515
VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); d = j['mkl_umath'][0];"
1616
VER_SCRIPT2: "print('='.join((d[s] for s in ('version', 'build'))))"
17+
CONDA_BUILD_VERSION: 26.3.0
1718

1819
jobs:
1920
build_linux:
@@ -60,8 +61,20 @@ jobs:
6061
- name: Add conda to system path
6162
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
6263

64+
- name: Update conda
65+
run: |
66+
conda update -n base --all
67+
6368
- name: Install conda-build
64-
run: conda install conda-build
69+
run: conda install -n base conda-build=${{ env.CONDA_BUILD_VERSION }} -c conda-forge --override-channels
70+
71+
- name: Show Conda info
72+
run: |
73+
conda info --all
74+
75+
- name: List base environment packages
76+
run: |
77+
conda list -n base
6578
6679
- name: Build conda package with NumPy 2.x
6780
run: |
@@ -101,22 +114,36 @@ jobs:
101114
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
102115
with:
103116
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
117+
- name: Update conda
118+
run: |
119+
conda update -n base --all
120+
- name: Install conda-index
121+
run: |
122+
conda install -n base conda-index -c conda-forge --override-channels
123+
- name: Show Conda info
124+
run: |
125+
conda info --all
126+
- name: List base environment packages
127+
run: |
128+
conda list -n base
104129
- name: Add conda to system path
105130
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
106-
- name: Install conda-build
107-
run: conda install conda-build
108131
- name: Create conda channel
109132
run: |
110133
mkdir -p "$GITHUB_WORKSPACE/channel/linux-64"
111134
mv "${PACKAGE_NAME}"-*.conda "$GITHUB_WORKSPACE/channel/linux-64"
112135
conda index "$GITHUB_WORKSPACE/channel"
113136
# Test channel
114137
conda search "$PACKAGE_NAME" -c "$GITHUB_WORKSPACE/channel" --override-channels
115-
138+
- name: Test conda channel
139+
run: |
140+
conda search "$PACKAGE_NAME" -c "$GITHUB_WORKSPACE"/channel --override-channels --info --json > "$GITHUB_WORKSPACE"/ver.json
141+
cat "$GITHUB_WORKSPACE"/ver.json
116142
- name: Collect dependencies
117143
run: |
118-
CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c "conda-forge" --override-channels)
119-
conda create -n "${{ env.TEST_ENV_NAME }}" "$PACKAGE_NAME" "python=${{ matrix.python }}" "${CHANNELS[@]}" --only-deps --dry-run > lockfile
144+
CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c "https://software.repos.intel.com/python/conda" -c "conda-forge" --override-channels)
145+
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
146+
conda create -n "${{ env.TEST_ENV_NAME }}" "${PACKAGE_NAME}=${PACKAGE_VERSION}" "python=${{ matrix.python }}" "${{ matrix.numpy }}" "${CHANNELS[@]}" --only-deps --dry-run > lockfile
120147
- name: Display lockfile
121148
run: cat lockfile
122149

@@ -139,7 +166,8 @@ jobs:
139166
- name: Install mkl_umath
140167
run: |
141168
CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c "conda-forge" --override-channels)
142-
conda create -n "${{ env.TEST_ENV_NAME }}" "python=${{ matrix.python }}" "$PACKAGE_NAME" pytest "${CHANNELS[@]}"
169+
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
170+
conda create -n "${{ env.TEST_ENV_NAME }}" "python=${{ matrix.python }}" "$PACKAGE_NAME=${PACKAGE_VERSION}" "${{ matrix.numpy }}" pytest "${CHANNELS[@]}"
143171
# Test installed packages
144172
conda list -n "${{ env.TEST_ENV_NAME }}"
145173
@@ -187,10 +215,12 @@ jobs:
187215

188216
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
189217
with:
218+
auto-update-conda: true
190219
miniforge-version: latest
191220
activate-environment: build
192221
channels: conda-forge
193222
python-version: ${{ matrix.python }}
223+
conda-build-version: ${{ env.CONDA_BUILD_VERSION }}
194224

195225
- name: Cache conda packages
196226
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
@@ -209,11 +239,6 @@ jobs:
209239
run: |
210240
echo "CONDA_BLD=$CONDA/conda-bld/win-64/" | tr "\\\\" '/' >> "$GITHUB_ENV"
211241
212-
- name: Install conda build
213-
run: |
214-
conda install -n base -y conda-build
215-
conda list -n base
216-
217242
- name: Build conda package
218243
run: |
219244
conda build --no-test --python ${{ matrix.python }} --numpy ${{ matrix.numpy }} -c conda-forge --override-channels conda-recipe-cf
@@ -249,15 +274,24 @@ jobs:
249274

250275
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
251276
with:
277+
auto-update-conda: true
252278
miniforge-version: latest
253-
channels: conda-forge
254279
activate-environment: ${{ env.TEST_ENV_NAME }}
280+
channels: conda-forge
255281
python-version: ${{ matrix.python }}
256282

257283
- name: Install conda-index
258284
run: |
259285
conda install -n base conda-index
260286
287+
- name: Show Conda info
288+
run: |
289+
conda info --all
290+
291+
- name: List base environment packages
292+
run: |
293+
conda list -n base
294+
261295
- name: Create conda channel with the artifact bit
262296
shell: cmd /C CALL {0}
263297
run: |

0 commit comments

Comments
 (0)