From 39dcd52b94db5f7cc5081ab0c14d4bf24e305c52 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Tue, 10 Aug 2021 22:04:43 +0300 Subject: [PATCH] ci: split build and test into separate jobs --- .github/workflows/coverage.yml | 11 ++++++--- .github/workflows/linux.yml | 41 +++++++++++++++++++++++++--------- .github/workflows/macos.yml | 26 ++++++++++++++------- .github/workflows/mingw.yml | 22 +++++++++++++++--- .github/workflows/windows.yml | 40 ++++++++++++++++++--------------- 5 files changed, 97 insertions(+), 43 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b65e1142..67707bbd 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -27,16 +27,21 @@ jobs: - name: Install Depends run: sudo apt install zlib1g-dev libssl-dev build-essential lcov libmbedtls-dev - - name: Build And Test + - name: Build 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 + + - name: Test + shell: bash + run: | + export CTEST_PARALLEL_LEVEL=$JOBS + export CTEST_OUTPUT_ON_FAILURE=1 + cd build make verify_coverage - name: Coveralls GitHub Action diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index db4a3036..e6324412 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -59,7 +59,7 @@ jobs: sudo apt-get update sudo apt-get install -y libmbedtls-dev - - name: Build And Test + - name: Build shell: bash run: | if [ "${{ matrix.EVENT_MATRIX }}" == "DIST" ]; then @@ -74,9 +74,6 @@ jobs: cd $(basename $archive .tar.gz) fi - export TSAN_OPTIONS=suppressions=$PWD/extra/tsan.supp - export LSAN_OPTIONS=suppressions=$PWD/extra/lsan.supp - if [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_OPENSSL" ]; then EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_OPENSSL=ON" elif [ "${{ matrix.EVENT_MATRIX }}" == "NO_SSL" ]; then @@ -104,15 +101,29 @@ jobs: 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 || (rm -rf * && cmake .. $EVENT_CMAKE_OPTIONS) cmake --build . + + - name: Test + shell: bash + run: | + JOBS=20 + export CTEST_PARALLEL_LEVEL=$JOBS + export CTEST_OUTPUT_ON_FAILURE=1 + + export TSAN_OPTIONS=suppressions=$PWD/extra/tsan.supp + export LSAN_OPTIONS=suppressions=$PWD/extra/lsan.supp + + if [ "${{ matrix.EVENT_MATRIX }}" == "DIST" ]; then + cd dist + archive=$(echo *.tar.gz) + cd $(basename $archive .tar.gz) + fi + cd 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 @@ -167,7 +178,7 @@ jobs: sudo apt-get update sudo apt-get install -y libmbedtls-dev - - name: Build And Test + - name: Build shell: bash run: | if [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_OPENSSL" ]; then @@ -193,8 +204,6 @@ jobs: EVENT_CONFIGURE_OPTIONS="" fi - #run build and test - JOBS=20 ./autogen.sh if [ "${{ matrix.EVENT_MATRIX }}" == "DIST" ]; then @@ -213,6 +222,16 @@ jobs: echo [configure]: ../configure $EVENT_CONFIGURE_OPTIONS ../configure $EVENT_CONFIGURE_OPTIONS make + - name: Test + shell: bash + run: | + JOBS=20 + if [ "${{ matrix.EVENT_MATRIX }}" == "DIST" ]; then + cd dist + archive=$(echo *.tar.gz) + cd $(basename $archive .tar.gz) + fi + cd build make -j $JOBS verify - uses: actions/upload-artifact@v1 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index e1376445..4f19e59b 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -50,7 +50,7 @@ jobs: - name: Install Depends run: brew install mbedtls@2 - - name: Build And Test + - name: Build shell: bash run: | if [ "${{ matrix.EVENT_MATRIX }}" == "BREW_AUTODETECT_OPENSSL" ]; then @@ -88,15 +88,21 @@ jobs: fi EVENT_CMAKE_OPTIONS="$EVENT_CMAKE_OPTIONS -DMBEDTLS_ROOT_DIR=/usr/local/opt/mbedtls@2" - #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 || (rm -rf * && cmake .. $EVENT_CMAKE_OPTIONS) cmake --build . + + - name: Test + shell: bash + run: | + JOBS=1 + export CTEST_PARALLEL_LEVEL=$JOBS + export CTEST_OUTPUT_ON_FAILURE=1 + + cd 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 @@ -140,7 +146,7 @@ jobs: - name: Install Depends run: brew install autoconf automake libtool pkg-config mbedtls@2 - - name: Build And Test + - name: Build shell: bash run: | if [ "${{ matrix.EVENT_MATRIX }}" == "BREW_AUTODETECT_OPENSSL" ]; then @@ -173,14 +179,18 @@ jobs: 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 + + - name: test + shell: bash + run: | + JOBS=1 + cd build make -j $JOBS verify - uses: actions/upload-artifact@v1 diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml index 2f8cd9b3..2bfb3091 100644 --- a/.github/workflows/mingw.yml +++ b/.github/workflows/mingw.yml @@ -47,7 +47,7 @@ jobs: update: true install: mingw-w64-x86_64-gcc autoconf automake libtool mingw-w64-x86_64-openssl mingw-w64-x86_64-mbedtls pkg-config - - name: Build And Test + - name: Build shell: powershell run: | $env:EVENT_CONFIGURE_OPTIONS="" @@ -57,7 +57,6 @@ jobs: elseif ( "${{ matrix.EVENT_MATRIX }}" -ne "none" ) { $env:EVENT_CONFIGURE_OPTIONS="--${{ matrix.EVENT_MATRIX }}" } - $env:EVENT_TESTS_PARALLEL=1 $env:EVENT_BUILD_PARALLEL=10 $script=' @@ -71,6 +70,18 @@ jobs: [[ $? -ne 0 ]] && exit 1 make -j $EVENT_BUILD_PARALLEL 2>&1 [[ $? -ne 0 ]] && exit 1 + exit 0 + ' + D:\a\_temp\msys\msys64\usr\bin\bash.exe -c $script + + - name: Test + shell: powershell + run: | + $env:EVENT_TESTS_PARALLEL=1 + + $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" + cd build make verify -j $EVENT_TESTS_PARALLEL 2>&1 ' D:\a\_temp\msys\msys64\usr\bin\bash.exe -c $script @@ -109,7 +120,7 @@ jobs: update: true install: mingw-w64-x86_64-gcc mingw-w64-x86_64-openssl mingw-w64-x86_64-mbedtls - - name: Build And Test + - name: Build shell: powershell run: | $EVENT_CONFIGURE_OPTIONS="" @@ -146,6 +157,11 @@ jobs: } cmake_configure 1 cmake --build . + + - name: Test + shell: powershell + run: | + cd build ctest -V - uses: actions/upload-artifact@v1 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d3448283..67169e58 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -46,11 +46,10 @@ jobs: vcpkgTriplet: x64-windows vcpkgGitCommitId: 7bc5b8cdfaf35329c1520b2af8d368e2b1cb78e6 - - name: Build And Test + - name: Build shell: powershell run: | $EVENT_BUILD_PARALLEL=10 - $EVENT_TESTS_PARALLEL=1 mkdir build -ea 0 cd build @@ -84,18 +83,21 @@ jobs: } } cmake_configure 1 + cmake --build . -j $EVENT_BUILD_PARALLEL -- /nologo /verbosity:minimal + + - name: Test + shell: powershell + run: | + $EVENT_TESTS_PARALLEL=1 + + cd build try { - 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") { + } elseif ("${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_SHARED") { python ../test-export/test-export.py shared - } - else { + } else { ctest --output-on-failure -j $EVENT_TESTS_PARALLEL if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } } @@ -146,11 +148,10 @@ jobs: vcpkgTriplet: x64-windows vcpkgGitCommitId: 7bc5b8cdfaf35329c1520b2af8d368e2b1cb78e6 - - name: Build And Test + - name: Build shell: powershell run: | $EVENT_BUILD_PARALLEL=10 - $EVENT_TESTS_PARALLEL=1 if ( "${{ matrix.EVENT_MATRIX }}" -eq "LIBRARY_TYPE_STATIC" ) { $EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=STATIC -DEVENT__MSVC_STATIC_RUNTIME=OFF" @@ -220,18 +221,21 @@ jobs: } } cmake_configure 1 + cmake --build . -j $EVENT_BUILD_PARALLEL -- /nologo /verbosity:minimal + + - name: Test + shell: powershell + run: | + $EVENT_TESTS_PARALLEL=1 + + cd build try { - 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") { + } elseif ("${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_SHARED") { python ../test-export/test-export.py shared - } - else { + } else { ctest --output-on-failure -j $EVENT_TESTS_PARALLEL if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } }