This is an automated email from the ASF dual-hosted git repository. pnoltes pushed a commit to branch feature/coverage_on_github_workflow in repository https://gitbox.apache.org/repos/asf/celix.git
commit e1e25f867d3c1542a35bce24ae7895425dafe318 Author: Pepijn Noltes <[email protected]> AuthorDate: Fri Apr 17 13:11:39 2020 +0200 Update github workflows to support coverage. Also split up the build.yml in ubuntu and macos version. --- .github/workflows/build.yml | 90 ---------------------------------- .github/workflows/coverage.yml | 48 ++++++++++++++++++ .github/workflows/macos.yml | 42 ++++++++++++++++ .github/workflows/ubuntu.yml | 65 ++++++++++++++++++++++++ .travis.yml | 6 +-- cmake/celix_project/CelixProject.cmake | 2 +- 6 files changed, 157 insertions(+), 96 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 3015742..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Celix - -on: [push, pull_request] - -jobs: - Build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [macOS-latest] - #os: [ubuntu-18.04, ubuntu-16.04, macOS-10.14] - compiler: [clang] - include: - - os: ubuntu-18.04 - compiler: clang - - os: ubuntu-18.04 - name: sanitizer - compiler: gcc - sanitize: true - - os: ubuntu-18.04 - name: only v3 api - compiler: gcc - v3_api: true - timeout-minutes: 120 - steps: - - name: Checkout source code - uses: actions/checkout@master - - name: Install dependencies - run: | - if [[ "${{ matrix.os }}" == "ubuntu"* ]]; then - sudo apt-get update - sudo apt-get install -yq --no-install-recommends \ - build-essential \ - curl \ - uuid-dev \ - libjansson-dev \ - libcurl4-openssl-dev \ - default-jdk \ - cmake \ - libffi-dev \ - libxml2-dev \ - libczmq-dev \ - libcpputest-dev - fi - if [[ "${{ matrix.os }}" == "macOS"* ]]; then - brew update - brew install lcov libffi zeromq czmq openssl cpputest - brew link --force libffi - brew unlink openssl && brew link openssl --force - fi - cd $GITHUB_WORKSPACE - - name: Build - env: - CC: ${{ matrix.compiler }} - BUILD_OPTIONS: | - -DENABLE_TESTING=ON - BUILD_OPTIONS_LINUX: - BUILD_OPTIONS_OSX: | - -DFFI_INCLUDE_DIR=/usr/local/opt/libffi/lib/libffi-3.2.1/include - -DFFI_LIBRARY=/usr/local/opt/libffi/lib/libffi.dylib - BUILD_OPTIONS_SANITIZE: | - -DENABLE_ADDRESS_SANITIZER=ON - BUILD_OPTIONS_V3_API: | - -DCELIX_USE_ZIP_INSTEAD_OF_JAR=ON - -DCELIX_INSTALL_DEPRECATED_API=OFF - run: | - mkdir build install - cd build - if [[ "${{ matrix.sanitize }}" == "true" ]]; then - export BUILD_OPTIONS="${BUILD_OPTIONS} ${BUILD_OPTIONS_SANITIZE}" - fi - if [[ "${{ matrix.v3_api }}" == "true" ]]; then - export BUILD_OPTIONS="${BUILD_OPTIONS} ${BUILD_OPTIONS_V3_API}" - fi - if [[ "${{ matrix.os }}" == "ubuntu"* ]]; then - cmake -DCMAKE_BUILD_TYPE=Debug ${BUILD_OPTIONS} ${BUILD_OPTIONS_LINUX} \ - -DCMAKE_INSTALL_PREFIX=../install .. - fi - if [[ "${{ matrix.os }}" == "macOS"* ]]; then - cmake -DCMAKE_BUILD_TYPE=Debug ${BUILD_OPTIONS} ${BUILD_OPTIONS_OSX} \ - -DCMAKE_INSTALL_PREFIX=../install .. - fi - make -j && make install - - name: Test - run: | - cd $GITHUB_WORKSPACE/build - export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH:$(pwd)/utils:$(pwd)/framework:$(pwd)/dfi - make test ARGS="-V" - diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..fcf6c48 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,48 @@ +name: Celix Coverage + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-18.04 + steps: + - name: Checkout source code + uses: actions/checkout@master + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -yq --no-install-recommends \ + build-essential \ + curl \ + uuid-dev \ + libjansson-dev \ + libcurl4-openssl-dev \ + default-jdk \ + cmake \ + libffi-dev \ + libxml2-dev \ + libczmq-dev \ + libcpputest-dev + cd $GITHUB_WORKSPACE + - name: Build + env: + BUILD_OPTIONS: | + -DENABLE_TESTING=ON + -DENABLE_CODE_COVERAGE=ON + run: | + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Debug ${BUILD_OPTIONS} + make -j + - name: Test + run: | + cd $GITHUB_WORKSPACE/build + export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH:$(pwd)/utils:$(pwd)/framework:$(pwd)/dfi + make test ARGS="-V" + - name: Coverage + run: | + make coverage + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 0000000..487fc0f --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,42 @@ +name: Celix + +on: [push, pull_request] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macOS-latest] + compiler: [clang] + timeout-minutes: 120 + steps: + - name: Checkout source code + uses: actions/checkout@master + - name: Install dependencies + run: | + brew update + brew install lcov libffi zeromq czmq openssl cpputest + brew link --force libffi + brew unlink openssl && brew link openssl --force + cd $GITHUB_WORKSPACE + - name: Build + env: + CC: ${{ matrix.compiler }} + BUILD_OPTIONS: | + -DENABLE_TESTING=ON + -DENABLE_ADDRESS_SANITIZER=ON + -DFFI_INCLUDE_DIR=/usr/local/opt/libffi/lib/libffi-3.2.1/include + -DFFI_LIBRARY=/usr/local/opt/libffi/lib/libffi.dylib + run: | + mkdir build install + cd build + cmake -DCMAKE_BUILD_TYPE=Debug ${BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX=../install .. + make -j && make install + - name: Test + run: | + cd $GITHUB_WORKSPACE/build + export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH:$(pwd)/utils:$(pwd)/framework:$(pwd)/dfi + make test ARGS="-V" + diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml new file mode 100644 index 0000000..a58a272 --- /dev/null +++ b/.github/workflows/ubuntu.yml @@ -0,0 +1,65 @@ +name: Celix Ubuntu + +on: [push, pull_request] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + #os: [ubuntu-18.04, ubuntu-16.04] + #compiler: [gcc, clang] + include: + - os: ubuntu-18.04 + compiler: clang + - os: ubuntu-18.04 + name: sanitizer + compiler: gcc + - os: ubuntu-18.04 + name: only v3 api + compiler: gcc + v3_api: true + timeout-minutes: 120 + steps: + - name: Checkout source code + uses: actions/checkout@master + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -yq --no-install-recommends \ + build-essential \ + curl \ + uuid-dev \ + libjansson-dev \ + libcurl4-openssl-dev \ + default-jdk \ + cmake \ + libffi-dev \ + libxml2-dev \ + libczmq-dev \ + libcpputest-dev + cd $GITHUB_WORKSPACE + - name: Build + env: + CC: ${{ matrix.compiler }} + BUILD_OPTIONS: | + -DENABLE_TESTING=ON + -DENABLE_ADDRESS_SANITIZER=ON + BUILD_OPTIONS_V3_API: | + -DCELIX_USE_ZIP_INSTEAD_OF_JAR=ON + -DCELIX_INSTALL_DEPRECATED_API=OFF + run: | + mkdir build install + cd build + if [[ "${{ matrix.v3_api }}" == "true" ]]; then + export BUILD_OPTIONS="${BUILD_OPTIONS} ${BUILD_OPTIONS_V3_API}" + fi + cmake -DCMAKE_BUILD_TYPE=Debug ${BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX=../install .. + make -j && make install + - name: Test + run: | + cd $GITHUB_WORKSPACE/build + export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH:$(pwd)/utils:$(pwd)/framework:$(pwd)/dfi + make test ARGS="-V" + diff --git a/.travis.yml b/.travis.yml index a376768..de71555 100644 --- a/.travis.yml +++ b/.travis.yml @@ -78,11 +78,7 @@ script: - if [ -z "$ANDROID" ]; then export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH:`pwd`/utils:`pwd`/framework:`pwd`/dfi && make test ARGS="-V"; else docker run celixandroid; fi after_success: - - if [ "$CC" = "gcc" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then - cd ${TRAVIS_BUILD_DIR}/build; - gem install coveralls-lcov && - make coverage && - lcx="lcov --output-file=coverage.info " && for i in `find . -name "*.info.cleaned"`; do lcx+=" --add-tracefile=$i"; done && $lcx && coveralls-lcov --repo-token=9dpeTAjiGoQU5hgXFe0ezk65iu40oc3WY coverage.info; + - if [ "$CC" = "gcc" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then if [ $(( $TRAVIS_BUILD_NUMBER % 5 )) -eq 0 -o ${COVERITY_SCAN_ALWAYS_ON} = "y" ]; then make clean & eval "$COVERITY_SCAN_BUILD"; fi fi; diff --git a/cmake/celix_project/CelixProject.cmake b/cmake/celix_project/CelixProject.cmake index 1ee9369..1bfc8da 100644 --- a/cmake/celix_project/CelixProject.cmake +++ b/cmake/celix_project/CelixProject.cmake @@ -19,7 +19,7 @@ option(ENABLE_ADDRESS_SANITIZER "Enabled building with address sanitizer. Note f option(ENABLE_UNDEFINED_SANITIZER "Enabled building with undefined behavior sanitizer." OFF) if (ENABLE_ADDRESS_SANITIZER) - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") set(CMAKE_C_FLAGS "-fsanitize=address ${CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS "-fsanitize=address ${CMAKE_CXX_FLAGS}") else ()
