Skip to content

Commit

Permalink
Add new Appveyor CI test for including C headers from C++ files
Browse files Browse the repository at this point in the history
    * Need to test whether Rizin headers can be included in C++ when
      using MSVC, needed for Cutter to build successfully
    * Changed the name of `build-cpp` CI job in GitHUb jobs to
      `build-cpp-linux` to make it obvious that it only performs the
      test for Linux
  • Loading branch information
DMaroo committed Sep 25, 2023
1 parent 9f25954 commit 819ee5c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
32 changes: 27 additions & 5 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,31 @@ environment:
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
BUILD_DIR: build
RUN_TESTS: false
TEST_INCLUDE_HEADERS_CPP: false
# VS2022 64
- builder: vs2022_64
PYTHON: 'C:\\Python38-x64'
INNO_SETUP: 'C:\\Program Files (x86)\\Inno Setup 6'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
BUILD_DIR: build
RUN_TESTS: true
TEST_INCLUDE_HEADERS_CPP: true
# VS2017 64 (Dynamic linking)
- builder: vs2017_64_dyn
PYTHON: 'C:\\Python37'
INNO_SETUP: 'C:\\Program Files (x86)\\Inno Setup 5'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
BUILD_DIR: build
RUN_TESTS: false
TEST_INCLUDE_HEADERS_CPP: false
# Clang-cl 64 (Dynamic linking)
- builder: clang_cl_64_dyn
PYTHON: 'C:\\Python38'
INNO_SETUP: 'C:\\Program Files (x86)\\Inno Setup 6'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
BUILD_DIR: build
RUN_TESTS: true
TEST_INCLUDE_HEADERS_CPP: false

only_commits:
files:
Expand Down Expand Up @@ -79,12 +83,11 @@ build_script:

- cmd: if %builder% == clang_cl_64_dyn ( set "PATH=C:\mingw\bin;C:\mingw\msys\1.0\bin;%PYTHON%;%PATH%" && call "%VSVARSALLPATH2019%" x64 && set CC=clang-cl && %PYTHON%\Scripts\meson setup --buildtype=release --prefix="%CD%\%DIST_FOLDER%" build && %PYTHON%\Scripts\ninja -C build install && 7z a %ARTIFACT_ZIP% %DIST_FOLDER% )

# Run tests only conditionally
for:
-
matrix:
only:
- RUN_TESTS: true
# Run tests only conditionally
- matrix:
only:
- RUN_TESTS: true

test_script:
- if %builder% == vs2017_64 ( call "%VSVARSALLPATH2017%" x64 )
Expand All @@ -105,6 +108,25 @@ for:
- rz-test -o results.json -L db
- cd ..

# Include header files from C++
- matrix:
only:
- TEST_INCLUDE_HEADERS_CPP: true

test_script:
- if %builder% == vs2017_64 ( call "%VSVARSALLPATH2017%" x64 )
- if %builder% == vs2022_64 ( call "%VSVARSALLPATH2022%" x64 )
- if %builder% == vs2017_64_dyn ( call "%VSVARSALLPATH2017%" x64 )
- if %builder% == clang_cl_64_dyn ( call "%VSVARSALLPATH2019%" x64 )
- set PATH=%APPVEYOR_BUILD_FOLDER%\%DIST_FOLDER%\bin;C:\Python38-x64;C:\msys64\mingw64\bin;%PATH%
- echo %PATH%
- where rizin
- rizin -v
- copy C:\Python38-x64\python.exe C:\Python38-x64\python3.exe
- "%PYTHON%\\Scripts\\meson setup build-cpp-test ./test/unit/cpp"
- "%PYTHON%\\Scripts\\meson compile -C build-cpp-test"
- "%PYTHON%\\Scripts\\meson test -C build-cpp-test --print-errorlogs"

# Artifacts
artifacts:
# Binaries
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,8 @@ jobs:
name: rizin-android-${{ matrix.name }}
path: /tmp/rizin-android-${{ matrix.name }}.tar.gz

build-cpp:
name: Include Rizin headers from C++ program
build-cpp-linux:
name: Include Rizin headers from C++ program (Linux)
runs-on: ubuntu-22.04
if: contains(github.head_ref, 'dist') || contains(github.head_ref, 'cpp') || ((contains(github.ref, 'release-') || github.ref == 'refs/heads/stable') && github.event_name == 'push') || github.event_name == 'schedule'
needs: [build-and-test]
Expand Down

0 comments on commit 819ee5c

Please sign in to comment.