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/doxygen.yml b/.github/workflows/doxygen.yml new file mode 100644 index 00000000..a03c2410 --- /dev/null +++ b/.github/workflows/doxygen.yml @@ -0,0 +1,58 @@ +--- +name: doxygen + +on: + push: + branches: + - master + +jobs: + Doxygen: + runs-on: ubuntu-18.04 + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v2.0.0 + - name: Install Depends + run: | + sudo apt install doxygen + + - name: Generate Doxygen + shell: bash + run: | + mkdir build + cd build + cmake -DEVENT__DOXYGEN=ON .. + make doxygen + + - name: Deploy Documentation + env: + LIBEVENT_DEPLOY_PRI: ${{ secrets.LIBEVENT_DEPLOY_PRI }} + COMMIT_ID: ${{ github.sha }} + run: | + [[ -n $LIBEVENT_DEPLOY_PRI ]] || exit 0 + + mkdir -p ~/.ssh + echo "$LIBEVENT_DEPLOY_PRI" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan github.com >> ~/.ssh/known_hosts + + user_name="${{ github.event.head_commit.author.name }}" + user_email="${{ github.event.head_commit.author.email }}" + short_commit_id="${COMMIT_ID:0:7}" + owner_name="${{ github.event.repository.owner.name }}" + + cd ./build/doxygen/html + git init + git config --local user.name $user_name + git config --local user.email $user_email + git add -f . + git commit -m "Update documentation (libevent/libevent@$short_commit_id)" + git push -f git@github.com:$owner_name/doc master + + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: doxygen-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 diff --git a/.travis.yml b/.travis.yml index 89891493..a2f35ac1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,9 +39,9 @@ matrix: - os: linux env: EVENT_BUILD_METHOD=autotools EVENT_CONFIGURE_OPTIONS="" compiler: clang - # coveralls - - os: linux - env: EVENT_BUILD_METHOD=cmake EVENT_CMAKE_OPTIONS="-DEVENT__COVERAGE=ON -DCMAKE_BUILD_TYPE=debug" COVERALLS=yes + ## coveralls + #- os: linux + # env: EVENT_BUILD_METHOD=cmake EVENT_CMAKE_OPTIONS="-DEVENT__COVERAGE=ON -DCMAKE_BUILD_TYPE=debug" COVERALLS=yes # test-export - os: linux env: EVENT_BUILD_METHOD=cmake EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=STATIC -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON" TEST_EXPORT=STATIC @@ -51,22 +51,22 @@ matrix: - os: linux dist: bionic env: EVENT_BUILD_METHOD=cmake EVENT_CMAKE_OPTIONS="" OPENSSL_1_1=yes - # deploy documentation to github pages - - os: linux - env: TOOL=doxygen - addons: - apt: - packages: - - doxygen - - doxygen-doc - - doxygen-latex - - doxygen-gui - - graphviz - - cmake - branches: - only: - - master - if: repo = libevent/libevent AND branch = master AND type != pull_request + ## deploy documentation to github pages + #- os: linux + # env: TOOL=doxygen + # addons: + # apt: + # packages: + # - doxygen + # - doxygen-doc + # - doxygen-latex + # - doxygen-gui + # - graphviz + # - cmake + # branches: + # only: + # - master + # if: repo = libevent/libevent AND branch = master AND type != pull_request fast_finish: true language: c diff --git a/.yamllint b/.yamllint index 6946975e..90d9514b 100644 --- a/.yamllint +++ b/.yamllint @@ -7,3 +7,5 @@ rules: level: warning indent-sequences: consistent line-length: disable + # github-actions "on:" + truthy: disable diff --git a/cmake/AddEventLibrary.cmake b/cmake/AddEventLibrary.cmake index 75225500..04f5837e 100644 --- a/cmake/AddEventLibrary.cmake +++ b/cmake/AddEventLibrary.cmake @@ -158,7 +158,8 @@ macro(add_event_library LIB_NAME) "${LIB_NAME}_shared" PROPERTIES OUTPUT_NAME "${LIB_NAME}-${EVENT_PACKAGE_RELEASE}" VERSION "${CURRENT_MINUS_AGE}.${EVENT_ABI_LIBVERSION_AGE}.${EVENT_ABI_LIBVERSION_REVISION}" - SOVERSION "${CURRENT_MINUS_AGE}") + SOVERSION "${CURRENT_MINUS_AGE}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") endif() if (NOT WIN32) diff --git a/cmake/CodeCoverage.cmake b/cmake/CodeCoverage.cmake index eba85b3f..673d4fe3 100644 --- a/cmake/CodeCoverage.cmake +++ b/cmake/CodeCoverage.cmake @@ -74,16 +74,11 @@ ENDIF() # NOT GCOV_PATH IF(NOT CMAKE_COMPILER_IS_GNUCC) # Clang version 3.0.0 and greater now supports gcov as well. MESSAGE(WARNING "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't.") - - IF(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") + IF(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang") MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") ENDIF() ENDIF() # NOT CMAKE_COMPILER_IS_GNUCC -IF ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" ) - MESSAGE( WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" ) -ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug" - # Param _targetname The name of new the custom make target # Param _testrunner The name of the target which runs the tests. @@ -108,15 +103,15 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) # Cleanup lcov ${LCOV_PATH} --directory . --zerocounters - + COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned + # Run tests COMMAND ${_testrunner} ${ARGV3} # Capturing lcov counters and generating report COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info - COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' --output-file ${_outputname}.info.cleaned + COMMAND ${LCOV_PATH} --remove ${_outputname}.info '*/test/*' '/usr/*' --output-file ${CMAKE_BINARY_DIR}/${_outputname}.info.cleaned COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned - COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." diff --git a/test-export/test-export.py b/test-export/test-export.py index 3be8193f..d71e5dba 100644 --- a/test-export/test-export.py +++ b/test-export/test-export.py @@ -48,11 +48,11 @@ def link_and_run(link, code): Returns 0 if links and runs successfully, otherwise 1. """ exec_cmd("cmake --build . --target clean", True) - generator = '' + arch = '' if platform.system() == "Windows": - generator = '-G "Visual Studio 15 2017 Win64"' + arch = '-A x64' cmd = 'cmake .. %s -DEVENT__LINK_COMPONENT=%s -DEVENT__CODE_COMPONENT=%s' % ( - generator, link, code) + arch, link, code) if link_type == "static": cmd = "".join([cmd, " -DLIBEVENT_STATIC_LINK=1"]) r = exec_cmd(cmd, True) diff --git a/test/regress.c b/test/regress.c index dce58d5d..cf5060c0 100644 --- a/test/regress.c +++ b/test/regress.c @@ -3454,7 +3454,7 @@ struct testcase_t main_testcases[] = { TT_FORK|TT_NEED_BASE|TT_RETRIABLE, &basic_setup, NULL }, LEGACY(priorities, TT_FORK|TT_NEED_BASE), BASIC(priority_active_inversion, TT_FORK|TT_NEED_BASE), - { "common_timeout", test_common_timeout, TT_FORK|TT_NEED_BASE, + { "common_timeout", test_common_timeout, TT_FORK|TT_NEED_BASE|TT_RETRIABLE, &basic_setup, NULL }, /* These legacy tests may not all need all of these flags. */