Skip to content

use explicit channel specification for llvmdev=20 installation #135

use explicit channel specification for llvmdev=20 installation

use explicit channel specification for llvmdev=20 installation #135

name: llvmlite_osx-64_wheel_builder
on:
pull_request:
paths:
- .github/workflows/llvmlite_osx-64_wheel_builder.yml
workflow_dispatch:
inputs:
llvmdev_run_id:
description: 'llvmdev workflow run ID (optional)'
required: false
type: string
upload_wheel_to_anaconda:
description: 'Upload wheel to Anaconda Cloud - numba channel'
required: false
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
FALLBACK_LLVMDEV_VERSION: "20"
CONDA_CHANNEL_NUMBA: numba/label/llvm20-wheel
VALIDATION_PYTHON_VERSION: "3.12"
ARTIFACT_RETENTION_DAYS: 7
jobs:
osx-64-build:
name: osx-64-build
runs-on: macos-13
defaults:
run:
shell: bash -elx {0}
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
fail-fast: false
steps:
- name: Clone repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0
with:
python-version: ${{ matrix.python-version }}
conda-remove-defaults: true
auto-update-conda: true
auto-activate-base: true
- name: Download llvmdev Artifact
if: ${{ inputs.llvmdev_run_id != '' }}
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: llvmdev_for_wheel_osx-64
path: llvmdev_conda_packages
run-id: ${{ inputs.llvmdev_run_id }}
repository: ${{ github.repository }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install build dependencies
run: |
if [ "${{ inputs.llvmdev_run_id }}" != "" ]; then
CHAN="file://${{ github.workspace }}/llvmdev_conda_packages"
conda install -c "$CHAN" llvmdev=${{ env.FALLBACK_LLVMDEV_VERSION }}
else
CHAN="${{ env.CONDA_CHANNEL_NUMBA }}"
conda install "${CHAN}"::llvmdev=${{ env.FALLBACK_LLVMDEV_VERSION }}
fi
conda install -c defaults cmake libxml2 python-build
# Hide libunwind to prevent it from being linked against during build
# On macOS, if libunwind.dylib from the llvmdev conda package gets linked, the resulting wheel
# will have a runtime dependency on @rpath/libunwind.1.dylib.
# This breaks the wheel in clean environments, causing `OSError: Library not loaded: @rpath/libunwind.1.dylib`
# Please refer here for detailed logs: https://gist.github.com/swap357/94d468e192ef9f4b12657cef26bb8779
mkdir -p "$CONDA_PREFIX/lib/hide_unwind"
mv "$CONDA_PREFIX/lib/libunwind"*.dylib "$CONDA_PREFIX/lib/hide_unwind/" 2>/dev/null || true
- name: Select Xcode 14.1
run: sudo xcode-select -s /Applications/Xcode_14.1.0.app
- name: Build wheel
env:
MACOSX_DEPLOYMENT_TARGET: "10.15"
LLVMLITE_PACKAGE_FORMAT: "wheel"
run: python -m build
- name: Fix macOS wheel library paths
run: |
python -m pip install wheel
cd dist
whl=$(stat -f "%m %N" ./*.whl | sort -n | tail -n 1 | cut -d' ' -f2-)
bash "$GITHUB_WORKSPACE/buildscripts/github/patch_osx-64_wheel.sh" "$whl"
- name: Upload wheel
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: llvmlite-osx-64-py${{ matrix.python-version }}
path: dist/*.whl
compression-level: 0
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Show Workflow Run ID
run: "echo \"Workflow Run ID: ${{ github.run_id }}\""
osx-64-validate:
name: osx-64-validate
needs: osx-64-build
runs-on: macos-13
defaults:
run:
shell: bash -elx {0}
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
fail-fast: false
steps:
- name: Clone repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0
with:
python-version: ${{ env.VALIDATION_PYTHON_VERSION }}
conda-remove-defaults: true
auto-update-conda: true
auto-activate-base: true
- name: Install validation dependencies
run: conda install -c defaults wheel twine keyring rfc3986
- name: Download llvmlite wheels
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: llvmlite-osx-64-py${{ matrix.python-version }}
path: dist
- name: Validate wheels
run: |
cd dist
bash "$GITHUB_WORKSPACE/buildscripts/github/validate_osx-64_wheel.sh"
osx-64-test:
name: osx-64-test
needs: osx-64-build
runs-on: macos-13
defaults:
run:
shell: bash -elx {0}
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
fail-fast: false
steps:
- name: Setup Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.python-version }}
- name: Download llvmlite wheel
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: llvmlite-osx-64-py${{ matrix.python-version }}
path: dist
- name: Install and test
env:
LLVMLITE_DIST_TEST: "1"
run: |
# Get the Python executable path
PYTHON_PATH=$(which python${{ matrix.python-version }})
# Upgrade pip and install wheel
$PYTHON_PATH -m pip install --upgrade pip wheel
echo "Installing lief for distribution testing"
$PYTHON_PATH -m pip install -v lief
# Install wheel and run tests
cd dist
whl=$(stat -f "%m %N" ./*.whl | sort -n | tail -n 1 | cut -d' ' -f2-)
echo "Using wheel: $whl"
$PYTHON_PATH -m pip install -v "$whl"
# Run tests
$PYTHON_PATH -m llvmlite.tests
osx-64-upload:
name: osx-64-upload
needs: osx-64-test
if: github.event_name == 'workflow_dispatch' && inputs.upload_wheel_to_anaconda
runs-on: macos-13
defaults:
run:
shell: bash -elx {0}
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
fail-fast: false
steps:
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0
with:
python-version: ${{ env.VALIDATION_PYTHON_VERSION }}
conda-remove-defaults: true
auto-update-conda: true
auto-activate-base: true
- name: Install anaconda-client
run: conda install -c anaconda anaconda-client
- name: Download llvmlite wheel
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: llvmlite-osx-64-py${{ matrix.python-version }}
path: dist
- name: Upload wheel to Anaconda Cloud
env:
ANACONDA_API_TOKEN: ${{ secrets.NUMBA_CHANNEL_WHEEL_UPLOAD }}
run: |
cd dist
whl=$(stat -f "%m %N" ./*.whl | sort -n | tail -n 1 | cut -d' ' -f2-)
echo "Uploading wheel: $whl"
anaconda -t "$ANACONDA_API_TOKEN" upload --force -u numba -l dev "$whl"