Files
JonathanSalwan-Triton/.github/workflows/python.yml
T
2026-05-10 22:01:21 -03:00

170 lines
6.0 KiB
YAML

name: Build Python Package
on: [push, pull_request, workflow_dispatch]
env:
package-version: '1.0.0rc4'
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout Triton repository
uses: actions/checkout@v6
- name: Create Docker image
run: bash ./src/scripts/docker/build-docker-image.sh
- name: Install LLVM
uses: KyleMayes/install-llvm-action@v2
with:
version: "14"
directory: ${{ runner.temp }}/llvm
- name: Build Wheel packages
run: |
docker run \
--rm \
--volume $GITHUB_WORKSPACE:/src \
--volume ${{ env.LLVM_PATH }}:/llvm \
build-triton-linux-x86_64 bash /src/src/scripts/docker/build-wheel-linux.sh
- name: Upload Wheel packages
uses: actions/upload-artifact@v7
with:
name: triton_library-${{ env.package-version }}-manylinux_2_34_x86_64
path: wheelhouse/manylinux_2_34_x86_64/*.whl
if-no-files-found: warn
build-windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
include:
- python-version: 3.9
pycp: cp39-cp39
pylib: python39.lib
- python-version: 3.10
pycp: cp310-cp310
pylib: python310.lib
- python-version: 3.11
pycp: cp311-cp311
pylib: python311.lib
- python-version: 3.12
pycp: cp312-cp312
pylib: python312.lib
- python-version: 3.13
pycp: cp313-cp313
pylib: python313.lib
- python-version: 3.14
pycp: cp314-cp314
pylib: python314.lib
steps:
- name: Checkout Triton repository
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install Triton dependencies
uses: ./.github/actions/install-triton-deps/windows
with:
python-version: ${{ matrix.python-version }}
- name: Build Triton Python package
run: |
python -m build --wheel --outdir ${{ github.workspace }}\wheelhouse\windows_x86_64_tmp
env:
PYTHON_VERSION: ${{ matrix.python-version }}
PYTHON_INCLUDE_DIRS: ${{ env.pythonLocation }}\include
PYTHON_LIBRARY: ${{ env.pythonLocation }}\libs\${{ matrix.pylib }}
Z3_INCLUDE_DIRS: ${{ env.Z3_INCLUDE_DIRS }}
Z3_LIBRARIES: ${{ env.Z3_LIBRARIES }}
CAPSTONE_INCLUDE_DIRS: ${{ env.CAPSTONE_INCLUDE_DIRS }}
CAPSTONE_LIBRARIES: ${{ env.CAPSTONE_LIBRARIES }}
- name: Repair Wheel packages
run: |
python -m pip install delvewheel
delvewheel repair `
--add-path ${{ env.Z3_BIN_DIR }} `
--add-path ${{ env.CAPSTONE_BIN_DIR }} `
--wheel-dir ${{ github.workspace }}\wheelhouse\windows_x86_64 -v `
${{ github.workspace }}\wheelhouse\windows_x86_64_tmp\triton_library-${{ env.package-version }}-${{ matrix.pycp }}-win_amd64.whl
- name: Upload Wheel packages
uses: actions/upload-artifact@v7
with:
name: triton_library-${{ env.package-version }}-${{ matrix.pycp }}-win_amd64.whl
path: ${{ github.workspace }}\wheelhouse\windows_x86_64\triton_library-${{ env.package-version }}-${{ matrix.pycp }}-win_amd64.whl
if-no-files-found: warn
build-macos:
runs-on: macos-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
include:
- python-version: 3.9
pycp: cp39-cp39
- python-version: 3.10
pycp: cp310-cp310
- python-version: 3.11
pycp: cp311-cp311
- python-version: 3.12
pycp: cp312-cp312
- python-version: 3.13
pycp: cp313-cp313
- python-version: 3.14
pycp: cp314-cp314
steps:
- name: Checkout Triton repository
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install Triton dependencies
uses: ./.github/actions/install-triton-deps/macos
with:
python-version: ${{ matrix.python-version }}
- name: Build wheel package
run: |
python -m build --wheel --outdir wheelhouse/default_arm64
env:
Z3_INTERFACE: ON
Z3_INCLUDE_DIRS: ${{ env.Z3_INCLUDE_DIRS }}
Z3_LIBRARIES: ${{ env.Z3_LIBRARIES }}
BITWUZLA_INTERFACE: ON
BITWUZLA_INCLUDE_DIRS: ${{ env.BITWUZLA_INCLUDE_DIRS }}
BITWUZLA_LIBRARIES: ${{ env.BITWUZLA_LIBRARIES }}
LLVM_INTERFACE: ON
CMAKE_PREFIX_PATH: ${{ env.LLVM_PATH }}
BOOST_INTERFACE: OFF
CAPSTONE_INCLUDE_DIRS: ${{ env.CAPSTONE_INCLUDE_DIRS }}
CAPSTONE_LIBRARIES: ${{ env.CAPSTONE_LIBRARIES }}
MACOSX_DEPLOYMENT_TARGET: "15.0"
- name: Test wheel package
run: |
pip install wheelhouse/default_arm64/triton_library-${{ env.package-version }}-${{ matrix.pycp }}-macosx_15_0_universal2.whl
pip install lief unicorn
python -c "import triton; print('triton imported successfully')"
cd ${{ github.workspace }}/src/testers
python -m unittest discover -b -v unittests
env:
DYLD_LIBRARY_PATH: ${{ env.Z3_LIB_DIR }}:${{ env.BITWUZLA_LIB_DIR }}:${{ env.CAPSTONE_LIB_DIR }}
- name: Upload wheel package
uses: actions/upload-artifact@v7
with:
name: triton_library-${{ env.package-version }}-${{ matrix.pycp }}-macosx_15_0_universal2.whl
path: wheelhouse/default_arm64/triton_library-${{ env.package-version }}-${{ matrix.pycp }}-macosx_15_0_universal2.whl
if-no-files-found: warn