-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1139 from swap357/llvmlite_win_whl_builder_gha
Add win-64 wheel builder GHA workflow
- Loading branch information
Showing
2 changed files
with
190 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
name: llvmlite_win-64_wheel_builder | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- .github/workflows/llvmlite_win-64_wheel_builder.yml | ||
workflow_dispatch: | ||
inputs: | ||
llvmdev_run_id: | ||
description: 'llvmdev workflow run ID (optional)' | ||
required: false | ||
type: string | ||
|
||
# Add concurrency control | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
LOCAL_LLVMDEV_ARTIFACT_PATH: D:/a/llvmlite/llvmlite/llvmdev_conda_packages | ||
FALLBACK_LLVMDEV_VERSION: "15" | ||
CONDA_CHANNEL_NUMBA: numba/label/win64_wheel | ||
VALIDATION_PYTHON_VERSION: "3.12" | ||
ARTIFACT_RETENTION_DAYS: 7 | ||
|
||
jobs: | ||
win-64-build: | ||
name: win-64-build | ||
runs-on: windows-2019 | ||
defaults: | ||
run: | ||
shell: bash -el {0} | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12", "3.13"] | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Miniconda | ||
uses: conda-incubator/setup-miniconda@v3 | ||
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@v4 | ||
with: | ||
name: llvmdev_win-64 | ||
path: llvmdev_conda_packages | ||
run-id: ${{ inputs.llvmdev_run_id }} | ||
repository: ${{ github.repository }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install build dependencies | ||
run: | | ||
set -x | ||
if [ "${{ inputs.llvmdev_run_id }}" != "" ]; then | ||
CHAN="file:///${{ env.LOCAL_LLVMDEV_ARTIFACT_PATH }}" | ||
else | ||
CHAN="${{ env.CONDA_CHANNEL_NUMBA }}" | ||
fi | ||
conda install -c "$CHAN" llvmdev=${{ env.FALLBACK_LLVMDEV_VERSION }} cmake libxml2 python-build | ||
- name: Build wheel | ||
run: python -m build | ||
|
||
- name: Upload llvmlite wheel | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: llvmlite-win-64-py${{ matrix.python-version }} | ||
path: dist/*.whl | ||
compression-level: 0 | ||
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} | ||
if-no-files-found: error | ||
|
||
win-64-validate: | ||
name: win-64-validate | ||
needs: win-64-build | ||
runs-on: windows-2019 | ||
defaults: | ||
run: | ||
shell: bash -el {0} | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12", "3.13"] | ||
fail-fast: false | ||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Miniconda | ||
uses: conda-incubator/setup-miniconda@v3 | ||
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 py-lief wheel twine keyring rfc3986 | ||
|
||
- name: Download llvmlite wheels | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: llvmlite-win-64-py${{ matrix.python-version }} | ||
path: dist | ||
|
||
- name: Validate wheels | ||
run: | | ||
cd dist | ||
for WHL_FILE in *.whl; do | ||
wheel unpack "$WHL_FILE" | ||
python "$GITHUB_WORKSPACE"/buildscripts/github/validate_win64_wheel.py llvmlite/binding/llvmlite.dll | ||
twine check "$WHL_FILE" | ||
done | ||
win-64-test: | ||
name: win-64-test | ||
needs: win-64-validate | ||
runs-on: windows-2019 | ||
defaults: | ||
run: | ||
shell: bash -el {0} | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12", "3.13"] | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Download llvmlite wheel | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: llvmlite-win-64-py${{ matrix.python-version }} | ||
path: dist | ||
|
||
- name: Install and test | ||
run: | | ||
pip install dist/*.whl | ||
python -m llvmlite.tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import lief | ||
import pathlib | ||
|
||
for path in pathlib.Path(".").rglob("**/*.dll"): | ||
print("path", path) | ||
dll = lief.PE.parse(str(path)) | ||
|
||
if hasattr(dll, "delay_imports"): | ||
delay_imports = {x.name for x in dll.delay_imports} | ||
print("Delay imports:", delay_imports) | ||
expected_delay_imports = {"SHELL32.dll", "ole32.dll"} | ||
assert ( | ||
delay_imports == expected_delay_imports | ||
), f"Unexpected delay imports: {delay_imports}" | ||
|
||
imports = {x.name for x in dll.imports} | ||
print("Regular imports:", imports) | ||
expected_imports = { | ||
"ADVAPI32.dll", | ||
"KERNEL32.dll", | ||
"MSVCP140.dll", | ||
"VCRUNTIME140.dll", | ||
"VCRUNTIME140_1.dll", | ||
"api-ms-win-crt-convert-l1-1-0.dll", | ||
"api-ms-win-crt-environment-l1-1-0.dll", | ||
"api-ms-win-crt-heap-l1-1-0.dll", | ||
"api-ms-win-crt-locale-l1-1-0.dll", | ||
"api-ms-win-crt-math-l1-1-0.dll", | ||
"api-ms-win-crt-runtime-l1-1-0.dll", | ||
"api-ms-win-crt-stdio-l1-1-0.dll", | ||
"api-ms-win-crt-string-l1-1-0.dll", | ||
"api-ms-win-crt-time-l1-1-0.dll", | ||
"api-ms-win-crt-utility-l1-1-0.dll", | ||
} | ||
assert imports == expected_imports, ( | ||
f"Unexpected imports: {imports - expected_imports}\n" | ||
f"Missing imports: {expected_imports - imports}" | ||
) |