mirror of
https://github.com/JonathanSalwan/Triton
synced 2026-06-21 13:43:30 +00:00
Merge pull request #1447 from cnheitman/feature/improve-ci
Improve CI actions and workflows
This commit is contained in:
@@ -8,7 +8,7 @@ inputs:
|
||||
default: '3.11'
|
||||
llvm-version:
|
||||
description: LLVM version to install
|
||||
default: '17'
|
||||
default: '19'
|
||||
bitwuzla-version:
|
||||
description: Bitwuzla version to install
|
||||
default: '0.9.0'
|
||||
@@ -36,7 +36,7 @@ runs:
|
||||
|
||||
- name: Install Python build dependencies
|
||||
run: |
|
||||
python -m pip install setuptools importlib-resources meson
|
||||
python -m pip install setuptools importlib-resources build meson
|
||||
shell: bash
|
||||
|
||||
- name: Install Bitwuzla dependencies
|
||||
@@ -68,12 +68,11 @@ runs:
|
||||
wget -q https://github.com/bitwuzla/bitwuzla/archive/refs/tags/${{ inputs.bitwuzla-version }}.tar.gz
|
||||
tar -xf ${{ inputs.bitwuzla-version }}.tar.gz
|
||||
cd bitwuzla-${{ inputs.bitwuzla-version }}
|
||||
python ./configure.py --shared
|
||||
python ./configure.py --shared --prefix $(pwd)/install
|
||||
cd build
|
||||
sudo ninja install
|
||||
sudo ldconfig
|
||||
echo "BITWUZLA_INCLUDE_DIRS=/usr/local/include" >> $GITHUB_ENV
|
||||
echo "BITWUZLA_LIBRARIES=/usr/local/lib/x86_64-linux-gnu/libbitwuzla.so" >> $GITHUB_ENV
|
||||
ninja install
|
||||
echo "BITWUZLA_INCLUDE_DIRS=$GITHUB_WORKSPACE/bitwuzla-${{ inputs.bitwuzla-version }}/install/include" >> $GITHUB_ENV
|
||||
echo "BITWUZLA_LIBRARIES=$GITHUB_WORKSPACE/bitwuzla-${{ inputs.bitwuzla-version }}/install/lib/x86_64-linux-gnu/libbitwuzla.so" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Install Capstone
|
||||
@@ -81,8 +80,18 @@ runs:
|
||||
wget -q https://github.com/capstone-engine/capstone/releases/download/5.0.7/capstone-${{ inputs.capstone-version }}.tar.xz
|
||||
tar -xf capstone-${{ inputs.capstone-version }}.tar.xz
|
||||
cd capstone-${{ inputs.capstone-version }}
|
||||
bash ./make.sh
|
||||
sudo make install
|
||||
cmake -B build \
|
||||
-DCAPSTONE_ARCHITECTURE_DEFAULT=OFF \
|
||||
-DCAPSTONE_ARM_SUPPORT=ON \
|
||||
-DCAPSTONE_ARM64_SUPPORT=ON \
|
||||
-DCAPSTONE_X86_SUPPORT=ON \
|
||||
-DCAPSTONE_RISCV_SUPPORT=ON \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build --config Release --parallel
|
||||
cmake --install build --config Release --prefix install
|
||||
echo "CAPSTONE_INCLUDE_DIRS=$GITHUB_WORKSPACE/capstone-${{ inputs.capstone-version }}/install/include" >> $GITHUB_ENV
|
||||
echo "CAPSTONE_LIBRARIES=$GITHUB_WORKSPACE/capstone-${{ inputs.capstone-version }}/install/lib/libcapstone.so" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Install Unicorn and LIEF
|
||||
|
||||
@@ -8,7 +8,7 @@ inputs:
|
||||
default: '3.11'
|
||||
llvm-version:
|
||||
description: LLVM version to install
|
||||
default: '17'
|
||||
default: '19'
|
||||
bitwuzla-version:
|
||||
description: Bitwuzla version to install
|
||||
default: '0.9.0'
|
||||
@@ -51,7 +51,8 @@ runs:
|
||||
wget -q https://github.com/Z3Prover/z3/releases/download/z3-4.16.0/z3-4.16.0-arm64-osx-15.7.3.zip
|
||||
unzip -q z3-4.16.0-arm64-osx-15.7.3.zip
|
||||
echo "Z3_INCLUDE_DIRS=$GITHUB_WORKSPACE/z3-4.16.0-arm64-osx-15.7.3/include" >> $GITHUB_ENV
|
||||
echo "Z3_LIBRARIES=$GITHUB_WORKSPACE/z3-4.16.0-arm64-osx-15.7.3/bin/libz3.a" >> $GITHUB_ENV
|
||||
echo "Z3_LIBRARIES=$GITHUB_WORKSPACE/z3-4.16.0-arm64-osx-15.7.3/bin/libz3.dylib" >> $GITHUB_ENV
|
||||
echo "Z3_LIB_DIR=$GITHUB_WORKSPACE/z3-4.16.0-arm64-osx-15.7.3/bin" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Install Bitwuzla
|
||||
@@ -66,7 +67,7 @@ runs:
|
||||
cd ..
|
||||
echo "BITWUZLA_INCLUDE_DIRS=$GITHUB_WORKSPACE/bitwuzla-${{ inputs.bitwuzla-version }}/install/include" >> $GITHUB_ENV
|
||||
echo "BITWUZLA_LIBRARIES=$GITHUB_WORKSPACE/bitwuzla-${{ inputs.bitwuzla-version }}/install/lib/libbitwuzla.dylib" >> $GITHUB_ENV
|
||||
echo "DYLD_LIBRARY_PATH=$GITHUB_WORKSPACE/bitwuzla-${{ inputs.bitwuzla-version }}/install/lib:/opt/homebrew/lib:/usr/local/lib" >> $GITHUB_ENV
|
||||
echo "BITWUZLA_LIB_DIR=$GITHUB_WORKSPACE/bitwuzla-${{ inputs.bitwuzla-version }}/install/lib" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Install Capstone
|
||||
@@ -74,8 +75,19 @@ runs:
|
||||
wget -q https://github.com/capstone-engine/capstone/releases/download/5.0.7/capstone-${{ inputs.capstone-version }}.tar.xz
|
||||
tar -xf capstone-${{ inputs.capstone-version }}.tar.xz
|
||||
cd capstone-${{ inputs.capstone-version }}
|
||||
bash ./make.sh
|
||||
sudo make install
|
||||
cmake -B build \
|
||||
-DCAPSTONE_ARCHITECTURE_DEFAULT=OFF \
|
||||
-DCAPSTONE_ARM_SUPPORT=ON \
|
||||
-DCAPSTONE_ARM64_SUPPORT=ON \
|
||||
-DCAPSTONE_X86_SUPPORT=ON \
|
||||
-DCAPSTONE_RISCV_SUPPORT=ON \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build --config Release --parallel
|
||||
cmake --install build --config Release --prefix install
|
||||
echo "CAPSTONE_INCLUDE_DIRS=$GITHUB_WORKSPACE/capstone-${{ inputs.capstone-version }}/install/include" >> $GITHUB_ENV
|
||||
echo "CAPSTONE_LIBRARIES=$GITHUB_WORKSPACE/capstone-${{ inputs.capstone-version }}/install/lib/libcapstone.dylib" >> $GITHUB_ENV
|
||||
echo "CAPSTONE_LIB_DIR=$GITHUB_WORKSPACE/capstone-${{ inputs.capstone-version }}/install/lib" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Install Unicorn and LIEF
|
||||
|
||||
@@ -8,7 +8,7 @@ inputs:
|
||||
default: '3.11'
|
||||
llvm-version:
|
||||
description: LLVM version to install
|
||||
default: '17'
|
||||
default: '19'
|
||||
capstone-version:
|
||||
description: Capstone version to install
|
||||
default: '5.0.7'
|
||||
@@ -48,7 +48,7 @@ runs:
|
||||
- name: Install z3
|
||||
run: |
|
||||
Invoke-WebRequest -Uri "https://github.com/Z3Prover/z3/releases/download/z3-4.16.0/z3-4.16.0-x64-win.zip" -OutFile "z3-4.16.0-x64-win.zip"
|
||||
tar -xf z3-4.16.0-x64-win.zip
|
||||
unzip -q z3-4.16.0-x64-win.zip
|
||||
echo "Z3_INCLUDE_DIRS=$env:GITHUB_WORKSPACE\z3-4.16.0-x64-win\include" >> $env:GITHUB_ENV
|
||||
echo "Z3_LIBRARIES=$env:GITHUB_WORKSPACE\z3-4.16.0-x64-win\bin\libz3.lib" >> $env:GITHUB_ENV
|
||||
echo "Z3_BIN_DIR=$env:GITHUB_WORKSPACE\z3-4.16.0-x64-win\bin" >> $env:GITHUB_ENV
|
||||
@@ -56,19 +56,22 @@ runs:
|
||||
|
||||
- name: Install Capstone
|
||||
run: |
|
||||
Invoke-WebRequest -Uri "https://github.com/capstone-engine/capstone/archive/refs/tags/${{ inputs.capstone-version }}.zip" -OutFile "capstone-${{ inputs.capstone-version }}.zip"
|
||||
tar -xf capstone-${{ inputs.capstone-version }}.zip
|
||||
mkdir capstone-${{ inputs.capstone-version }}\build
|
||||
cd capstone-${{ inputs.capstone-version }}\build
|
||||
cmake `
|
||||
-DCAPSTONE_INSTALL=On `
|
||||
-DBUILD_SHARED_LIBS=On `
|
||||
..
|
||||
cmake --build . --config Release --parallel 3
|
||||
cmake --install . --config Release
|
||||
echo "CAPSTONE_INCLUDE_DIRS=$env:GITHUB_WORKSPACE\capstone-${{ inputs.capstone-version }}\include" >> $env:GITHUB_ENV
|
||||
echo "CAPSTONE_LIBRARIES=$env:GITHUB_WORKSPACE\capstone-${{ inputs.capstone-version }}\build\Release\capstone.lib" >> $env:GITHUB_ENV
|
||||
echo "CAPSTONE_BIN_DIR=$env:GITHUB_WORKSPACE\capstone-${{ inputs.capstone-version }}\build\Release" >> $env:GITHUB_ENV
|
||||
Invoke-WebRequest -Uri "https://github.com/capstone-engine/capstone/releases/download/5.0.7/capstone-${{ inputs.capstone-version }}.tar.xz" -OutFile "capstone-${{ inputs.capstone-version }}.tar.xz"
|
||||
tar -xf capstone-${{ inputs.capstone-version }}.tar.xz
|
||||
cd capstone-${{ inputs.capstone-version }}
|
||||
cmake -B build `
|
||||
-DCAPSTONE_ARCHITECTURE_DEFAULT=OFF `
|
||||
-DCAPSTONE_ARM_SUPPORT=ON `
|
||||
-DCAPSTONE_ARM64_SUPPORT=ON `
|
||||
-DCAPSTONE_X86_SUPPORT=ON `
|
||||
-DCAPSTONE_RISCV_SUPPORT=ON `
|
||||
-DBUILD_SHARED_LIBS=ON `
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build --config Release --parallel
|
||||
cmake --install build --config Release --prefix install
|
||||
echo "CAPSTONE_INCLUDE_DIRS=$env:GITHUB_WORKSPACE\capstone-${{ inputs.capstone-version }}\install\include" >> $env:GITHUB_ENV
|
||||
echo "CAPSTONE_LIBRARIES=$env:GITHUB_WORKSPACE\capstone-${{ inputs.capstone-version }}\install\lib\capstone.lib" >> $env:GITHUB_ENV
|
||||
echo "CAPSTONE_BIN_DIR=$env:GITHUB_WORKSPACE\capstone-${{ inputs.capstone-version }}\install\bin" >> $env:GITHUB_ENV
|
||||
shell: pwsh
|
||||
|
||||
- name: Install Unicorn and LIEF
|
||||
|
||||
@@ -28,17 +28,20 @@ jobs:
|
||||
|
||||
- name: Compile Triton
|
||||
run: |
|
||||
mkdir ./build
|
||||
cd ./build
|
||||
cmake -DGCOV=ON \
|
||||
cmake -B build \
|
||||
-DGCOV=ON \
|
||||
-DZ3_INTERFACE=ON \
|
||||
-DZ3_INCLUDE_DIRS=${{ env.Z3_INCLUDE_DIRS }} \
|
||||
-DZ3_LIBRARIES=${{ env.Z3_LIBRARIES }} \
|
||||
-DBITWUZLA_INTERFACE=ON \
|
||||
-DBITWUZLA_INCLUDE_DIRS=${{ env.BITWUZLA_INCLUDE_DIRS }} \
|
||||
-DBITWUZLA_LIBRARIES=${{ env.BITWUZLA_LIBRARIES }} \
|
||||
-DLLVM_INTERFACE=ON \
|
||||
-DCMAKE_PREFIX_PATH=${{ env.LLVM_PATH }} \
|
||||
..
|
||||
sudo make -j$(nproc) install
|
||||
-DCAPSTONE_INCLUDE_DIRS=${{ env.CAPSTONE_INCLUDE_DIRS }} \
|
||||
-DCAPSTONE_LIBRARIES=${{ env.CAPSTONE_LIBRARIES }}
|
||||
cmake --build build --config Release --parallel
|
||||
cmake --install build --config Release --prefix install
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
|
||||
@@ -25,9 +25,8 @@ jobs:
|
||||
|
||||
- name: Compile Triton
|
||||
run: |
|
||||
mkdir ./build
|
||||
cd ./build
|
||||
cmake -DZ3_INTERFACE=ON \
|
||||
cmake -B build \
|
||||
-DZ3_INTERFACE=ON \
|
||||
-DZ3_INCLUDE_DIRS=${{ env.Z3_INCLUDE_DIRS }} \
|
||||
-DZ3_LIBRARIES=${{ env.Z3_LIBRARIES }} \
|
||||
-DBITWUZLA_INTERFACE=ON \
|
||||
@@ -36,9 +35,11 @@ jobs:
|
||||
-DLLVM_INTERFACE=ON \
|
||||
-DCMAKE_PREFIX_PATH=${{ env.LLVM_PATH }} \
|
||||
-DBOOST_INTERFACE=${{ matrix.boost-interface }} \
|
||||
..
|
||||
sudo make -j$(nproc) install
|
||||
-DCAPSTONE_INCLUDE_DIRS=${{ env.CAPSTONE_INCLUDE_DIRS }} \
|
||||
-DCAPSTONE_LIBRARIES=${{ env.CAPSTONE_LIBRARIES }}
|
||||
cmake --build build --config Release --parallel 2
|
||||
cmake --install build --config Release --prefix install
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure
|
||||
ctest --test-dir build --output-on-failure -C Release
|
||||
|
||||
@@ -24,9 +24,8 @@ jobs:
|
||||
|
||||
- name: Compile Triton
|
||||
run: |
|
||||
mkdir ./build
|
||||
cd ./build
|
||||
cmake -DZ3_INTERFACE=ON \
|
||||
cmake -B build \
|
||||
-DZ3_INTERFACE=ON \
|
||||
-DZ3_INCLUDE_DIRS=${{ env.Z3_INCLUDE_DIRS }} \
|
||||
-DZ3_LIBRARIES=${{ env.Z3_LIBRARIES }} \
|
||||
-DBITWUZLA_INTERFACE=ON \
|
||||
@@ -34,9 +33,12 @@ jobs:
|
||||
-DBITWUZLA_LIBRARIES=${{ env.BITWUZLA_LIBRARIES }} \
|
||||
-DLLVM_INTERFACE=ON \
|
||||
-DCMAKE_PREFIX_PATH=${{ env.LLVM_PATH }} \
|
||||
-DBOOST_INTERFACE=OFF ..
|
||||
sudo make -j$(sysctl -n hw.ncpu) install
|
||||
-DBOOST_INTERFACE=OFF \
|
||||
-DCAPSTONE_INCLUDE_DIRS=${{ env.CAPSTONE_INCLUDE_DIRS }} \
|
||||
-DCAPSTONE_LIBRARIES=${{ env.CAPSTONE_LIBRARIES }}
|
||||
cmake --build build --config Release --parallel
|
||||
cmake --install build --config Release --prefix install
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
DYLD_LIBRARY_PATH=${{ env.DYLD_LIBRARY_PATH }}:/usr/local/lib ctest --test-dir build --output-on-failure
|
||||
DYLD_LIBRARY_PATH=${{ env.Z3_LIB_DIR }}:${{ env.BITWUZLA_LIB_DIR }}:${{ env.CAPSTONE_LIB_DIR }} ctest --test-dir build --output-on-failure -C Release
|
||||
|
||||
@@ -147,17 +147,19 @@ jobs:
|
||||
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 capstone lief unicorn z3-solver
|
||||
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.DYLD_LIBRARY_PATH }}:/opt/homebrew/lib:/usr/local/lib
|
||||
DYLD_LIBRARY_PATH: ${{ env.Z3_LIB_DIR }}:${{ env.BITWUZLA_LIB_DIR }}:${{ env.CAPSTONE_LIB_DIR }}
|
||||
|
||||
- name: Upload wheel package
|
||||
uses: actions/upload-artifact@v7
|
||||
|
||||
@@ -19,17 +19,17 @@ jobs:
|
||||
|
||||
- name: Compile Triton
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DZ3_INTERFACE=ON `
|
||||
cmake -B build `
|
||||
-DZ3_INTERFACE=ON `
|
||||
-DZ3_INCLUDE_DIRS=${{ env.Z3_INCLUDE_DIRS }} `
|
||||
-DZ3_LIBRARIES=${{ env.Z3_LIBRARIES }} `
|
||||
-DCAPSTONE_INCLUDE_DIRS=${{ env.CAPSTONE_INCLUDE_DIRS }} `
|
||||
-DCAPSTONE_LIBRARIES=${{ env.CAPSTONE_LIBRARIES }} `
|
||||
-DLLVM_INTERFACE=OFF `
|
||||
-DCMAKE_PREFIX_PATH=${{ env.LLVM_PATH }} `
|
||||
-DBOOST_INTERFACE=OFF `
|
||||
..
|
||||
cmake --build . --config Release -j3
|
||||
cmake --install . --config Release
|
||||
-DCAPSTONE_INCLUDE_DIRS=${{ env.CAPSTONE_INCLUDE_DIRS }} `
|
||||
-DCAPSTONE_LIBRARIES=${{ env.CAPSTONE_LIBRARIES }}
|
||||
cmake --build build --config Release --parallel
|
||||
cmake --install build --config Release --prefix install
|
||||
shell: pwsh
|
||||
|
||||
- name: Run tests
|
||||
|
||||
@@ -192,6 +192,32 @@ if(LLVM_INTERFACE)
|
||||
else()
|
||||
set(LLVM_LIBRARIES ${LLVM_AVAILABLE_LIBS})
|
||||
endif()
|
||||
# LLVM 18+ Linux prebuilts are compiled without exception handling and
|
||||
# propagate -fno-exceptions via INTERFACE_COMPILE_OPTIONS. Since those
|
||||
# options are applied after Triton's own compile flags in the compiler
|
||||
# command (last-flag-wins), they would override Triton's exceptions. Strip them.
|
||||
if(NOT MSVC AND LLVM_VERSION_MAJOR GREATER_EQUAL 18)
|
||||
foreach(_lib IN ITEMS LLVM ${LLVM_AVAILABLE_LIBS})
|
||||
if(TARGET ${_lib})
|
||||
get_target_property(_opts ${_lib} INTERFACE_COMPILE_OPTIONS)
|
||||
if(_opts)
|
||||
list(REMOVE_ITEM _opts -fno-exceptions -fno-rtti)
|
||||
set_target_properties(${_lib} PROPERTIES INTERFACE_COMPILE_OPTIONS "${_opts}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
# LLVM 19+ Linux prebuilts ship static archives compiled with thin LTO.
|
||||
# They contain LLVM bitcode rather than ELF objects, which GNU ld cannot
|
||||
# link. lld handles thin-LTO archives transparently; force it here.
|
||||
# Note: only static-archive builds (not dylib) on LLVM 19+; older
|
||||
# distro-packaged LLVMs use plain ELF archives and may not have lld.
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux"
|
||||
AND NOT "$CACHE{LLVM_LINK_LLVM_DYLIB}"
|
||||
AND LLVM_VERSION_MAJOR GREATER_EQUAL 19)
|
||||
add_link_options(-B${LLVM_TOOLS_BINARY_DIR} -fuse-ld=lld)
|
||||
message(STATUS "Using lld for thin-LTO static archives")
|
||||
endif()
|
||||
endif()
|
||||
include_directories(${LLVM_INCLUDE_DIRS})
|
||||
set(TRITON_LLVM_INTERFACE ON)
|
||||
|
||||
@@ -23,7 +23,7 @@ VERSION_PATCH = 0
|
||||
ON = "ON"
|
||||
OFF = "OFF"
|
||||
|
||||
clang = "clang"
|
||||
clang = "clang"
|
||||
clang_cl = "clang_cl"
|
||||
vs2022 = "vs2022"
|
||||
Release = "Release"
|
||||
@@ -105,9 +105,7 @@ class CMakeBuild(build_ext):
|
||||
|
||||
elif platform.system() == "Windows":
|
||||
if BUILDTOOLS == vs2022:
|
||||
cmake_args += [
|
||||
"-G Visual Studio 17 2022",
|
||||
]
|
||||
cmake_args += []
|
||||
build_args += ["--", "/m:4"]
|
||||
else:
|
||||
assert os.getenv('COMPILER_DIR'), "COMPILER_DIR(clang or clang_cl) env not found"
|
||||
|
||||
Reference in New Issue
Block a user