From 7f009a5adffeccdd80f383a2247419205b9ca897 Mon Sep 17 00:00:00 2001 From: Mykhailo Lohvynenko Date: Thu, 5 Mar 2026 14:43:35 +0200 Subject: [PATCH 1/3] build: add cmake configure step to linting compile_commands.json is generated during cmake configure step, so it should be run before cppcheck. This patch makes it possible to execute lint step without building the project, which fixes the issue with linting on CI. Signed-off-by: Mykhailo Lohvynenko Reviewed-by: Mykola Kobets Reviewed-by: Oleksandr Grytsov Reviewed-by: Mykola Solianko --- build.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 57437d050..de607cc78 100755 --- a/build.sh +++ b/build.sh @@ -55,7 +55,9 @@ conan_setup() { conan install ./conan/ --output-folder build --settings=build_type="$ARG_BUILD_TYPE" --build=missing } -build_project() { +cmake_configure() { + conan_setup + print_next_step "Run cmake configure" cmake -S . -B build \ @@ -68,6 +70,10 @@ build_project() { -DWITH_COVERAGE=ON \ -DWITH_MBEDTLS=ON \ -DWITH_OPENSSL=ON +} + +build_project() { + cmake_configure if [ "$ARG_CI_FLAG" == "true" ]; then print_next_step "Run build-wrapper and build (CI mode)" @@ -118,7 +124,6 @@ build_target() { clean_build fi - conan_setup build_project } @@ -141,6 +146,8 @@ run_coverage() { } run_lint() { + cmake_configure + print_next_step "Run static analysis (cppcheck)" cppcheck --enable=all --inline-suppr --std=c++17 --error-exitcode=1 \ From c41554f40d0f35f20bd687b180fd1367f924e27f Mon Sep 17 00:00:00 2001 From: Mykhailo Lohvynenko Date: Tue, 10 Mar 2026 13:50:33 +0200 Subject: [PATCH 2/3] ci: split build and test workflow into separate workflows Signed-off-by: Mykhailo Lohvynenko Reviewed-by: Mykola Kobets Reviewed-by: Oleksandr Grytsov Reviewed-by: Mykola Solianko --- .github/workflows/build-release.yaml | 44 ++++++++++++++++++++++++++++ .github/workflows/build-test.yaml | 20 ++++--------- .github/workflows/lint.yaml | 44 ++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/build-release.yaml create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml new file mode 100644 index 000000000..445742aa0 --- /dev/null +++ b/.github/workflows/build-release.yaml @@ -0,0 +1,44 @@ +name: Build (Release) + +on: + push: + branches: + - main + - develop + - feature* + - release* + + pull_request: + types: + - edited + - opened + - reopened + - synchronize + + branches: + - main + - develop + - feature* + - release* + +jobs: + build-release: + name: Build (Release) + runs-on: ubuntu-22.04 + permissions: read-all + container: + image: ghcr.io/aosedge/aos-core-build:latest + options: "--entrypoint /usr/bin/bash" + credentials: + username: ${{ github.actor }} + password: ${{ github.token }} + + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Build + run: | + ./build.sh build --build-type Release diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index f62370bde..f2ac69c37 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -1,4 +1,4 @@ -name: Build and test +name: Build (Debug) and test on: push: @@ -36,22 +36,14 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} fetch-depth: 0 - - name: Static analysis - run: | - ./build.sh lint - - name: Install build wrapper - uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6 - - - name: Build (Release) - run: | - ./build.sh build --build-type Release + uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v7 - name: Build (Debug) run: | @@ -62,14 +54,14 @@ jobs: ./build.sh coverage - name: Upload codecov report - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./build/coverage.total - name: SonarQube analysis (on push) if: github.event_name == 'push' - uses: SonarSource/sonarqube-scan-action@v6 + uses: SonarSource/sonarqube-scan-action@v7 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} @@ -80,7 +72,7 @@ jobs: - name: SonarQube analysis (on pull request) if: github.event_name == 'pull_request_target' - uses: SonarSource/sonarqube-scan-action@v6 + uses: SonarSource/sonarqube-scan-action@v7 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 000000000..2672e7ca4 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,44 @@ +name: Lint + +on: + push: + branches: + - main + - develop + - feature* + - release* + + pull_request: + types: + - edited + - opened + - reopened + - synchronize + + branches: + - main + - develop + - feature* + - release* + +jobs: + lint: + name: Lint + runs-on: ubuntu-22.04 + permissions: read-all + container: + image: ghcr.io/aosedge/aos-core-build:latest + options: "--entrypoint /usr/bin/bash" + credentials: + username: ${{ github.actor }} + password: ${{ github.token }} + + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Static analysis + run: | + ./build.sh lint From 612f613b53058358da262574f7711fcc48587e64 Mon Sep 17 00:00:00 2001 From: Mykhailo Lohvynenko Date: Tue, 10 Mar 2026 13:52:11 +0200 Subject: [PATCH 3/3] ci: set checkout action version to v6 Signed-off-by: Mykhailo Lohvynenko Reviewed-by: Mykola Kobets Reviewed-by: Oleksandr Grytsov Reviewed-by: Mykola Solianko --- .github/workflows/check-format.yaml | 2 +- .github/workflows/docker-build.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-format.yaml b/.github/workflows/check-format.yaml index 62b8e604e..f6ad6298f 100644 --- a/.github/workflows/check-format.yaml +++ b/.github/workflows/check-format.yaml @@ -18,7 +18,7 @@ jobs: name: Formatting Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 743b3834d..cd2a7cab0 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Log in to github container registry uses: docker/login-action@v3