Skip to content

Commit 75ebdf6

Browse files
authored
Merge pull request #1139 from swap357/llvmlite_win_whl_builder_gha
Add win-64 wheel builder GHA workflow
2 parents 92210c4 + 0954403 commit 75ebdf6

File tree

2 files changed

+190
-0
lines changed

2 files changed

+190
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: llvmlite_win-64_wheel_builder
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- .github/workflows/llvmlite_win-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+
# Add concurrency control
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
17+
cancel-in-progress: true
18+
19+
env:
20+
LOCAL_LLVMDEV_ARTIFACT_PATH: D:/a/llvmlite/llvmlite/llvmdev_conda_packages
21+
FALLBACK_LLVMDEV_VERSION: "15"
22+
CONDA_CHANNEL_NUMBA: numba/label/win64_wheel
23+
VALIDATION_PYTHON_VERSION: "3.12"
24+
ARTIFACT_RETENTION_DAYS: 7
25+
26+
jobs:
27+
win-64-build:
28+
name: win-64-build
29+
runs-on: windows-2019
30+
defaults:
31+
run:
32+
shell: bash -el {0}
33+
strategy:
34+
matrix:
35+
python-version: ["3.10", "3.11", "3.12", "3.13"]
36+
fail-fast: false
37+
38+
steps:
39+
- name: Clone repository
40+
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
43+
44+
- name: Setup Miniconda
45+
uses: conda-incubator/setup-miniconda@v3
46+
with:
47+
python-version: ${{ matrix.python-version }}
48+
conda-remove-defaults: true
49+
auto-update-conda: true
50+
auto-activate-base: true
51+
52+
- name: Download llvmdev Artifact
53+
if: ${{ inputs.llvmdev_run_id != '' }}
54+
uses: actions/download-artifact@v4
55+
with:
56+
name: llvmdev_win-64
57+
path: llvmdev_conda_packages
58+
run-id: ${{ inputs.llvmdev_run_id }}
59+
repository: ${{ github.repository }}
60+
github-token: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- name: Install build dependencies
63+
run: |
64+
set -x
65+
if [ "${{ inputs.llvmdev_run_id }}" != "" ]; then
66+
CHAN="file:///${{ env.LOCAL_LLVMDEV_ARTIFACT_PATH }}"
67+
else
68+
CHAN="${{ env.CONDA_CHANNEL_NUMBA }}"
69+
fi
70+
conda install -c "$CHAN" llvmdev=${{ env.FALLBACK_LLVMDEV_VERSION }} cmake libxml2 python-build
71+
72+
- name: Build wheel
73+
run: python -m build
74+
75+
- name: Upload llvmlite wheel
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: llvmlite-win-64-py${{ matrix.python-version }}
79+
path: dist/*.whl
80+
compression-level: 0
81+
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
82+
if-no-files-found: error
83+
84+
win-64-validate:
85+
name: win-64-validate
86+
needs: win-64-build
87+
runs-on: windows-2019
88+
defaults:
89+
run:
90+
shell: bash -el {0}
91+
strategy:
92+
matrix:
93+
python-version: ["3.10", "3.11", "3.12", "3.13"]
94+
fail-fast: false
95+
steps:
96+
- name: Clone repository
97+
uses: actions/checkout@v4
98+
99+
- name: Setup Miniconda
100+
uses: conda-incubator/setup-miniconda@v3
101+
with:
102+
python-version: ${{ env.VALIDATION_PYTHON_VERSION }}
103+
conda-remove-defaults: true
104+
auto-update-conda: true
105+
auto-activate-base: true
106+
107+
- name: Install validation dependencies
108+
run: conda install -c defaults py-lief wheel twine keyring rfc3986
109+
110+
- name: Download llvmlite wheels
111+
uses: actions/download-artifact@v4
112+
with:
113+
name: llvmlite-win-64-py${{ matrix.python-version }}
114+
path: dist
115+
116+
- name: Validate wheels
117+
run: |
118+
cd dist
119+
for WHL_FILE in *.whl; do
120+
wheel unpack "$WHL_FILE"
121+
python "$GITHUB_WORKSPACE"/buildscripts/github/validate_win64_wheel.py llvmlite/binding/llvmlite.dll
122+
twine check "$WHL_FILE"
123+
done
124+
125+
win-64-test:
126+
name: win-64-test
127+
needs: win-64-validate
128+
runs-on: windows-2019
129+
defaults:
130+
run:
131+
shell: bash -el {0}
132+
strategy:
133+
matrix:
134+
python-version: ["3.10", "3.11", "3.12", "3.13"]
135+
fail-fast: false
136+
137+
steps:
138+
- name: Setup Python
139+
uses: actions/setup-python@v5
140+
with:
141+
python-version: ${{ matrix.python-version }}
142+
143+
- name: Download llvmlite wheel
144+
uses: actions/download-artifact@v4
145+
with:
146+
name: llvmlite-win-64-py${{ matrix.python-version }}
147+
path: dist
148+
149+
- name: Install and test
150+
run: |
151+
pip install dist/*.whl
152+
python -m llvmlite.tests
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import lief
2+
import pathlib
3+
4+
for path in pathlib.Path(".").rglob("**/*.dll"):
5+
print("path", path)
6+
dll = lief.PE.parse(str(path))
7+
8+
if hasattr(dll, "delay_imports"):
9+
delay_imports = {x.name for x in dll.delay_imports}
10+
print("Delay imports:", delay_imports)
11+
expected_delay_imports = {"SHELL32.dll", "ole32.dll"}
12+
assert (
13+
delay_imports == expected_delay_imports
14+
), f"Unexpected delay imports: {delay_imports}"
15+
16+
imports = {x.name for x in dll.imports}
17+
print("Regular imports:", imports)
18+
expected_imports = {
19+
"ADVAPI32.dll",
20+
"KERNEL32.dll",
21+
"MSVCP140.dll",
22+
"VCRUNTIME140.dll",
23+
"VCRUNTIME140_1.dll",
24+
"api-ms-win-crt-convert-l1-1-0.dll",
25+
"api-ms-win-crt-environment-l1-1-0.dll",
26+
"api-ms-win-crt-heap-l1-1-0.dll",
27+
"api-ms-win-crt-locale-l1-1-0.dll",
28+
"api-ms-win-crt-math-l1-1-0.dll",
29+
"api-ms-win-crt-runtime-l1-1-0.dll",
30+
"api-ms-win-crt-stdio-l1-1-0.dll",
31+
"api-ms-win-crt-string-l1-1-0.dll",
32+
"api-ms-win-crt-time-l1-1-0.dll",
33+
"api-ms-win-crt-utility-l1-1-0.dll",
34+
}
35+
assert imports == expected_imports, (
36+
f"Unexpected imports: {imports - expected_imports}\n"
37+
f"Missing imports: {expected_imports - imports}"
38+
)

0 commit comments

Comments
 (0)