diff --git a/.bazelrc b/.bazelrc index 89149e564..677dad730 100644 --- a/.bazelrc +++ b/.bazelrc @@ -29,12 +29,19 @@ build --experimental_retain_test_configuration_across_testonly #https://github.c # * The credentials for this account stored in your ~/.netrc (machine qnx.com) # * A license stored under `/opt/score_qnx/license/licenses` common:qnx_x86_64 --host_platform=@score_bazel_platforms//:x86_64-linux -common:qnx_x86_64 --platforms=@score_bazel_platforms//:x86_64-qnx +common:qnx_x86_64 --platforms=@score_bazel_platforms//:x86_64-qnx8_0 common:qnx_x86_64 --extra_toolchains=@toolchains_qnx_ifs//:ifs_x86_64 common:qnx_x86_64 --extra_toolchains=@toolchains_qnx_qcc//:qcc_x86_64 common:qnx_x86_64 --credential_helper=*.qnx.com=%workspace%/third_party/qnx_credential_helper.py common:qnx_x86_64 --sandbox_writable_path=/var/tmp +common:qnx_arm64 --host_platform=@score_bazel_platforms//:x86_64-linux +common:qnx_arm64 --platforms=@score_bazel_platforms//:arm64-qnx8_0 +common:qnx_arm64 --extra_toolchains=@toolchains_qnx_ifs//:ifs_aarch64 +common:qnx_arm64 --extra_toolchains=@toolchains_qnx_qcc//:qcc_aarch64 +common:qnx_arm64 --credential_helper=*.qnx.com=%workspace%/third_party/qnx_credential_helper.py +common:qnx_arm64 --sandbox_writable_path=/var/tmp + # unshare /dev/shm and /tmp test --sandbox_tmpfs_path=/dev/shm test --sandbox_tmpfs_path=/tmp diff --git a/.github/workflows/address_undefined_behavior_leak_sanitizer.yml b/.github/workflows/address_undefined_behavior_leak_sanitizer.yml index a7784992f..662dd2ae6 100644 --- a/.github/workflows/address_undefined_behavior_leak_sanitizer.yml +++ b/.github/workflows/address_undefined_behavior_leak_sanitizer.yml @@ -21,21 +21,22 @@ on: types: [opened, reopened, synchronize] merge_group: types: [checks_requested] + release: + types: [created] jobs: build_and_test_asan_ubsan_lsan: # Starting with Ubuntu 24.04 apparmor breaks Bazels linux-sandbox: https://github.com/bazelbuild/bazel/issues/24081 runs-on: ubuntu-22.04 steps: - - name: Install non-hermetic dependencies # Fixes https://github.com/bazel-contrib/toolchains_llvm/issues/403 - run: | - sudo apt-get install -y libtinfo5 + - name: Checkout repository + uses: actions/checkout@v4.2.2 + - name: Free Disk Space (Ubuntu) + uses: ./actions/free_disk_space - uses: bazel-contrib/setup-bazel@0.15.0 with: bazelisk-cache: true disk-cache: ${{ github.workflow }} repository-cache: true - - name: Checkout repository - uses: actions/checkout@v4.2.2 - name: Bazel test communication targets with address and UB and leak sanitizer run: | bazel test --config=asan_ubsan_lsan //... --build_tests_only diff --git a/.github/workflows/build_and_test_host.yml b/.github/workflows/build_and_test_host.yml index 87a356deb..1f951ce6d 100644 --- a/.github/workflows/build_and_test_host.yml +++ b/.github/workflows/build_and_test_host.yml @@ -20,30 +20,26 @@ on: types: [opened, reopened, synchronize] merge_group: types: [checks_requested] + release: + types: [created] jobs: build_and_test_host: strategy: + fail-fast: false matrix: toolchain: ["@llvm_toolchain//:cc-toolchain-x86_64-linux", "@gcc_toolchain//:host_gcc_12"] - include: - - toolchain: "@llvm_toolchain//:cc-toolchain-x86_64-linux" - non_hermetic_dependencies: - - "libtinfo5" # Fixes https://github.com/bazel-contrib/toolchains_llvm/issues/403 # Starting with Ubuntu 24.04 apparmor breaks Bazels linux-sandbox: https://github.com/bazelbuild/bazel/issues/24081 runs-on: ubuntu-22.04 steps: - - name: Install non-hermetic dependencies - if: ${{ matrix.non_hermetic_dependencies }} - run: | - sudo apt-get update && true - sudo apt install -y ${{ join(matrix.non_hermetic_dependencies, ' ') }} + - name: Checkout repository + uses: actions/checkout@v4.2.2 + - name: Free Disk Space (Ubuntu) + uses: ./actions/free_disk_space - uses: bazel-contrib/setup-bazel@0.15.0 with: bazelisk-cache: true disk-cache: ${{ github.workflow }}-${{ matrix.toolchain }} repository-cache: true - - name: Checkout repository - uses: actions/checkout@v4.2.2 - name: Bazel build communication targets run: | bazel build --extra_toolchains=${{ matrix.toolchain }} //... diff --git a/.github/workflows/build_and_test_qnx.yml b/.github/workflows/build_and_test_qnx.yml new file mode 100644 index 000000000..01f6bf1aa --- /dev/null +++ b/.github/workflows/build_and_test_qnx.yml @@ -0,0 +1,82 @@ +# ******************************************************************************* +# Copyright (c) 2024 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +# Workflow configuration for S-CORE CI - Bazel Build & Test communication module for target platforms +# This workflow runs Bazel build and test for QNX when triggered by specific pull request events. + +name: Bazel Build & Test communication module (target-platforms) +on: + pull_request: + types: [opened, reopened, synchronize] + merge_group: + types: [checks_requested] + release: + types: [created] +env: + LICENSE_DIR: "/opt/score_qnx/license" +jobs: + build_and_test_qnx: + strategy: + fail-fast: false + matrix: + bazel-config: ["qnx_x86_64", "qnx_arm64"] + include: + - bazel-config: "qnx_x86_64" + incompatible_targets: + - "-//score/mw/com/requirements/..." # Uninvestigated problem + - "-//score/mw/com/performance_benchmarks/..." # Uninvestigated problem + - "-//score/mw/com/example/..." # Missing Rust toolchain support for QNX8 on x86_64 + - "-//score/mw/com/impl/plumbing:sample_ptr_rs" # Missing Rust toolchain support for QNX8 on x86_64 + - "-//score/mw/com/impl/rust/..." # Missing Rust toolchain support for QNX8 on x86_64 + - bazel-config: "qnx_arm64" + incompatible_targets: + - "-//score/mw/com/requirements/..." # Uninvestigated problem + - "-//score/mw/com/performance_benchmarks/..." # Uninvestigated problem + - "-//score/mw/com/example/..." # Broken Rust toolchain for QNX8 on arm64 + - "-//score/mw/com/impl/plumbing:sample_ptr_rs" # Broken Rust toolchain for QNX8 on arm64 + - "-//score/mw/com/impl/rust/..." # Broken Rust toolchain for QNX8 on arm64 + # Starting with Ubuntu 24.04 apparmor breaks Bazels linux-sandbox: https://github.com/bazelbuild/bazel/issues/24081 + runs-on: ubuntu-22.04 + permissions: + contents: read + pull-requests: read + steps: + - name: Checkout repository + uses: actions/checkout@v4.2.2 + - name: Free Disk Space (Ubuntu) + uses: ./actions/free_disk_space + - name: Setup Bazel + uses: bazel-contrib/setup-bazel@0.15.0 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }}-${{ matrix.bazel-config }} + repository-cache: true + - name: Setup QNX License + if: ${{ contains(matrix.bazel-config, 'qnx') }} + env: + SCORE_QNX_LICENSE: ${{ secrets.SCORE_QNX_LICENSE }} + run: | + set -euo pipefail + + sudo mkdir -p "${{ env.LICENSE_DIR }}" + echo "${SCORE_QNX_LICENSE}" | base64 --decode | sudo tee "${{ env.LICENSE_DIR }}/licenses" >/dev/null + - name: Build targets + env: + SCORE_QNX_USER: ${{ secrets.SCORE_QNX_USER }} + SCORE_QNX_PASSWORD: ${{ secrets.SCORE_QNX_PASSWORD }} + run: | + bazel build --config ${{ matrix.bazel-config }} -- //score/... ${{ join(matrix.incompatible_targets, ' ') }} + - name: Cleanup QNX License + if: ${{ contains(matrix.bazel-config, 'qnx') && !cancelled() }} + run: sudo rm -rf ${{ env.LICENSE_DIR }} + # TODO Run tests on QNX QEMU diff --git a/.github/workflows/release_coverage_report.yml b/.github/workflows/release_coverage_report.yml new file mode 100644 index 000000000..ff83581cb --- /dev/null +++ b/.github/workflows/release_coverage_report.yml @@ -0,0 +1,76 @@ +# ******************************************************************************* +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* +name: Coverage Report + +on: + release: + types: [ created ] + +jobs: + coverage-report: + runs-on: ubuntu-22.04 + permissions: + contents: write # required to upload release assets + + steps: + - name: Checkout Repository + uses: actions/checkout@v4.2.2 + + - name: Free Disk Space (Ubuntu) + uses: ./actions/free_disk_space + + - name: Install lcov + run: | + sudo apt-get update + sudo apt-get install -y lcov + + - name: Setup Bazel with shared caching + uses: bazel-contrib/setup-bazel@0.15.0 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + + - name: Run Unit Test with Coverage for C++ + run: | + bazel coverage //... --build_tests_only + + - name: Generate HTML Coverage Report + run: | + genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat" \ + -o=cpp_coverage \ + --show-details \ + --legend \ + --function-coverage \ + --branch-coverage + + - name: Create archive of test report + run: | + mkdir -p artifacts + find bazel-testlogs/score/ -name 'test.xml' -print0 | xargs -0 -I{} cp --parents {} artifacts/ + cp -r cpp_coverage artifacts/ + zip -r ${{ github.event.repository.name }}_coverage_report.zip artifacts/ + shell: bash + + - name: Upload coverage artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ github.event.repository.name }}_coverage_report.zip + path: ${{ github.event.repository.name }}_coverage_report.zip + + - name: Upload release asset (attach ZIP to GitHub Release) + uses: softprops/action-gh-release@v2.5.0 + with: + files: ${{ github.event.repository.name }}_coverage_report.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/thread_sanitizer.yml b/.github/workflows/thread_sanitizer.yml index f20d8313b..f7af16b6b 100644 --- a/.github/workflows/thread_sanitizer.yml +++ b/.github/workflows/thread_sanitizer.yml @@ -20,21 +20,22 @@ on: types: [opened, reopened, synchronize] merge_group: types: [checks_requested] + release: + types: [created] jobs: build_and_test_tsan: # Starting with Ubuntu 24.04 apparmor breaks Bazels linux-sandbox: https://github.com/bazelbuild/bazel/issues/24081 runs-on: ubuntu-22.04 steps: - - name: Install non-hermetic dependencies # Fixes https://github.com/bazel-contrib/toolchains_llvm/issues/403 - run: | - sudo apt-get install -y libtinfo5 + - name: Checkout repository + uses: actions/checkout@v4.2.2 + - name: Free Disk Space (Ubuntu) + uses: ./actions/free_disk_space - uses: bazel-contrib/setup-bazel@0.15.0 with: bazelisk-cache: true disk-cache: ${{ github.workflow }} repository-cache: true - - name: Checkout repository - uses: actions/checkout@v4.2.2 - name: Bazel test communication targets with thread sanitizer run: | bazel test --config=tsan //... --build_tests_only diff --git a/MODULE.bazel b/MODULE.bazel index cd6dc2f2c..00026fa18 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -75,7 +75,7 @@ llvm.toolchain( link_libs = {"": [ "-lrt", ]}, - llvm_version = "16.0.0", + llvm_version = "19.1.0", stdlib = {"": "dynamic-stdc++"}, ) use_repo(llvm, "llvm_toolchain") @@ -120,12 +120,7 @@ download_archive( bazel_dep(name = "nlohmann_json", version = "3.11.3") bazel_dep(name = "bazel_skylib", version = "1.8.1") bazel_dep(name = "rules_doxygen", version = "2.5.0") -bazel_dep(name = "score_baselibs", version = "0.2.0") -git_override( - module_name = "score_baselibs", - commit = "c500d9a42c1af52fed78c6d38c780ade4d49a2b6", - remote = "https://github.com/eclipse-score/baselibs.git", -) +bazel_dep(name = "score_baselibs", version = "0.2.2") # Doxygen extension for documentation generation doxygen_extension = use_extension("@rules_doxygen//:extensions.bzl", "doxygen_extension") @@ -167,7 +162,7 @@ pip.parse( ) use_repo(pip, "lobster_dependencies") -bazel_dep(name = "score_toolchains_qnx", version = "0.0.5", dev_dependency = True) +bazel_dep(name = "score_toolchains_qnx", version = "0.0.6", dev_dependency = True) toolchains_qnx = use_extension( "@score_toolchains_qnx//:extensions.bzl", diff --git a/actions/free_disk_space/action.yml b/actions/free_disk_space/action.yml new file mode 100644 index 000000000..cc6aff23c --- /dev/null +++ b/actions/free_disk_space/action.yml @@ -0,0 +1,32 @@ +# ******************************************************************************* +# Copyright (c) 2024 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +name: "Free Disk Space" +description: "Configures and calls endersonmenezes/free-disk-space to free disk space" + +branding: + icon: command + color: gray-dark + +runs: + using: composite + steps: + - name: Free Disk Space (Ubuntu) + uses: endersonmenezes/free-disk-space@v3 + with: + remove_android: true + remove_dotnet: true + remove_haskell: true + remove_tool_cache: true + remove_swap: true + rm_cmd: "rmz"