From: yuangongji Date: Tue, 21 Jan 2020 11:51:48 +0000 (+0800) Subject: github actions: test and coverage X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=84bb2c18e4694ac5b9318dbf9c39f7968db50ab4;p=libevent github actions: test and coverage --- diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000..3a34fbe5 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,51 @@ +--- +name: coverage + +on: + push: + branches: + - master + paths-ignore: + - '**.md' + - '.mailmap' + - 'ChangeLog*' + - 'whatsnew*' + - 'LICENSE' + +jobs: + linux: + runs-on: ubuntu-16.04 + steps: + - uses: actions/checkout@v2.0.0 + - name: Cache + uses: actions/cache@v1.0.3 + with: + path: build + key: ${{ matrix.os }}-coverage + + - name: Install Depends + run: sudo apt install zlib1g-dev libssl-dev build-essential lcov + + - name: Build And Test + shell: bash + run: | + export JOBS=20 + export CTEST_PARALLEL_LEVEL=$JOBS + export CTEST_OUTPUT_ON_FAILURE=1 + mkdir -p build + cd build + cmake .. -DEVENT__COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug + make -j $JOBS + make verify_coverage + + - name: Coveralls GitHub Action + uses: coverallsapp/github-action@v1.0.1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: ./build/coverage.info.cleaned + + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: coverage-build + path: build diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 00000000..a9bf4220 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,157 @@ +--- +name: linux + +on: + pull_request: + types: [opened, synchronize] + paths-ignore: + - '**.md' + - '.mailmap' + - 'ChangeLog*' + - 'whatsnew*' + - 'LICENSE' + push: + paths-ignore: + - '**.md' + - '.mailmap' + - 'ChangeLog*' + - 'whatsnew*' + - 'LICENSE' + +jobs: + cmake: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-18.04] + EVENT_MATRIX: + - NONE + - DISABLE_OPENSSL + - DISABLE_THREAD_SUPPORT + - DISABLE_DEBUG_MODE + - DISABLE_MM_REPLACEMENT + - COMPILER_CLANG + - TEST_EXPORT_STATIC + - TEST_EXPORT_SHARED + + steps: + - uses: actions/checkout@v2.0.0 + - name: Cache Build + uses: actions/cache@v1.1.0 + with: + path: build + key: ${{ matrix.os }}-cmake-${{ matrix.EVENT_MATRIX }} + + - name: Build And Test + shell: bash + run: | + if [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_OPENSSL" ]; then + EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_OPENSSL=ON" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_THREAD_SUPPORT" ]; then + EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_THREAD_SUPPORT=ON" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_DEBUG_MODE" ]; then + EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_DEBUG_MODE=ON" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_MM_REPLACEMENT" ]; then + EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_MM_REPLACEMENT=ON" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "COMPILER_CLANG" ]; then + EVENT_CMAKE_OPTIONS="" + export CC=clang + + elif [ "${{ matrix.EVENT_MATRIX }}" == "TEST_EXPORT_STATIC" ]; then + EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=STATIC -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "TEST_EXPORT_SHARED" ]; then + EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=SHARED -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON" + + else + EVENT_CMAKE_OPTIONS="" + fi + + #run build and test + JOBS=20 + export CTEST_PARALLEL_LEVEL=$JOBS + export CTEST_OUTPUT_ON_FAILURE=1 + mkdir -p build + cd build + echo [cmake]: cmake .. $EVENT_CMAKE_OPTIONS + cmake .. $EVENT_CMAKE_OPTIONS + cmake --build . + if [ "${{ matrix.EVENT_MATRIX }}" == "TEST_EXPORT_STATIC" ]; then + sudo python3 ../test-export/test-export.py static + elif [ "${{ matrix.EVENT_MATRIX }}" == "TEST_EXPORT_SHARED" ]; then + sudo python3 ../test-export/test-export.py shared + else + cmake --build . --target verify + fi + + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: ${{ matrix.os }}-cmake-${{ matrix.EVENT_MATRIX }}-build + path: build + + autotools: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-18.04] + EVENT_MATRIX: + - NONE + - DISABLE_OPENSSL + - DISABLE_THREAD_SUPPORT + - DISABLE_DEBUG_MODE + - DISABLE_MM_REPLACEMENT + - COMPILER_CLANG + + steps: + - uses: actions/checkout@v2.0.0 + - name: Cache Build + uses: actions/cache@v1.1.0 + with: + path: build + key: ${{ matrix.os }}-autotools-${{ matrix.EVENT_MATRIX }} + + - name: Build And Test + shell: bash + run: | + if [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_OPENSSL" ]; then + EVENT_CONFIGURE_OPTIONS="--disable-openssl" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_THREAD_SUPPORT" ]; then + EVENT_CONFIGURE_OPTIONS="--disable-thread-support" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_DEBUG_MODE" ]; then + EVENT_CONFIGURE_OPTIONS="--disable-debug-mode" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_MM_REPLACEMENT" ]; then + EVENT_CONFIGURE_OPTIONS="--disable-malloc-replacement" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "COMPILER_CLANG" ]; then + EVENT_CONFIGURE_OPTIONS="" + export CC=clang + + else + EVENT_CONFIGURE_OPTIONS="" + fi + + #run build and test + JOBS=20 + ./autogen.sh + mkdir -p build + cd build + echo [configure]: ../configure $EVENT_CONFIGURE_OPTIONS + ../configure $EVENT_CONFIGURE_OPTIONS + make + make -j $JOBS verify + + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: ${{ matrix.os }}-autotools-${{ matrix.EVENT_MATRIX }}-build + path: build diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000..fc5c3703 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,166 @@ +--- +name: macos + +on: + pull_request: + types: [opened, synchronize] + paths-ignore: + - '**.md' + - '.mailmap' + - 'ChangeLog*' + - 'whatsnew*' + - 'LICENSE' + push: + paths-ignore: + - '**.md' + - '.mailmap' + - 'ChangeLog*' + - 'whatsnew*' + - 'LICENSE' + +jobs: + cmake: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-latest] + EVENT_MATRIX: + - NONE + - DISABLE_OPENSSL + - DISABLE_THREAD_SUPPORT + - DISABLE_DEBUG_MODE + - DISABLE_MM_REPLACEMENT + - TEST_EXPORT_STATIC + - TEST_EXPORT_SHARED + - OPENSSL_1_1 + + steps: + - uses: actions/checkout@v2.0.0 + + - name: Cache Build + uses: actions/cache@v1.1.0 + with: + path: build + key: macos-10.15-cmake-${{ matrix.EVENT_MATRIX }} + + - name: Build And Test + shell: bash + run: | + if [ "${{ matrix.EVENT_MATRIX }}" == "OPENSSL_1_1" ]; then + export OPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1 + else + export OPENSSL_ROOT_DIR=/usr/local/opt/openssl + fi + + if [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_OPENSSL" ]; then + EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_OPENSSL=ON" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_THREAD_SUPPORT" ]; then + EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_THREAD_SUPPORT=ON" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_DEBUG_MODE" ]; then + EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_DEBUG_MODE=ON" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_MM_REPLACEMENT" ]; then + EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_MM_REPLACEMENT=ON" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "TEST_EXPORT_STATIC" ]; then + EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=STATIC -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "TEST_EXPORT_SHARED" ]; then + EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=SHARED -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON" + + else + EVENT_CMAKE_OPTIONS="" + fi + + #run build and test + JOBS=1 + export CTEST_PARALLEL_LEVEL=$JOBS + export CTEST_OUTPUT_ON_FAILURE=1 + mkdir -p build + cd build + echo [cmake]: cmake .. $EVENT_CMAKE_OPTIONS + cmake .. $EVENT_CMAKE_OPTIONS + cmake --build . + if [ "${{ matrix.EVENT_MATRIX }}" == "TEST_EXPORT_STATIC" ]; then + sudo python3 ../test-export/test-export.py static + elif [ "${{ matrix.EVENT_MATRIX }}" == "TEST_EXPORT_SHARED" ]; then + sudo python3 ../test-export/test-export.py shared + else + cmake --build . --target verify + fi + + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: ${{ matrix.os }}-cmake-${{ matrix.EVENT_MATRIX }}-build + path: build + + autotools: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-latest] + EVENT_MATRIX: + - NONE + - DISABLE_OPENSSL + - DISABLE_THREAD_SUPPORT + - DISABLE_DEBUG_MODE + - DISABLE_MM_REPLACEMENT + - OPENSSL_1_1 + + steps: + - uses: actions/checkout@v2.0.0 + + - name: Cache Build + uses: actions/cache@v1.1.0 + with: + path: build + key: ${{ matrix.os }}-autotools-${{ matrix.EVENT_MATRIX }} + + - name: Install Depends + run: brew install autoconf automake libtool pkg-config + + - name: Build And Test + shell: bash + run: | + if [ "${{ matrix.EVENT_MATRIX }}" == "OPENSSL_1_1" ]; then + export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig:$PKG_CONFIG_PATH" + else + export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH" + fi + + if [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_OPENSSL" ]; then + EVENT_CONFIGURE_OPTIONS="--disable-openssl" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_THREAD_SUPPORT" ]; then + EVENT_CONFIGURE_OPTIONS="--disable-thread-support" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_DEBUG_MODE" ]; then + EVENT_CONFIGURE_OPTIONS="--disable-debug-mode" + + elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_MM_REPLACEMENT" ]; then + EVENT_CONFIGURE_OPTIONS="--disable-malloc-replacement" + + else + EVENT_CONFIGURE_OPTIONS="" + fi + + #run build and test + JOBS=1 + ./autogen.sh + mkdir -p build + cd build + echo [configure]: ../configure $EVENT_CONFIGURE_OPTIONS + ../configure $EVENT_CONFIGURE_OPTIONS + make + make -j $JOBS verify + + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: ${{ matrix.os }}-autotools-${{ matrix.EVENT_MATRIX }}-build + path: build diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml new file mode 100644 index 00000000..4624f054 --- /dev/null +++ b/.github/workflows/mingw.yml @@ -0,0 +1,88 @@ +--- +name: mingw + +on: + pull_request: + types: [opened, synchronize] + paths-ignore: + - '**.md' + - '.mailmap' + - 'ChangeLog*' + - 'whatsnew*' + - 'LICENSE' + push: + paths-ignore: + - '**.md' + - '.mailmap' + - 'ChangeLog*' + - 'whatsnew*' + - 'LICENSE' + +jobs: + windows: + runs-on: windows-2016 + strategy: + fail-fast: false + matrix: + EVENT_MATRIX: + - none + - disable-openssl + - disable-thread-support + - disable-debug-mode + - disable-malloc-replacement + + steps: + - uses: actions/checkout@v2.0.0 + + - name: Cache MingW + id: cache-mingw + uses: actions/cache@v1.0.3 + with: + path: D:\a\_temp\msys + key: windows-mingw + + - name: Cache Build + uses: actions/cache@v1.0.3 + with: + path: build + key: mingw-${{ matrix.EVENT_MATRIX }} + + - uses: numworks/setup-msys2@v1 + if: steps.cache-mingw.outputs.cache-hit != 'true' + with: + msystem: MINGW64 + + - name: Install Dependes + if: steps.cache-mingw.outputs.cache-hit != 'true' + run: | + msys2do pacman -S --noconfirm mingw-w64-x86_64-gcc make autoconf automake libtool openssl-devel + + - name: Build And Test + shell: powershell + run: | + $env:EVENT_CONFIGURE_OPTIONS="" + if ( "${{ matrix.EVENT_MATRIX }}" -ne "none" ) { + $env:EVENT_CONFIGURE_OPTIONS="--${{ matrix.EVENT_MATRIX }}" + } + $env:EVENT_TESTS_PARALLEL=1 + $env:EVENT_BUILD_PARALLEL=10 + + $script=' + export PATH="/mingw64/bin:/usr/bin:/bin:/usr/local/bin:/opt/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:$PATH" + ./autogen.sh 2>&1 3>&1 + [[ $? -ne 0 ]] && exit 1 + mkdir -p build + cd build + [[ $? -ne 0 ]] && exit 1 + LDFLAGS="-L/usr/lib" CFLAGS="-I/usr/include" ../configure $EVENT_CONFIGURE_OPTIONS 2>&1 + [[ $? -ne 0 ]] && exit 1 + make -j $EVENT_BUILD_PARALLEL 2>&1 + [[ $? -ne 0 ]] && exit 1 + make verify -j $EVENT_TESTS_PARALLEL 2>&1 ' + D:\a\_temp\msys\msys64\usr\bin\bash.exe -c $script + + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: mingw-${{ matrix.EVENT_MATRIX }}-build + path: build diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 00000000..9eea22f9 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,233 @@ +--- +name: windows + +on: + pull_request: + types: [opened, synchronize] + paths-ignore: + - '**.md' + - '.mailmap' + - 'ChangeLog*' + - 'whatsnew*' + - 'LICENSE' + push: + paths-ignore: + - '**.md' + - '.mailmap' + - 'ChangeLog*' + - 'whatsnew*' + - 'LICENSE' + +jobs: + vs2017: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-2016] + EVENT_MATRIX: [NONE] + + steps: + - uses: actions/checkout@v2.0.0 + + - name: Cache Depends + id: cache-depends + uses: actions/cache@v1.0.3 + with: + path: C:\vcpkg\installed + key: ${{ matrix.os }}-vcpkg + + - name: Cache Build + uses: actions/cache@v1.0.3 + with: + path: build + key: ${{ matrix.os }}-${{ matrix.EVENT_MATRIX }} + + - name: Install Depends + if: steps.cache-depends.outputs.cache-hit != 'true' + shell: powershell + run: | + vcpkg install openssl:x64-windows + vcpkg install zlib:x64-windows + + - name: Build And Test + shell: powershell + run: | + $OPENSSL_ROOT_DIR="C:\vcpkg\installed\x64-windows" + $EVENT_BUILD_PARALLEL=10 + $EVENT_TESTS_PARALLEL=1 + $env:PATH="$OPENSSL_ROOT_DIR/bin;$env:PATH" + + if ( "${{ matrix.EVENT_MATRIX }}" -eq "LIBRARY_TYPE_STATIC" ) { + $EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=STATIC" + } + elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_OPENSSL" ) { + $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_OPENSSL=ON" + } + elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_THREAD_SUPPORT" ) { + $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_THREAD_SUPPORT=ON" + } + elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_DEBUG_MODE" ) { + $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_DEBUG_MODE=ON" + } + elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_MM_REPLACEMENT" ) { + $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_MM_REPLACEMENT=ON" + } + elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "UNICODE" ) { + $EVENT_CMAKE_OPTIONS="-DCMAKE_C_FLAGS='-DUNICODE -D_UNICODE'" + } + elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_SHARED" ) { + $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON" + } + elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_STATIC" ) { + $EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=STATIC -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON" + } + else { + $EVENT_CMAKE_OPTIONS="" + } + + if (-not (Test-Path -Path "./build")){ + mkdir build + } + cd build + if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } + + if ("${{ matrix.os }}" -eq "windows-2016") { + $CMAKE_CMD="cmake -G 'Visual Studio 15 2017 Win64' .. $EVENT_CMAKE_OPTIONS" + } + else { # windows-2019 + $CMAKE_CMD="cmake -G 'Visual Studio 16 2019' -A x64 .. $EVENT_CMAKE_OPTIONS" + } + echo "[cmake] $CMAKE_CMD" + Invoke-Expression $CMAKE_CMD + if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } + + cmake --build . -j $EVENT_BUILD_PARALLEL -- /nologo /verbosity:minimal + if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } + + if ("${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_STATIC") { + python ../test-export/test-export.py static + } + elseif ("${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_SHARED") { + python ../test-export/test-export.py shared + } + else { + ctest --output-on-failure -j $EVENT_TESTS_PARALLEL + } + + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: ${{ matrix.os }}-${{ matrix.EVENT_MATRIX }}-build + path: build + + vs2019: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-2019] + EVENT_MATRIX: + - NONE + - LIBRARY_TYPE_STATIC + - DISABLE_OPENSSL + - DISABLE_THREAD_SUPPORT + - DISABLE_DEBUG_MODE + - DISABLE_MM_REPLACEMENT + - DUNICODE + - TEST_EXPORT_SHARED + - TEST_EXPORT_STATIC + + steps: + - uses: actions/checkout@v2.0.0 + + - name: Cache Depends + id: cache-depends + uses: actions/cache@v1.1.0 + with: + path: C:\vcpkg\installed + key: ${{ matrix.os }}-vcpkg + + - name: Cache Build + uses: actions/cache@v1.1.0 + with: + path: build + key: ${{ matrix.os }}-${{ matrix.EVENT_MATRIX }}-build + + - name: Install Depends + if: steps.cache-depends.outputs.cache-hit != 'true' + shell: powershell + run: | + vcpkg install openssl:x64-windows + vcpkg install zlib:x64-windows + + - name: Build And Test + shell: powershell + run: | + $OPENSSL_ROOT_DIR="C:\vcpkg\installed\x64-windows" + $EVENT_BUILD_PARALLEL=10 + $EVENT_TESTS_PARALLEL=1 + $env:PATH="$OPENSSL_ROOT_DIR/bin;$env:PATH" + + if ( "${{ matrix.EVENT_MATRIX }}" -eq "LIBRARY_TYPE_STATIC" ) { + $EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=STATIC" + } + elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_OPENSSL" ) { + $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_OPENSSL=ON" + } + elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_THREAD_SUPPORT" ) { + $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_THREAD_SUPPORT=ON" + } + elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_DEBUG_MODE" ) { + $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_DEBUG_MODE=ON" + } + elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_MM_REPLACEMENT" ) { + $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_MM_REPLACEMENT=ON" + } + elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "UNICODE" ) { + $EVENT_CMAKE_OPTIONS="-DCMAKE_C_FLAGS='-DUNICODE -D_UNICODE'" + } + elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_SHARED" ) { + $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON" + } + elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_STATIC" ) { + $EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=STATIC -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON" + } + else { + $EVENT_CMAKE_OPTIONS="" + } + + if (-not (Test-Path -Path "./build")){ + mkdir build + } + cd build + if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } + + if ("${{ matrix.os }}" -eq "windows-2016") { + $CMAKE_CMD="cmake -G 'Visual Studio 15 2017 Win64' .. $EVENT_CMAKE_OPTIONS" + } + else { # windows-2019 + $CMAKE_CMD="cmake -G 'Visual Studio 16 2019' -A x64 .. $EVENT_CMAKE_OPTIONS" + } + echo "[cmake] $CMAKE_CMD" + Invoke-Expression $CMAKE_CMD + if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } + + cmake --build . -j $EVENT_BUILD_PARALLEL -- /nologo /verbosity:minimal + if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } + + if ("${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_STATIC") { + python ../test-export/test-export.py static + } + elseif ("${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_SHARED") { + python ../test-export/test-export.py shared + } + else { + ctest --output-on-failure -j $EVENT_TESTS_PARALLEL + } + + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: ${{ matrix.os }}-${{ matrix.EVENT_MATRIX }}-build + path: build