From c71d41efb6f95631fea2e13a2a2c5b970394eadf Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Wed, 9 Oct 2019 16:54:42 -0700 Subject: [PATCH] Add MSVC-based CI build --- .github/workflows/linux-ci.yml | 5 ++++- .github/workflows/msvc-ci.yml | 23 +++++++++++++++++++++++ CMakeLists.txt | 3 +++ tests/decompyle_test.sh | 6 +++++- 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/msvc-ci.yml diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index 8ca31db..7dba5ef 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -6,9 +6,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - name: Build and Test + - name: Configure and Build run: | mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Debug .. make -j2 + - name: Test + run: | + cd build make check diff --git a/.github/workflows/msvc-ci.yml b/.github/workflows/msvc-ci.yml new file mode 100644 index 0000000..a9c36bf --- /dev/null +++ b/.github/workflows/msvc-ci.yml @@ -0,0 +1,23 @@ +name: MSVC-CI +on: [push, pull_request] + +jobs: + build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v1 + - name: Configure and Build + run: | + mkdir build && cd build + cmake -G "Visual Studio 16 2019" -A Win32 .. + cmake --build . --config Debug + + # This should probably be fixed to work from MSVC without needing to + # use a bash shell and the GNU userland tools... But for now, the + # GH Actions environment provides what we need. + - name: Test + run: | + cd build\Debug + bash.exe ..\..\tests\all_tests.sh + env: + PYTHON_EXE: python.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index 2af0bf8..0b5256c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,9 @@ find_package(PythonInterp REQUIRED) if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wshadow -Werror ${CMAKE_CXX_FLAGS}") +elseif(MSVC) + set(CMAKE_CXX_FLAGS "/WX ${CMAKE_CXX_FLAGS}") + add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() set(PYTHON_VERSIONS diff --git a/tests/decompyle_test.sh b/tests/decompyle_test.sh index cb115dc..1a8f54c 100755 --- a/tests/decompyle_test.sh +++ b/tests/decompyle_test.sh @@ -5,6 +5,10 @@ testdir="$srcdir/tests" testname="$1" outdir="$2" +if [[ -z "$PYTHON_EXE" ]]; then + PYTHON_EXE="$(which python3)" +fi + if [[ -z "$testname" ]]; then echo "Missing required parameter: testname" >&2 exit 1 @@ -51,7 +55,7 @@ for pyc in "${compfiles[@]}" "${xfcfiles[@]}"; do continue fi - "$srcdir"/scripts/token_dump "$base.src.py" 2>"$base.tok.err" 1>"$base.tok.txt" + "$PYTHON_EXE" "$srcdir"/scripts/token_dump "$base.src.py" 2>"$base.tok.err" 1>"$base.tok.txt" if (( $? )) || [[ -s "$base.tok.err" ]] then if [[ "$(dirname "$pyc")" =~ xfail ]]