Skip to content

Commit 2a08c7b

Browse files
committed
merge osx conda workflow with other platforms
1 parent 060ddd5 commit 2a08c7b

2 files changed

Lines changed: 150 additions & 167 deletions

File tree

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

Lines changed: 0 additions & 167 deletions
This file was deleted.

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

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,153 @@ jobs:
301301
run: |
302302
conda activate ${{ env.TEST_ENV_NAME }}
303303
pytest -v --pyargs ${{ env.MODULE_NAME }}
304+
305+
build_osx:
306+
runs-on: macos-26-intel
307+
308+
strategy:
309+
matrix:
310+
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
311+
312+
steps:
313+
- name: Cancel Previous Runs
314+
uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1
315+
with:
316+
access_token: ${{ github.token }}
317+
318+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
319+
with:
320+
fetch-depth: 0
321+
322+
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
323+
with:
324+
miniforge-version: latest
325+
activate-environment: build
326+
channels: conda-forge
327+
python-version: ${{ matrix.python }}
328+
329+
- name: Cache conda packages
330+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
331+
env:
332+
CACHE_NUMBER: 0 # Increase to reset cache
333+
with:
334+
path: /Users/runner/conda_pkgs_dir
335+
key:
336+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
337+
restore-keys: |
338+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
339+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
340+
341+
- name: Install conda-build
342+
shell: bash -el {0}
343+
run: |
344+
conda install -n base -y conda-build
345+
conda list -n base
346+
347+
- name: Store conda paths as envs
348+
shell: bash -el {0}
349+
run: |
350+
echo "CONDA_BLD=$CONDA/conda-bld/osx-64/" >> "$GITHUB_ENV"
351+
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE/" >> "$GITHUB_ENV"
352+
353+
- name: Build conda package
354+
shell: bash -el {0}
355+
run: |
356+
CHANNELS=(-c conda-forge -c conda-forge/label/python_rc --override-channels)
357+
VERSIONS=(--python "${{ matrix.python }}")
358+
TEST=(--no-test)
359+
360+
conda build \
361+
"${TEST[@]}" \
362+
"${VERSIONS[@]}" \
363+
"${CHANNELS[@]}" \
364+
conda-recipe-cf
365+
366+
- name: Upload artifact
367+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
368+
with:
369+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
370+
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda
371+
372+
- name: Upload wheels artifact
373+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
374+
with:
375+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
376+
path: ${{ env.WHEELS_OUTPUT_FOLDER }}mkl_service-*.whl
377+
378+
test_osx:
379+
needs: build_osx
380+
runs-on: ${{ matrix.runner }}
381+
382+
strategy:
383+
matrix:
384+
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
385+
experimental: [false]
386+
runner: [macos-26-intel]
387+
continue-on-error: ${{ matrix.experimental }}
388+
env:
389+
CHANNELS: -c conda-forge -c conda-forge/label/python_rc --override-channels
390+
391+
steps:
392+
- name: Download artifact
393+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
394+
with:
395+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
396+
397+
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
398+
with:
399+
miniforge-version: latest
400+
channels: conda-forge
401+
activate-environment: base
402+
403+
- name: Install conda-index
404+
shell: bash -el {0}
405+
run: conda install -n base -y conda-index
406+
407+
- name: Create conda channel
408+
shell: bash -el {0}
409+
run: |
410+
mkdir -p "$GITHUB_WORKSPACE/channel/osx-64"
411+
conda index "$GITHUB_WORKSPACE/channel" || exit 1
412+
mv "${PACKAGE_NAME}"-*.conda "$GITHUB_WORKSPACE/channel/osx-64" || exit 1
413+
conda index "$GITHUB_WORKSPACE/channel" || exit 1
414+
# Test channel
415+
conda search "$PACKAGE_NAME" -c "$GITHUB_WORKSPACE/channel" --override-channels --info --json > "$GITHUB_WORKSPACE/ver.json"
416+
cat ver.json
417+
418+
- name: Collect dependencies
419+
shell: bash -el {0}
420+
run: |
421+
CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c conda-forge -c conda-forge/label/python_rc --override-channels)
422+
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
423+
export PACKAGE_VERSION
424+
conda create -n "${{ env.TEST_ENV_NAME }}" "$PACKAGE_NAME=$PACKAGE_VERSION" "python=${{ matrix.python }}" "${CHANNELS[@]}" --only-deps --dry-run > lockfile
425+
cat lockfile
426+
427+
- name: Cache conda packages
428+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
429+
env:
430+
CACHE_NUMBER: 0 # Increase to reset cache
431+
with:
432+
path: /Users/runner/conda_pkgs_dir
433+
key:
434+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
435+
restore-keys: |
436+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
437+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
438+
439+
- name: Install mkl-service
440+
shell: bash -el {0}
441+
run: |
442+
CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c conda-forge -c conda-forge/label/python_rc --override-channels)
443+
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
444+
export PACKAGE_VERSION
445+
conda create -n "${{ env.TEST_ENV_NAME }}" "$PACKAGE_NAME=$PACKAGE_VERSION" pytest "python=${{ matrix.python }}" "${CHANNELS[@]}"
446+
# Test installed packages
447+
conda list -n "${{ env.TEST_ENV_NAME }}"
448+
449+
- name: Run tests
450+
shell: bash -el {0}
451+
run: |
452+
conda activate ${{ env.TEST_ENV_NAME }}
453+
pytest -vv --pyargs ${{ env.MODULE_NAME }}

0 commit comments

Comments
 (0)