ferrocene: build with compiler #805
Workflow file for this run
This file contains hidden or 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
| # ******************************************************************************* | |
| # 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: Check compilation and code | |
| on: | |
| pull_request: | |
| types: [opened, reopened, synchronize] | |
| push: | |
| branches: | |
| - main | |
| merge_group: | |
| types: [checks_requested] | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| cargo-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: 1.90.0 | |
| components: clippy, rustfmt | |
| - name: Cargo Clippy | |
| run: | | |
| cargo clippy --all-targets --all-features | |
| - name: Cargo Fmt | |
| run: | | |
| cargo fmt --check | |
| - name: Cargo Build | |
| run: | | |
| cargo build | |
| cargo-miri: | |
| runs-on: ubuntu-latest | |
| env: | |
| MIRIFLAGS: "-Zmiri-disable-isolation" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: nightly-2025-12-15 | |
| components: miri, rust-src | |
| - name: Install Clang | |
| run: | | |
| sudo apt update | |
| sudo apt install -y clang | |
| - name: Cargo Miri | |
| run: | | |
| cargo +nightly-2025-12-15 miri test | |
| cargo-coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: nightly-2025-12-15 | |
| components: llvm-tools-preview, rust-src | |
| - name: Install cargo-llvm-cov | |
| run: | | |
| cargo +nightly-2025-12-15 install cargo-llvm-cov --locked | |
| - name: Cargo llvm-cov | |
| run: | | |
| cargo +nightly-2025-12-15 llvm-cov --branch --tests --lib | |
| rust-bazel: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bazel with shared caching | |
| uses: bazel-contrib/setup-bazel@0.14.0 | |
| with: | |
| disk-cache: true | |
| repository-cache: true | |
| bazelisk-cache: true | |
| - name: Bazel Build | |
| run: | | |
| bazel build \ | |
| //src/rust/rust_kvs:rust_kvs \ | |
| //src/rust/rust_kvs_tool:kvs_tool | |
| - name: Bazel Unit Tests | |
| run: | | |
| bazel test //src/rust/rust_kvs:tests | |
| - name: Bazel Unit Test with Coverage | |
| run: | | |
| bazel coverage //src/rust/rust_kvs:tests \ | |
| --collect_code_coverage \ | |
| --combined_report=lcov \ | |
| --experimental_generate_llvm_lcov \ | |
| --nocache_test_results \ | |
| --nostamp | |
| - name: Install lcov | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y lcov | |
| - name: Extract Coverage for Rust Files | |
| run: | | |
| REPORT=$(find "$(bazel info output_path)" -type f -path '*/rust/*/coverage.dat' | head -n1) | |
| lcov \ | |
| --rc branch_coverage=1 \ | |
| --extract "$REPORT" '*.rs' -o "${REPORT}.rs" \ | |
| --output-file kvs_coverage.info | |
| cpp-bazel: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bazel with shared caching | |
| uses: bazel-contrib/setup-bazel@0.14.0 | |
| with: | |
| disk-cache: true | |
| repository-cache: true | |
| bazelisk-cache: true | |
| - name: Bazel Build | |
| run: bazel build --config=per-x86_64-linux //:kvs_cpp | |
| - name: Bazel Unit Test with Coverage | |
| run: | | |
| bazel coverage --config=per-x86_64-linux //:test_kvs_cpp \ | |
| --collect_code_coverage \ | |
| --combined_report=lcov \ | |
| --experimental_generate_llvm_lcov \ | |
| --nocache_test_results \ | |
| --nostamp | |
| - name: Install lcov | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y lcov | |
| - name: Extract Coverage for CPP Files | |
| run: | | |
| # ToDo: should work out of the box with bazel coverage (https://github.com/eclipse-score/toolchains_gcc/issues/21) | |
| # run test binary to generate coverage data (*.gcda files). Manually | |
| # since it is build already with the correct flags and the gcda ends | |
| # up in a proper location | |
| ./bazel-bin/src/cpp/tests/test_kvs_cpp | |
| # define some variables for easier usage | |
| BASE_DIR="$(pwd)" | |
| GCOV_TOOL="./bazel-persistency/external/score_toolchains_gcc++gcc+gcc_toolchain_gcc/bin/x86_64-unknown-linux-gnu-gcov" | |
| BIN_DIR="./bazel-bin/src/cpp/" | |
| OUT_FILE="lcov_coverage.info" | |
| # capture coverage info | |
| lcov --capture --directory "$BIN_DIR" --output-file "$OUT_FILE" --gcov-tool "$GCOV_TOOL" --base-directory "$BASE_DIR" --branch-coverage --ignore-errors mismatch --exclude "*/external/*" | |
| # display summary | |
| lcov --summary --rc branch_coverage=1 "$OUT_FILE" | |
| # generate html report (for local inspection if needed) | |
| # genhtml "$OUT_FILE" -o coverage_html --show-details --legend --function-coverage --branch-coverage | |
| rm ${OUT_FILE} | |
| - name: Bazel Benchmark | |
| run: bazel run --config=per-x86_64-linux -c opt //:bm_kvs_cpp |