Skip to content

Move components into dedicated namespaces #639

Move components into dedicated namespaces

Move components into dedicated namespaces #639

Workflow file for this run

name: Build and test
on:
push:
branches:
- main
- develop
pull_request_target:
types:
- edited
- opened
- reopened
- synchronize
branches:
- main
- develop
- feature*
jobs:
build:
runs-on: ubuntu-22.04
permissions: read-all
container:
image: ghcr.io/aosedge/aos-core-build-base:latest
options: "--entrypoint /usr/bin/bash"
credentials:
username: ${{ github.actor }}
password: ${{ github.token }}
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory
steps:
# Apply solution to "HOME is overridden for containers" problem: https://github.com/actions/runner/issues/863
- name: Preserve $HOME set in the container
run: echo HOME=/root >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 0
submodules: "recursive"
- name: Install Build Wrapper
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v4
- name: Build using SonarQube Build Wrapper
run: |
mkdir build
conan profile detect --force
conan install ./conan/ --output-folder build --settings=build_type=Debug --options=with_poco=True --build=missing
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DWITH_TEST=ON -DWITH_COVERAGE=ON -G "Unix Makefiles" \
-DCMAKE_TOOLCHAIN_FILE=./conan_toolchain.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build ./build/ --config Debug --parallel
- name: Run Tests
run: |
(cd build && make coverage)
- name: Static analysis
run: |
cppcheck --enable=all --inline-suppr -I src --std=c++17 --error-exitcode=1 \
--suppressions-list=./suppressions.txt -I external/aos_core_common_cpp/include src
- name: Upload codecov report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/coverage.total
- name: SonarCloud Scan on push
if: github.event_name == 'push'
uses: SonarSource/sonarqube-scan-action@v4
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
--define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
--define sonar.coverageReportPaths=build/coverage_sonarqube.xml
- name: SonarCloud Scan on pull request
if: github.event_name == 'pull_request_target'
uses: SonarSource/sonarqube-scan-action@v4
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectBaseDir: "."
args: >
--define sonar.scm.revision=${{ github.event.pull_request.head.sha }}
--define sonar.pullrequest.key=${{ github.event.pull_request.number }}
--define sonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
--define sonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
--define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
--define sonar.coverageReportPaths=build/coverage_sonarqube.xml