Skip to content

Commit

Permalink
Merge pull request JonathanSalwan#1297 from cnheitman/feature/update-ci
Browse files Browse the repository at this point in the history
Update CI
  • Loading branch information
JonathanSalwan authored Dec 7, 2023
2 parents 6ef9008 + bf1a21e commit cd63601
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 131 deletions.
1 change: 1 addition & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
run: |
sudo apt-get install libz3-dev
python -m pip install z3-solver
python -m pip install importlib-resources
- name: Install Ninja
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
run: |
sudo apt-get install libz3-dev
python -m pip install z3-solver
python -m pip install importlib-resources
- name: Install Ninja
run: |
Expand Down
200 changes: 104 additions & 96 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,119 +15,127 @@ jobs:
- name: Create Docker image
run: bash ./src/scripts/docker/build-docker-image.sh

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "14.0"
directory: ${{ runner.temp }}/llvm

- name: Build Wheel packages
run: |
docker 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 (Python 3.8)
uses: actions/upload-artifact@v3
with:
name: triton_library-${{ env.package-version }}-cp38-cp38-manylinux_2_28_x86_64.whl
path: wheelhouse/manylinux_2_28_x86_64/triton_library-${{ env.package-version }}-cp38-cp38-manylinux_2_28_x86_64.whl
name: triton_library-${{ env.package-version }}-cp38-cp38-manylinux_2_31_x86_64.whl
path: wheelhouse/manylinux_2_31_x86_64/triton_library-${{ env.package-version }}-cp38-cp38-manylinux_2_31_x86_64.whl
if-no-files-found: warn

- name: Upload Wheel packages (Python 3.9)
uses: actions/upload-artifact@v3
with:
name: triton_library-${{ env.package-version }}-cp39-cp39-manylinux_2_28_x86_64.whl
path: wheelhouse/manylinux_2_28_x86_64/triton_library-${{ env.package-version }}-cp39-cp39-manylinux_2_28_x86_64.whl
name: triton_library-${{ env.package-version }}-cp39-cp39-manylinux_2_31_x86_64.whl
path: wheelhouse/manylinux_2_31_x86_64/triton_library-${{ env.package-version }}-cp39-cp39-manylinux_2_31_x86_64.whl
if-no-files-found: warn

- name: Upload Wheel packages (Python 3.10)
uses: actions/upload-artifact@v3
with:
name: triton_library-${{ env.package-version }}-cp310-cp310-manylinux_2_28_x86_64.whl
path: wheelhouse/manylinux_2_28_x86_64/triton_library-${{ env.package-version }}-cp310-cp310-manylinux_2_28_x86_64.whl
name: triton_library-${{ env.package-version }}-cp310-cp310-manylinux_2_31_x86_64.whl
path: wheelhouse/manylinux_2_31_x86_64/triton_library-${{ env.package-version }}-cp310-cp310-manylinux_2_31_x86_64.whl
if-no-files-found: warn

- name: Upload Wheel packages (Python 3.11)
uses: actions/upload-artifact@v3
with:
name: triton_library-${{ env.package-version }}-cp311-cp311-manylinux_2_28_x86_64.whl
path: wheelhouse/manylinux_2_28_x86_64/triton_library-${{ env.package-version }}-cp311-cp311-manylinux_2_28_x86_64.whl
name: triton_library-${{ env.package-version }}-cp311-cp311-manylinux_2_31_x86_64.whl
path: wheelhouse/manylinux_2_31_x86_64/triton_library-${{ env.package-version }}-cp311-cp311-manylinux_2_31_x86_64.whl
if-no-files-found: warn


# FIXME
# build-windows:
# runs-on: windows-latest
# strategy:
# matrix:
# python-version: ['3.8', '3.9', '3.10']
# include:
# - python-version: 3.8
# pycp: cp38-cp38
# pylib: python38.lib
# - python-version: 3.9
# pycp: cp39-cp39
# pylib: python39.lib
# - python-version: 3.10
# pycp: cp310-cp310
# pylib: python310.lib
# steps:
# - name: Checkout
# uses: actions/checkout@v3

# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}

# - name: Get CMake
# uses: lukka/get-cmake@latest

# - name: Setup Windows dev environment
# uses: ilammy/msvc-dev-cmd@v1
# with:
# arch: 'x64'

# - name: Upgrade pip version
# run: |
# python -m pip install -U pip

# - name: Install build package
# run: |
# python -m pip install build

# - name: Download and build Z3
# run: |
# wget -UseBasicParsing https://github.com/Z3Prover/z3/releases/download/z3-4.8.17/z3-4.8.17-x64-win.zip -O z3-4.8.17-x64-win.zip
# tar -xf z3-4.8.17-x64-win.zip
# wget -UseBasicParsing https://github.com/Z3Prover/z3/archive/refs/tags/z3-4.8.17.zip -O z3-4.8.17.zip
# tar -xf z3-4.8.17.zip
# cd z3-z3-4.8.17
# python scripts\mk_make.py --x64 --staticlib
# cd build
# nmake
# shell: powershell

# - name: Download Capstone
# run: |
# wget -UseBasicParsing https://github.com/capstone-engine/capstone/releases/download/4.0.2/capstone-4.0.2-win64.zip -O capstone-4.0.2-win64.zip
# tar -xf capstone-4.0.2-win64.zip
# shell: powershell

# - name: Build Triton Python package
# run: python -m build --wheel
# env:
# PYTHON_VERSION: ${{ matrix.python-version }}
# PYTHON_INCLUDE_DIRS: ${{ env.pythonLocation }}\include
# PYTHON_LIBRARIES: ${{ env.pythonLocation }}\libs\${{ matrix.pylib }}
# PYTHON_LIBRARY: ${{ env.pythonLocation }}\libs\${{ matrix.pylib }}
# Z3_INCLUDE_DIRS: ${{ github.workspace }}\z3-4.8.17-x64-win\include
# Z3_LIBRARIES: ${{ github.workspace }}\z3-z3-4.8.17\build\libz3-static.lib
# CAPSTONE_INCLUDE_DIRS: ${{ github.workspace }}\capstone-4.0.2-win64\include
# CAPSTONE_LIBRARIES: ${{ github.workspace }}\capstone-4.0.2-win64\capstone.lib

# - name: Upload
# uses: actions/upload-artifact@v3
# with:
# name: triton_library-${{ env.package-version }}-${{ matrix.pycp }}-win_amd64.whl
# path: ${{ github.workspace }}/dist/triton_library-${{ env.package-version }}-${{ matrix.pycp }}-win_amd64.whl
# if-no-files-found: warn
build-windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
include:
- python-version: 3.8
pycp: cp38-cp38
pylib: python38.lib
- 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
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Get CMake
uses: lukka/get-cmake@latest

- name: Setup Windows dev environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: 'x64'

- name: Upgrade pip version
run: |
python -m pip install -U pip
- name: Install build package
run: |
python -m pip install build
- name: Download and build Z3
run: |
wget -UseBasicParsing https://github.com/Z3Prover/z3/releases/download/z3-4.12.2/z3-4.12.2-x64-win.zip -O z3-4.12.2-x64-win.zip
tar -xf z3-4.12.2-x64-win.zip
shell: powershell

- name: Download Capstone
run: |
wget -UseBasicParsing https://github.com/capstone-engine/capstone/releases/download/4.0.2/capstone-4.0.2-win64.zip -O capstone-4.0.2-win64.zip
tar -xf capstone-4.0.2-win64.zip
shell: powershell

- 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: ${{ github.workspace }}\z3-4.12.2-x64-win\include
Z3_LIBRARIES: ${{ github.workspace }}\z3-4.12.2-x64-win\bin\libz3.lib
CAPSTONE_INCLUDE_DIRS: ${{ github.workspace }}\capstone-4.0.2-win64\include
CAPSTONE_LIBRARIES: ${{ github.workspace }}\capstone-4.0.2-win64\capstone.lib

- name: Repair wheel package
run: |
python -m pip install delvewheel
delvewheel repair --add-path ${{ github.workspace }}\z3-4.12.2-x64-win\bin --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
uses: actions/upload-artifact@v3
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:
Expand Down Expand Up @@ -193,23 +201,23 @@ jobs:
- name: Download Z3
run: |
wget -q https://github.com/Z3Prover/z3/releases/download/z3-4.8.17/z3-4.8.17-x64-osx-10.16.zip
unzip z3-4.8.17-x64-osx-10.16.zip
wget -q https://github.com/Z3Prover/z3/releases/download/z3-4.12.2/z3-4.12.2-x64-osx-10.16.zip -O z3-4.12.2-x64-osx-10.16.zip
unzip z3-4.12.2-x64-osx-10.16.zip
- name: Install Capstone
run: |
wget -q https://github.com/aquynh/capstone/archive/4.0.2.tar.gz
tar -xf ./4.0.2.tar.gz
cd capstone-4.0.2
bash ./make.sh
wget -q https://github.com/capstone-engine/capstone/archive/refs/tags/5.0.1.tar.gz -O capstone-5.0.1.tar.gz
tar xf capstone-5.0.1.tar.gz
cd ./capstone-5.0.1
./make.sh
sudo make install
- name: Build Triton Python package
run: python -m build --wheel --outdir wheelhouse/default_x86_64
env:
Z3_INTERFACE: On
Z3_INCLUDE_DIRS: ${{ github.workspace }}/z3-4.8.17-x64-osx-10.16/include
Z3_LIBRARIES: ${{ github.workspace }}/z3-4.8.17-x64-osx-10.16/bin/libz3.a
Z3_INCLUDE_DIRS: ${{ github.workspace }}/z3-4.12.2-x64-osx-10.16/include
Z3_LIBRARIES: ${{ github.workspace }}/z3-4.12.2-x64-osx-10.16/bin/libz3.a
BITWUZLA_INTERFACE: On
BITWUZLA_INCLUDE_DIRS: ${{ github.workspace }}/bitwuzla/install/include
BITWUZLA_LIBRARIES: ${{ github.workspace }}/bitwuzla/install/lib/libbitwuzla.dylib
Expand All @@ -221,7 +229,7 @@ jobs:

- name: Repair wheel package
run: |
pip install delocate
pip install delocate==0.10.4
python ${{ github.workspace }}/src/scripts/macos/delocate-wheel-custom.py \
--verbose \
Expand All @@ -242,7 +250,7 @@ jobs:
pip install capstone
pip install lief
pip install unicorn==2.0.0
pip install z3-solver
pip install z3-solver==4.12.2
cd ${{ github.workspace }}/src/testers
python -m unittest discover -b -v unittests
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ jobs:
- uses: lukka/get-cmake@latest
name: Get CMake

- name: Set up Python 3.11
if: ${{ matrix.platform == 'macos' }}
uses: actions/setup-python@v4
with:
python-version: '3.11'

- uses: ilammy/msvc-dev-cmd@v1
name: Setup Windows dev environment
with:
Expand All @@ -69,6 +75,7 @@ jobs:
- name: Configure (UNIX)
if: ${{ matrix.platform != 'windows' }}
run: |
python -m pip install importlib-resources
cmake --preset=${{ matrix.cmake-preset }} -DBUILD_SHARED_LIBS:BOOL=ON -DVCPKG_OVERLAY_TRIPLETS:PATH=${{ github.workspace }}/vcpkg/triplets -DVCPKG_TARGET_TRIPLET:STRING=${{ matrix.vcpkg-triplet }}
env:
# capstone 4.0.2 does not produce a CMake Config, hence the need to point directly to include directories and libraries
Expand All @@ -82,8 +89,8 @@ jobs:
cmake --build --preset build-${{ matrix.cmake-preset }} --config Release
- name: Test
# Test disabled on Windows `pip install lief` fails as there is no ready to use .whl and compilation fails
# Test disabled on macOS `pip install lief` fails as there is no ready to use .whl and compilation fails
# Test disabled on Windows `pip install lief` fails as there is no ready to use .whl and compilation fails
# Test disabled on macOS `pip install lief` fails as there is no ready to use .whl and compilation fails
if: ${{ (matrix.platform != 'windows') && (matrix.platform != 'macos') }}
run: |
${{ matrix.python-executable }} -m pip install lief==0.10.1 unicorn==2.0.0 z3-solver
Expand Down
14 changes: 7 additions & 7 deletions src/examples/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,43 @@ if(NOT BUILD_SHARED_LIBS)
endif()

add_executable(taint_reg taint_reg.cpp)
set_property(TARGET taint_reg PROPERTY CXX_STANDARD 14)
set_property(TARGET taint_reg PROPERTY CXX_STANDARD 17)
target_link_libraries(taint_reg triton)
add_test(TaintRegister taint_reg)
add_dependencies(check taint_reg)

add_executable(info_reg info_reg.cpp)
set_property(TARGET info_reg PROPERTY CXX_STANDARD 14)
set_property(TARGET info_reg PROPERTY CXX_STANDARD 17)
target_link_libraries(info_reg triton)
add_test(InfoRegister info_reg)
add_dependencies(check info_reg)

add_executable(ir ir.cpp)
set_property(TARGET ir PROPERTY CXX_STANDARD 14)
set_property(TARGET ir PROPERTY CXX_STANDARD 17)
target_link_libraries(ir triton)
add_test(IR ir)
add_dependencies(check ir)

add_executable(simplification simplification.cpp)
set_property(TARGET simplification PROPERTY CXX_STANDARD 14)
set_property(TARGET simplification PROPERTY CXX_STANDARD 17)
target_link_libraries(simplification triton)
add_test(Simplification simplification)
add_dependencies(check simplification)

add_executable(constraint constraint.cpp)
set_property(TARGET constraint PROPERTY CXX_STANDARD 14)
set_property(TARGET constraint PROPERTY CXX_STANDARD 17)
target_link_libraries(constraint triton)
add_test(Constraint constraint)
add_dependencies(check constraint)

add_executable(ctest_api ctest_api.cpp)
set_property(TARGET ctest_api PROPERTY CXX_STANDARD 14)
set_property(TARGET ctest_api PROPERTY CXX_STANDARD 17)
target_link_libraries(ctest_api triton)
add_test(TestAPI ctest_api)
add_dependencies(check ctest_api)

add_executable(block block.cpp)
set_property(TARGET block PROPERTY CXX_STANDARD 14)
set_property(TARGET block PROPERTY CXX_STANDARD 17)
target_link_libraries(block triton)
add_test(TestBlock block)
add_dependencies(check block)
3 changes: 2 additions & 1 deletion src/libtriton/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ endif()

# Workaround to allow building 'namespace linux' (defined by -std=gnu++11)
if(NOT MSVC AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
target_compile_options(triton PRIVATE -std=c++17)
set_property(TARGET triton PROPERTY CXX_STANDARD 17)
endif()

# Enable static msvc runtime.
Expand All @@ -297,6 +297,7 @@ endif()
# Enable parallel building for msvc.
if(MSVC)
target_compile_options(triton PRIVATE /MP)
set_property(TARGET triton PROPERTY CXX_STANDARD 17)
endif()

if(WIN32 AND BUILD_SHARED_LIBS)
Expand Down
Loading

0 comments on commit cd63601

Please sign in to comment.