name: llvmlite_osx-arm64_wheel_builder on: pull_request: paths: - .github/workflows/llvmlite_osx-arm64_wheel_builder.yml - MANIFEST.in - setup.py - versioneer.py schedule: - cron: '30 6 * * 6' # Saturday 6:30 AM UTC 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-arm64-build: name: osx-arm64-build runs-on: macos-14 defaults: run: shell: bash -elx {0} strategy: matrix: python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"] fail-fast: false steps: - name: Clone repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - name: Setup Miniconda uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0 with: auto-update-conda: true auto-activate-base: true - name: Download llvmdev Artifact if: ${{ inputs.llvmdev_run_id != '' }} uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 with: name: llvmdev_for_wheel_osx-arm64 path: llvmdev_conda_packages run-id: ${{ inputs.llvmdev_run_id }} repository: ${{ github.repository }} github-token: ${{ secrets.GITHUB_TOKEN }} - name: Install build dependencies run: | if [[ "${{ matrix.python-version }}" == *t ]]; then PY_VER=${{ matrix.python-version }} conda install -c conda-forge python-freethreading="${PY_VER%t}" else conda install -c defaults python="${{ matrix.python-version }}" fi if [ "${{ inputs.llvmdev_run_id }}" != "" ]; then CHAN="file://${{ github.workspace }}/llvmdev_conda_packages" conda install -c defaults -c "$CHAN" "llvmdev=${{ env.FALLBACK_LLVMDEV_VERSION }}" else CHAN="${{ env.CONDA_CHANNEL_NUMBA }}" conda install -c defaults "${CHAN}::llvmdev=${{ env.FALLBACK_LLVMDEV_VERSION }}" fi python -m pip install build wheel setuptools # 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: Build wheel env: MACOSX_DEPLOYMENT_TARGET: "11.0" LLVMLITE_PACKAGE_FORMAT: "wheel" LDFLAGS: "-v -Wl,-rpath,/usr/lib" run: | arch -arm64 python -m build --wheel --no-isolation - name: Upload wheel uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: name: llvmlite-osx-arm64-py${{ matrix.python-version }} path: dist/*.whl compression-level: 0 retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} if-no-files-found: error - name: Build sdist [once - py3.10] if: ${{ matrix.python-version == '3.10' }} run: arch -arm64 python -m build --sdist --no-isolation - name: Upload sdist (once with python 3.10) if: ${{ matrix.python-version == '3.10' }} uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: name: llvmlite-sdist path: dist/*.tar.gz 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-arm64-validate: name: osx-arm64-validate needs: osx-arm64-build runs-on: macos-14 defaults: run: shell: bash -elx {0} strategy: matrix: python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"] fail-fast: false steps: - name: Clone repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup Miniconda uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0 with: python-version: ${{ env.VALIDATION_PYTHON_VERSION }} 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@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 with: name: llvmlite-osx-arm64-py${{ matrix.python-version }} path: dist - name: Validate wheels run: | cd dist twine check ./*.whl osx-arm64-test: name: osx-arm64-test needs: osx-arm64-build runs-on: macos-14 defaults: run: shell: bash -elx {0} strategy: matrix: python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"] fail-fast: false steps: - name: Setup Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: ${{ matrix.python-version }} allow-prereleases: true - name: Download llvmlite wheel uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 with: name: llvmlite-osx-arm64-py${{ matrix.python-version }} path: dist - name: Install and test env: LLVMLITE_DIST_TEST: "1" run: | PYTHON_PATH=$(which "python${{ matrix.python-version }}") "$PYTHON_PATH" -m venv .venv && source .venv/bin/activate python -m pip install --upgrade pip wheel echo "Installing lief for distribution testing" # TODO: make unconditional when PyLIEF ships free-threaded wheels if [[ "${{ matrix.python-version }}" != *t ]]; then python -m pip install -v lief fi cd dist && python -m pip install -v ./*.whl DYLIB_PATH=$(find "$(python -c "import llvmlite; print(llvmlite.__path__[0])")" -name "libllvmlite.dylib") echo "Found dylib at: $DYLIB_PATH" && otool -L "$DYLIB_PATH" python -m llvmlite.tests osx-arm64-upload: name: osx-arm64-upload needs: osx-arm64-test if: github.event_name == 'workflow_dispatch' && inputs.upload_wheel_to_anaconda runs-on: macos-14 defaults: run: shell: bash -elx {0} strategy: matrix: python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"] fail-fast: false steps: - name: Setup Miniconda uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0 with: python-version: ${{ env.VALIDATION_PYTHON_VERSION }} 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@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 with: name: llvmlite-osx-arm64-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"