Add optional GCC static analyzer support to CMake and Conan builds #4551
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Celix Ubuntu | |
| on: | |
| push: | |
| pull_request: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| env: | |
| CONAN_USER_HOME: "${{ github.workspace }}/release/" | |
| CONAN_USER_HOME_SHORT: "${{ github.workspace }}/release/short" | |
| CONAN_HOME: "${{ github.workspace }}/release/" | |
| CCACHE_DIR: "${{ github.workspace }}/.ccache" | |
| CCACHE_SLOPPINESS: include_file_ctime,include_file_mtime | |
| jobs: | |
| linux-build-conan: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| compiler: [ [gcc,g++], [clang,clang++] ] | |
| type: [ Debug, RelWithDebInfo ] | |
| timeout-minutes: 120 | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3.3.0 | |
| - name: Install build dependencies | |
| run: | | |
| sudo pip install -U conan==1.62.0 | |
| sudo apt-get install -yq --no-install-recommends ninja-build | |
| - name: Setup Conan Profile | |
| env: | |
| CC: ${{ matrix.compiler[0] }} | |
| CXX: ${{ matrix.compiler[1] }} | |
| run: | | |
| # build profile | |
| conan profile new release --detect | |
| conan profile update settings.build_type=Release release | |
| #Note no backwards compatibility for gcc5 needed, setting libcxx to c++11. | |
| conan profile update settings.compiler.libcxx=libstdc++11 release | |
| conan profile show release | |
| echo "[tool_requires]" >> `conan config home`/profiles/release | |
| echo "cmake/3.26.4" >> `conan config home`/profiles/release | |
| # host profile | |
| conan profile new default --detect | |
| conan profile update settings.build_type=${{ matrix.type }} default | |
| #Note no backwards compatibility for gcc5 needed, setting libcxx to c++11. | |
| conan profile update settings.compiler.libcxx=libstdc++11 default | |
| conan profile show default | |
| echo "[tool_requires]" >> `conan config home`/profiles/default | |
| echo "cmake/3.26.4" >> `conan config home`/profiles/default | |
| - name: Conan Cache | |
| id: cache-conan | |
| uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf #v4.2.2 | |
| env: | |
| cache-name: cache-conan2-modules | |
| with: | |
| path: ${{ env.CONAN_HOME }} | |
| key: ${{ runner.os }}-test-builder-${{ env.cache-name }}-${{ matrix.compiler[0] }}-${{ matrix.type }}-${{ hashFiles('conanfile.py') }} | |
| restore-keys: ${{ runner.os }}-test-builder-${{ env.cache-name }}-${{ matrix.compiler[0] }}-${{ matrix.type }}- | |
| - name: Prepare ccache timestamp | |
| id: ccache_cache_timestamp | |
| run: | | |
| echo timestamp=`date +"%Y-%m-%d-%H;%M;%S"` >> $GITHUB_OUTPUT | |
| - name: ccache Cache | |
| uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf #v4.2.2 | |
| with: | |
| path: ${{ env.CCACHE_DIR }} | |
| key: ${{ runner.os }}-test-ccache-${{ matrix.compiler[0] }}-${{ matrix.type }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }} | |
| restore-keys: | | |
| ${{ runner.os }}-test-ccache-${{ matrix.compiler[0] }}-${{ matrix.type }}- | |
| - name: Configure and install dependencies | |
| env: | |
| CC: ${{ matrix.compiler[0] }} | |
| CXX: ${{ matrix.compiler[1] }} | |
| CONAN_BUILD_OPTIONS: | | |
| -o celix:enable_testing=True | |
| -o celix:enable_benchmarking=True | |
| -o celix:enable_address_sanitizer=True | |
| -o celix:enable_undefined_sanitizer=True | |
| -o celix:build_all=True | |
| -o celix:enable_cmake_warning_tests=True | |
| -o celix:enable_testing_on_ci=True | |
| -o celix:framework_curlinit=False | |
| -o celix:enable_ccache=True | |
| run: | | |
| conan install . celix/ci -c tools.cmake.cmaketoolchain:generator=Ninja -pr:b release -pr:h default -if build ${CONAN_BUILD_OPTIONS} -b missing | |
| - name: Build | |
| env: | |
| CC: ${{ matrix.compiler[0] }} | |
| CXX: ${{ matrix.compiler[1] }} | |
| CONAN_CMAKE_GENERATOR: Ninja | |
| run: | | |
| conan build . -bf build | |
| - name: Test | |
| run: | | |
| cd build | |
| source conanrun.sh | |
| ctest --output-on-failure | |
| source deactivate_conanrun.sh | |
| linux-build-apt: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| type: [ Debug, RelWithDebInfo ] | |
| timeout-minutes: 120 | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3.3.0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -yq --no-install-recommends \ | |
| build-essential \ | |
| ninja-build \ | |
| curl \ | |
| uuid-dev \ | |
| libzip-dev \ | |
| libjansson-dev \ | |
| libcurl4-openssl-dev \ | |
| libbenchmark-dev \ | |
| default-jdk \ | |
| cmake \ | |
| libffi-dev \ | |
| libxml2-dev \ | |
| rapidjson-dev \ | |
| libavahi-compat-libdnssd-dev \ | |
| libcivetweb-dev \ | |
| civetweb \ | |
| ccache | |
| - name: Prepare ccache timestamp | |
| id: ccache_cache_timestamp | |
| run: | | |
| echo timestamp=`date +"%Y-%m-%d-%H;%M;%S"` >> $GITHUB_OUTPUT | |
| - name: ccache Cache | |
| uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf #v4.2.2 | |
| with: | |
| path: ${{ env.CCACHE_DIR }} | |
| key: ${{ runner.os }}-apt-test-ccache-gcc-${{ matrix.type }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }} | |
| restore-keys: | | |
| ${{ runner.os }}-apt-test-ccache-gcc-${{ matrix.type }}- | |
| - name: Build | |
| env: | |
| BUILD_OPTIONS: | | |
| -DBUILD_EXPERIMENTAL=ON | |
| -DENABLE_TESTING=ON | |
| -DENABLE_BENCHMARKING=ON | |
| -DRSA_JSON_RPC=ON | |
| -DRSA_REMOTE_SERVICE_ADMIN_SHM_V2=ON | |
| -DENABLE_TESTING_ON_CI=ON | |
| -DCMAKE_BUILD_TYPE=${{ matrix.type }} | |
| -DENABLE_CCACHE=ON | |
| -DCMAKE_POLICY_VERSION_MINIMUM=3.5 | |
| -DENABLE_GCC_ANALYZER=${{matrix.type == 'RelWithDebInfo' && 'ON' || 'OFF'}} | |
| -G Ninja | |
| run: | | |
| mkdir build install | |
| cd build | |
| cmake ${BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX=../install .. | |
| ninja & ninja install | |
| - name: Test | |
| run: | | |
| cd $GITHUB_WORKSPACE/build | |
| export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH:$(pwd)/utils:$(pwd)/framework:$(pwd)/dfi | |
| ctest --output-on-failure |