fix(tests): define src and tests sonar dirs #40
This file contains 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: github-action-on-push | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
jobs: | |
cog-check-job: | |
runs-on: ubuntu-latest | |
name: check conventional commit compliance | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Conventional commit check | |
uses: cocogitto/cocogitto-action@v3 | |
build: | |
runs-on: ubuntu-latest | |
needs: cog-check-job | |
env: | |
BUILD_WRAPPER_OUT_DIR: build_wrapper_out | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install umINK dependencies | |
run: | | |
sudo apt-get update && \ | |
sudo apt-get install -y \ | |
gperf \ | |
libmosquitto-dev \ | |
mosquitto-dev \ | |
libpaho-mqtt-dev \ | |
liblua5.3-dev \ | |
libjson-c-dev \ | |
libcmocka-dev \ | |
libasan5 && \ | |
sudo ln -s /usr/lib/x86_64-linux-gnu/pkgconfig/lua-5.3.pc \ | |
/usr/lib/x86_64-linux-gnu/pkgconfig/lua.pc | |
- name: Install sonar-scanner and build-wrapper | |
uses: SonarSource/sonarcloud-github-c-cpp@v2 | |
- name: Run build-wrapper | |
run: | | |
export ASAN_OPTIONS=verify_asan_link_order=0 | |
./autogen.sh | |
./configure --enable-mqtt \ | |
--enable-mosquitto-auth | |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make clean all check | |
- name: generate coverage data | |
run: | | |
mkdir coverage-dir | |
cd coverage-dir | |
find .. -name '*.o' | xargs gcov --preserve-paths | |
cd .. | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ | |
--define sonar.cfamily.gcov.reportsPath="coverage-dir" |