From 8ea68ac180f3330c0c4d22c23d84cc98e11ecb1d Mon Sep 17 00:00:00 2001 From: badaix Date: Sat, 30 Dec 2023 14:23:15 +0100 Subject: [PATCH] Add static-analysis job --- .github/workflows/ci.yml | 56 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30a03d65..3f225bf1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,57 @@ env: BOOST_VERSION: 1_84_0 jobs: + static-analysis: + + strategy: + fail-fast: false + matrix: + tool: + - cppcheck + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + - name: print environment + run: env + - name: dependencies + run: sudo apt-get update && sudo apt-get install -yq libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libpulse-dev libavahi-client-dev avahi-daemon debhelper ccache expat cppcheck + - name: cache boost + id: cache-boost + uses: actions/cache@v3 + with: + path: boost_${{ env.BOOST_VERSION }} + key: boost-${{ env.BOOST_VERSION }} + enableCrossOsArchive: true + - name: get boost + if: steps.cache-boost.outputs.cache-hit != 'true' + run: | + wget https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION//_/.}/source/boost_${BOOST_VERSION}.tar.bz2 + tar xjf boost_${BOOST_VERSION}.tar.bz2 + - name: cache ccache + id: cache-ccache + uses: actions/cache@v3 + with: + # TODO: use environment variable $HOME/.ccache + path: /home/runner/.ccache + key: ${{ runner.os }}-${{ matrix.compiler }}-ccache-${{ github.sha }} + restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-ccache- + #- name: ccache dump config + # run: ccache -p + - name: configure + run: | + cmake -S . -B build \ + -DWERROR=ON -DBUILD_TESTS=ON \ + -DBOOST_ROOT=boost_${BOOST_VERSION} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE \ + -DCMAKE_CXX_FLAGS="-DCMAKE_CXX_FLAGS=-DJSON_HAS_CPP_14" + - name: analysis + run: cmake --build build --target ${{ matrix.tool }} + + linux: strategy: @@ -28,7 +79,6 @@ jobs: - gcc-11 - gcc-12 - gcc-13 - - cppcheck include: - compiler: clang-10 cc: clang-10 @@ -120,14 +170,10 @@ jobs: CC: ${{ matrix.cc }} CXX: ${{ matrix.cxx }} - name: build - if: matrix.compiler != 'cppcheck' env: # TODO: use environment variable $HOME/.ccache CCACHE_DIR: /home/runner/.ccache run: cmake --build build --parallel 3 --verbose - - name: cppcheck - if: matrix.compiler == 'cppcheck' - run: cmake --build build --target cppcheck macos: