Skip to content

Commit

Permalink
Split it again
Browse files Browse the repository at this point in the history
  • Loading branch information
mikir committed Jul 17, 2024
1 parent 5a28286 commit ec9df99
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 118 deletions.
118 changes: 0 additions & 118 deletions .github/workflows/sonar_cloud.yml

This file was deleted.

68 changes: 68 additions & 0 deletions .github/workflows/sonar_cloud_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: SonarCloud Build

on:
push:
branches: [ "master", '*-ci' ]
pull_request:
branches: [ "master" ]
workflow_dispatch:

jobs:
build:
name: sonar_cloud_build
runs-on: ubuntu-latest
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # shallow clones should be disabled for a better relevancy of analysis
submodules: recursive

- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2

- name: Set up Java 8
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8

- name: Install dependencies
run: sudo apt-get install cmake doxygen graphviz

- name: Build Zserio compiler with C++ extension
run: |
scripts/build.sh core cpp zserio
scripts/release.sh -p zserio
- name: Build C++ runtime and C++ tests under build-wrapper
run: |
cat > build_and_test.sh << EOF
#!/bin/bash
scripts/build.sh cpp_rt-linux64-gcc && scripts/release.sh -p runtime_libs && \
scripts/test.sh cpp-linux64-gcc
EOF
chmod a+x build_and_test.sh
build-wrapper-linux-x86-64 --out-dir ${{env.BUILD_WRAPPER_OUT_DIR}} ./build_and_test.sh
env:
CMAKE_EXTRA_ARGS: "-DCMAKE_BUILD_TYPE=Release"
CMAKE_BUILD_OPTIONS: "-j4"

- name: Upload JSON compile commands artifact
# update when https://github.com/actions/upload-artifact/issues/543 is fixed
uses: actions/upload-artifact@v3
with:
name: compile-commands
path: ${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json

- name: Upload build test directory
# update when https://github.com/actions/upload-artifact/issues/543 is fixed
uses: actions/upload-artifact@v3
with:
name: build-test
path: build/test/**/*
54 changes: 54 additions & 0 deletions .github/workflows/sonar_cloud_run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: SonarCloud Run

on:
workflow_run:
workflows: [SonarCloud Build]
types: [completed]

jobs:
build:
name: sonar_cloud_run
runs-on: ubuntu-latest
env:
COMPILE_COMMANDS_DIR: build_compile_commands

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # shallow clones should be disabled for a better relevancy of analysis
submodules: recursive

# update when https://github.com/actions/download-artifact/issues/315 is fixed
- name: Download JSON compile commands artifact
uses: actions/download-artifact@v3
with:
name: compile-commands
path: "${{ env.COMPILE_COMMANDS_DIR }}"

# update when https://github.com/actions/download-artifact/issues/315 is fixed
- name: Download build test directory
uses: actions/download-artifact@v3
with:
name: build-test
path: "build/test"

- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2

- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner \
--define sonar.projectKey="ndsev_zserio" \
--define sonar.organization="ndsev" \
--define sonar.sourceEncoding="UTF-8" \
--define sonar.sources="compiler/extensions/cpp/runtime/src,build/test/cpp/linux64-gcc/release" \
--define sonar.inclusions="**/*.h,**/*.cpp" \
--define sonar.exclusions="**/CMakeFiles/**/*" \
--define sonar.tests="compiler/extensions/cpp/runtime/test,test" \
--define sonar.test.inclusions="compiler/**/test/**/*.h,compiler/**/test/**/.cpp,test/**/*.h,test/**/*.cpp" \
--define sonar.scm.exclusions.disabled="true" \
--define sonar.cfamily.compile-commands="${{ env.COMPILE_COMMANDS_DIR }}/compile_commands.json"

0 comments on commit ec9df99

Please sign in to comment.