Skip to content

Commit 0b15a08

Browse files
committed
Merge branches 'gha/add_llvmlite_osx-64_wheel_builder' and 'add_llvmlite_osx-64_conda_builder'
* gha/add_llvmlite_osx-64_wheel_builder: add echo command to display workflow run ID update wheel selection method on wheel builder workflow to use stat address pre-commit check issues apply bash flags -elx suggestions from code review remove debugging checks select xcode 14.1 and set macos deployment target 13.0 add debugging for osx library checks on runner add debug output for target directory and dist contents add llvmlite osx-64 wheel build and test workflow * add_llvmlite_osx-64_conda_builder: (22 commits) add step to display Workflow Run ID in llvmlite osx-64 conda builder workflow add concurrency control to llvmlite osx-64 conda builder workflow remove chmod command from llvmlite osx-64 conda builder workflow add llvmlite osx-64 conda builder workflow, update conda build config on recipe to point downloaded recipe update setup_platform.sh to use errexit flag, set -ex update buildscripts/github/setup_platform.sh remove unnecessary chmod command remove redundant vars from conda build config files remove platform-specific setup placeholders from setup script add osx-64 wheel builder to defaults to be run on PR cleanup build configs for llvmdev conda and wheel builder update sdk setup to extract to /opt and configure build environment add platform specific setup script add macos sdk setup function to llvmdev_evaluate script update MacOSX10.10.sdk checksum to SHA-256 move and update sdk checksum path move sdk checksum file to correct location refactor macos setup in llvmdev build script update and test default build config for llvmdev add macos sdk download and config for conda build ...
3 parents d75c1b8 + 8417ecb + f7a1d58 commit 0b15a08

File tree

9 files changed

+400
-4
lines changed

9 files changed

+400
-4
lines changed

.github/workflows/llvmdev_build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ jobs:
7878
- name: Clone repository
7979
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8080

81+
- name: Setup platform-specific requirements
82+
run: |
83+
source ./buildscripts/github/setup_platform.sh "${{ matrix.platform }}"
84+
8185
- name: Setup Miniconda
8286
uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
8387
with:
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: llvmlite_osx-64_conda_builder
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- .github/workflows/llvmlite_osx-64_conda_builder.yml
7+
workflow_dispatch:
8+
inputs:
9+
llvmdev_run_id:
10+
description: 'llvmdev workflow run ID (optional)'
11+
required: false
12+
type: string
13+
14+
# Add concurrency control
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
osx-64-build:
21+
name: osx-64-build
22+
runs-on: macos-13
23+
defaults:
24+
run:
25+
shell: bash -elx {0}
26+
strategy:
27+
matrix:
28+
python-version: ["3.10", "3.11", "3.12", "3.13"]
29+
fail-fast: false
30+
31+
steps:
32+
- name: Clone repository
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Setup platform-specific requirements
38+
run: |
39+
source ./buildscripts/github/setup_platform.sh "osx-64"
40+
41+
- name: Setup Miniconda
42+
uses: conda-incubator/setup-miniconda@v3
43+
with:
44+
auto-update-conda: true
45+
auto-activate-base: true
46+
activate-environment: ""
47+
48+
- name: Install conda-build
49+
run: conda install conda-build
50+
51+
- name: Download llvmdev Artifact
52+
if: ${{ inputs.llvmdev_run_id != '' }}
53+
uses: actions/download-artifact@v4
54+
with:
55+
name: llvmdev_osx-64
56+
path: llvmdev_conda_packages
57+
run-id: ${{ inputs.llvmdev_run_id }}
58+
repository: ${{ github.repository }}
59+
github-token: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Build llvmlite conda package
62+
run: |
63+
if [ "${{ inputs.llvmdev_run_id }}" != "" ]; then
64+
LLVMDEV_CHANNEL="file://$PWD/llvmdev_conda_packages"
65+
else
66+
LLVMDEV_CHANNEL="numba"
67+
fi
68+
CONDA_CHANNEL_DIR="conda_channel_dir"
69+
mkdir $CONDA_CHANNEL_DIR
70+
conda build --debug -c "$LLVMDEV_CHANNEL" -c defaults --python=${{ matrix.python-version }} conda-recipes/llvmlite --output-folder=$CONDA_CHANNEL_DIR --no-test
71+
72+
- name: Upload llvmlite conda package
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: llvmlite-osx-64-py${{ matrix.python-version }}
76+
path: conda_channel_dir
77+
compression-level: 0
78+
retention-days: 7
79+
if-no-files-found: error
80+
81+
- name: Show Workflow Run ID
82+
run: "echo \"Workflow Run ID: ${{ github.run_id }}\""
83+
84+
osx-64-test:
85+
name: osx-64-test
86+
needs: osx-64-build
87+
runs-on: macos-13
88+
defaults:
89+
run:
90+
shell: bash -elx {0}
91+
strategy:
92+
matrix:
93+
python-version: ["3.10", "3.11", "3.12", "3.13"]
94+
fail-fast: false
95+
96+
steps:
97+
- name: Setup miniconda
98+
uses: conda-incubator/setup-miniconda@v3
99+
100+
- name: Download llvmlite artifact
101+
uses: actions/download-artifact@v4
102+
with:
103+
name: llvmlite-osx-64-py${{ matrix.python-version }}
104+
105+
- name: Install conda-build and llvmlite
106+
run: |
107+
conda install conda-build
108+
109+
- name: Run tests
110+
run: conda build --test osx-64/llvmlite*.conda
Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
name: llvmlite_osx-64_wheel_builder
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- .github/workflows/llvmlite_osx-64_wheel_builder.yml
7+
workflow_dispatch:
8+
inputs:
9+
llvmdev_run_id:
10+
description: 'llvmdev workflow run ID (optional)'
11+
required: false
12+
type: string
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
16+
cancel-in-progress: true
17+
18+
env:
19+
LOCAL_LLVMDEV_ARTIFACT_PATH: ${{ github.workspace }}/llvmdev_conda_packages
20+
FALLBACK_LLVMDEV_VERSION: "15"
21+
CONDA_CHANNEL_NUMBA: numba/label/osx_wheel
22+
VALIDATION_PYTHON_VERSION: "3.12"
23+
ARTIFACT_RETENTION_DAYS: 7
24+
25+
jobs:
26+
osx-64-build:
27+
name: osx-64-build
28+
runs-on: macos-13
29+
defaults:
30+
run:
31+
shell: bash -elx {0}
32+
strategy:
33+
matrix:
34+
python-version: ["3.10", "3.11", "3.12", "3.13"]
35+
fail-fast: false
36+
37+
steps:
38+
- name: Clone repository
39+
uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
43+
- name: Setup Miniconda
44+
uses: conda-incubator/setup-miniconda@v3
45+
with:
46+
python-version: ${{ matrix.python-version }}
47+
conda-remove-defaults: true
48+
auto-update-conda: true
49+
auto-activate-base: true
50+
51+
- name: Download llvmdev Artifact
52+
if: ${{ inputs.llvmdev_run_id != '' }}
53+
uses: actions/download-artifact@v4
54+
with:
55+
name: llvmdev_osx-64
56+
path: llvmdev_conda_packages
57+
run-id: ${{ inputs.llvmdev_run_id }}
58+
repository: ${{ github.repository }}
59+
github-token: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Install build dependencies
62+
run: |
63+
set -x
64+
if [ "${{ inputs.llvmdev_run_id }}" != "" ]; then
65+
CHAN="file:///${{ env.LOCAL_LLVMDEV_ARTIFACT_PATH }}"
66+
else
67+
CHAN="${{ env.CONDA_CHANNEL_NUMBA }}"
68+
fi
69+
conda install -c "$CHAN" llvmdev=${{ env.FALLBACK_LLVMDEV_VERSION }} cmake libxml2 python-build
70+
71+
- name: Select Xcode 14.1
72+
run: sudo xcode-select -s /Applications/Xcode_14.1.0.app
73+
74+
- name: Build wheel
75+
env:
76+
MACOSX_DEPLOYMENT_TARGET: "13.0"
77+
run: python -m build
78+
79+
- name: Fix macOS wheel library paths
80+
run: |
81+
set -ex # Exit on error, print commands
82+
cd dist
83+
whl=$(stat -f "%m %N" ./*.whl | sort -n | tail -n 1 | cut -d' ' -f2-)
84+
echo "Processing wheel: $whl"
85+
86+
# Unpack the wheel
87+
wheel unpack "$whl"
88+
89+
# Get into the unpacked directory
90+
target_dir=$(echo "$whl" | cut -d "-" -f1 -f2)
91+
cd "$target_dir"
92+
93+
# Find the dylib
94+
target=$(find . -iname "libllvmlite.dylib")
95+
echo "Found dylib at: $target"
96+
97+
echo "=== BEFORE ==="
98+
otool -L "$target"
99+
100+
# Fix all @rpath libraries
101+
install_name_tool -change "@rpath/libz.1.dylib" "/usr/lib/libz.1.dylib" "$target"
102+
install_name_tool -change "@rpath/libc++.1.dylib" "/usr/lib/libc++.1.dylib" "$target"
103+
install_name_tool -change "@rpath/libunwind.1.dylib" "/usr/lib/libunwind.1.dylib" "$target"
104+
105+
echo "=== AFTER ==="
106+
otool -L "$target"
107+
108+
echo "=== $target_dir contents ==="
109+
find . -ls
110+
echo "=== Write back to wheel ==="
111+
cd ..
112+
wheel pack "$target_dir"
113+
114+
echo "=== Final wheel filename ==="
115+
ls -la ./*.whl # List wheel in dist dir
116+
117+
- name: Upload wheel
118+
uses: actions/upload-artifact@v4
119+
with:
120+
name: llvmlite-osx-64-py${{ matrix.python-version }}
121+
path: dist/*.whl
122+
compression-level: 0
123+
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
124+
if-no-files-found: error
125+
126+
- name: Show Workflow Run ID
127+
run: "echo \"Workflow Run ID: ${{ github.run_id }}\""
128+
129+
osx-64-validate:
130+
name: osx-64-validate
131+
needs: osx-64-build
132+
runs-on: macos-13
133+
defaults:
134+
run:
135+
shell: bash -elx {0}
136+
strategy:
137+
matrix:
138+
python-version: ["3.10", "3.11", "3.12", "3.13"]
139+
fail-fast: false
140+
steps:
141+
- name: Clone repository
142+
uses: actions/checkout@v4
143+
144+
- name: Setup Miniconda
145+
uses: conda-incubator/setup-miniconda@v3
146+
with:
147+
python-version: ${{ env.VALIDATION_PYTHON_VERSION }}
148+
conda-remove-defaults: true
149+
auto-update-conda: true
150+
auto-activate-base: true
151+
152+
- name: Install validation dependencies
153+
run: conda install -c defaults wheel twine keyring rfc3986
154+
155+
- name: Download llvmlite wheels
156+
uses: actions/download-artifact@v4
157+
with:
158+
name: llvmlite-osx-64-py${{ matrix.python-version }}
159+
path: dist
160+
161+
- name: Validate wheels
162+
run: |
163+
set -e # Exit on any error
164+
cd dist
165+
166+
for WHL_FILE in *.whl; do
167+
echo "=== Validating $WHL_FILE ==="
168+
169+
# Check wheel structure
170+
twine check "$WHL_FILE"
171+
172+
# Check dylib paths
173+
wheel unpack "$WHL_FILE"
174+
WHEEL_DIR=$(echo "$WHL_FILE" | cut -d "-" -f1 -f2)
175+
DYLIB=$(find "$WHEEL_DIR" -iname "libllvmlite.dylib")
176+
177+
if [ -z "$DYLIB" ]; then
178+
echo "Error: libllvmlite.dylib not found in $WHL_FILE"
179+
exit 1
180+
fi
181+
182+
echo "=== Checking dynamic library dependencies ==="
183+
otool -L "$DYLIB"
184+
185+
# Verify library paths
186+
LIBS=("libz.1.dylib" "libc++.1.dylib")
187+
for LIB in "${LIBS[@]}"; do
188+
if ! otool -L "$DYLIB" | grep -q "/usr/lib/$LIB"; then
189+
echo "Error: $LIB path is incorrect in $WHL_FILE"
190+
exit 1
191+
fi
192+
done
193+
done
194+
195+
osx-64-test:
196+
name: osx-64-test
197+
needs: osx-64-build
198+
runs-on: macos-13
199+
defaults:
200+
run:
201+
shell: bash -elx {0}
202+
strategy:
203+
matrix:
204+
python-version: ["3.10", "3.11", "3.12", "3.13"]
205+
fail-fast: false
206+
207+
steps:
208+
- name: Setup Python
209+
uses: actions/setup-python@v5
210+
with:
211+
python-version: ${{ matrix.python-version }}
212+
213+
- name: Download llvmlite wheel
214+
uses: actions/download-artifact@v4
215+
with:
216+
name: llvmlite-osx-64-py${{ matrix.python-version }}
217+
path: dist
218+
219+
- name: Install and test
220+
run: |
221+
# Get the Python executable path
222+
PYTHON_PATH=$(which python${{ matrix.python-version }})
223+
224+
# Upgrade pip and install wheel
225+
$PYTHON_PATH -m pip install --upgrade pip wheel
226+
227+
# Install wheel and run tests
228+
cd dist
229+
whl=$(stat -f "%m %N" ./*.whl | sort -n | tail -n 1 | cut -d' ' -f2-)
230+
echo "Using wheel: $whl"
231+
$PYTHON_PATH -m pip install -v "$whl"
232+
233+
# Run tests
234+
$PYTHON_PATH -m llvmlite.tests
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3839b875df1f2bc98893b8502da456cc0b022c4666bc6b7eb5764a5f915a9b00 MacOSX10.10.sdk.tar.xz

buildscripts/github/llvmdev_evaluate.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@
3333
"platform": "win-64",
3434
"recipe": "llvmdev_for_wheel",
3535
},
36+
{
37+
"runner": runner_mapping["osx-64"],
38+
"platform": "osx-64",
39+
"recipe": "llvmdev",
40+
},
41+
{
42+
"runner": runner_mapping["osx-64"],
43+
"platform": "osx-64",
44+
"recipe": "llvmdev_for_wheel",
45+
},
3646
]
3747

3848
print(

0 commit comments

Comments
 (0)