From a5c68a7e8202569dec6c71fc1a19033286ddce8a Mon Sep 17 00:00:00 2001 From: Tom Osika Date: Thu, 11 Mar 2021 17:20:17 -0500 Subject: [PATCH] Add windows ci --- .github/workflows/tests.yml | 48 +++++++++++++++++++++++++++++++--- unittests/configs/appveyor.cfg | 5 ---- unittests/configs/msvc.cfg | 4 +++ 3 files changed, 49 insertions(+), 8 deletions(-) delete mode 100644 unittests/configs/appveyor.cfg create mode 100644 unittests/configs/msvc.cfg diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fc68b408..91b18617 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,7 +3,9 @@ jobs: tests: name: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.version }}-python-${{ matrix.python-version }}-${{ matrix.castxml-epic }} runs-on: ${{ matrix.os }} - + defaults: + run: + shell: bash strategy: fail-fast: false matrix: @@ -64,34 +66,74 @@ jobs: castxml-epic: 0 cppstd: "-std=c++98" + - os: windows-latest + compiler: msvc + version: "default" + python-version: 3.8 + castxml: "castxml" + castxml-epic: 1 + cppstd: "-std=c++11" + + steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v1 with: python-version: ${{ matrix.python-version }} + - name: Display Python version run: python -c "import sys; print(sys.version)" + - name: Setup castxml for Linux if: matrix.os == 'ubuntu-18.04' && matrix.castxml == 'castxml' run: | wget -q -O - https://data.kitware.com/api/v1/file/hashsum/sha512/bdbb67a10c5f8d1b738cd19cb074f409d4803e8077cb8c1072ef4eaf738fa871a73643f9c8282d58cae28d188df842c82ad6620b6d590b0396a0172a27438dce/download | tar zxf - -C ~/ + - name: Setup castxml for Mac if: matrix.os == 'macos-latest' run: | wget -q -O - https://data.kitware.com/api/v1/file/hashsum/sha512/5d937e938f7b882a3a3e7941e68f8312d0898aaf2082e00003dd362b1ba70b98b0a08706a1be28e71652a6a0f1e66f89768b5eaa20e5a100592d5b3deefec3f0/download | tar zxf - -C ~/ - - name: Setup castxml config + + - name: Setup castxml for Windows + if: matrix.os == 'windows-latest' + shell: cmd + run: | + curl https://data.kitware.com/api/v1/file/hashsum/sha512/bdd1e2c3b203019f758681067bb4dd68cb37abc930fee6b4b5d181bd805236352f888d061f32c7f93bde2eac2caa1265b93bbccff6656f98989dafd08f55847b/download --output castxml.zip + powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('castxml.zip', 'C:\'); }" + + - name: Setup castxml config for gcc if: matrix.compiler == 'gcc' && matrix.version == '7' run: mv unittests/configs/gcc7.cfg unittests/xml_generator.cfg; + + - name: Setup castxml config for msvc + if: matrix.compiler == 'msvc' + shell: cmd + run: | + move unittests\configs\msvc.cfg unittests\xml_generator.cfg; + - name: Install Python lib and test libs run: | pip install .[test] - - name: Run tests + + - name: Run tests for Windows + shell: cmd + if: matrix.os == 'windows-latest' + run: | + SET path=C:\castxml\bin;%path% || echo Failed to add castxml to path && exit \b + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" || echo Failed to call vcvars64 && exit \b + coverage run -m unittests.test_all || echo Test failure && exit \b + coverage combine || echo coverage combine failed && exit \b + coverage xml || echo Failed to generate xml coverage file && exit \b + + - name: Run tests for Mac and Linux + if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-18.04' run: | export PATH=~/castxml/bin:$PATH coverage run -m unittests.test_all coverage combine coverage xml + - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 with: diff --git a/unittests/configs/appveyor.cfg b/unittests/configs/appveyor.cfg deleted file mode 100644 index 3c95c6e9..00000000 --- a/unittests/configs/appveyor.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[xml_generator] -compiler=msvc -compiler_path=C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -cflags=-std=c++11 -include_paths=C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/include diff --git a/unittests/configs/msvc.cfg b/unittests/configs/msvc.cfg new file mode 100644 index 00000000..13555c5c --- /dev/null +++ b/unittests/configs/msvc.cfg @@ -0,0 +1,4 @@ +[xml_generator] +compiler_path=C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl +cflags=-std=c++14 +include_paths=C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/tools/MSVC/14.28.29910/include \ No newline at end of file