|
| 1 | +# ******************************************************************************* |
| 2 | +# Copyright (c) 2025 Contributors to the Eclipse Foundation |
| 3 | +# |
| 4 | +# See the NOTICE file(s) distributed with this work for additional |
| 5 | +# information regarding copyright ownership. |
| 6 | +# |
| 7 | +# This program and the accompanying materials are made available under the |
| 8 | +# terms of the Apache License Version 2.0 which is available at |
| 9 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# SPDX-License-Identifier: Apache-2.0 |
| 12 | +# ******************************************************************************* |
| 13 | +name: Release Verification |
| 14 | + |
| 15 | +on: |
| 16 | + release: |
| 17 | + types: [created] |
| 18 | + |
| 19 | +jobs: |
| 20 | + archive-report: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + permissions: |
| 23 | + contents: write # required to upload release assets |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout Repository |
| 27 | + uses: actions/checkout@v4.2.2 |
| 28 | + |
| 29 | + - name: Install lcov |
| 30 | + run: | |
| 31 | + sudo apt-get update |
| 32 | + sudo apt-get install -y lcov |
| 33 | +
|
| 34 | + - name: Setup Bazel with shared caching |
| 35 | + uses: bazel-contrib/setup-bazel@0.15.0 |
| 36 | + with: |
| 37 | + disk-cache: true |
| 38 | + repository-cache: true |
| 39 | + bazelisk-cache: true |
| 40 | + |
| 41 | + - name: Bazel info (discover paths) |
| 42 | + id: bazel-info |
| 43 | + run: | |
| 44 | + echo "BAZEL_OUTPUT_BASE=$(bazel info output_base)" >> $GITHUB_ENV |
| 45 | + echo "BAZEL_USER_ROOT=$(bazel info output_user_root)" >> $GITHUB_ENV |
| 46 | + echo "BAZEL_REPO_CACHE=$(bazel info repository_cache)" >> $GITHUB_ENV |
| 47 | + bazel info |
| 48 | +
|
| 49 | + - name: Cache Bazel output base |
| 50 | + uses: actions/cache@v4 |
| 51 | + with: |
| 52 | + path: | |
| 53 | + ${{ env.BAZEL_OUTPUT_BASE }}/action_cache |
| 54 | + ${{ env.BAZEL_OUTPUT_BASE }}/bazel-out |
| 55 | + ${{ env.BAZEL_OUTPUT_BASE }}/external |
| 56 | + ${{ env.BAZEL_OUTPUT_BASE }}/execroot |
| 57 | + key: bazel-ob-v2-${{ runner.os }}-${{ hashFiles('.bazelversion', 'MODULE.bazel', 'MODULE.bazel.lock', '**/*.bzl', 'Cargo.lock') }} |
| 58 | + restore-keys: | |
| 59 | + bazel-ob-v2-${{ runner.os }}- |
| 60 | +
|
| 61 | + - name: Build via Bazel |
| 62 | + run: | |
| 63 | + echo "Running: bazel build //..." |
| 64 | + bazel build //... |
| 65 | +
|
| 66 | + - name: Run Unit Tests via Bazel |
| 67 | + run: | |
| 68 | + echo "Running: bazel test //:unit_tests" |
| 69 | + bazel test //:unit_tests |
| 70 | +
|
| 71 | + - name: Run Unit Test with Coverage for Rust |
| 72 | + run: | |
| 73 | + # Run tests |
| 74 | + bazel coverage //:unit_tests \ |
| 75 | + --collect_code_coverage \ |
| 76 | + --combined_report=lcov \ |
| 77 | + --experimental_generate_llvm_lcov \ |
| 78 | + --nocache_test_results \ |
| 79 | + --nostamp |
| 80 | + # Generate HTML report |
| 81 | + genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat" \ |
| 82 | + -o=rust_coverage \ |
| 83 | + --show-details \ |
| 84 | + --legend \ |
| 85 | + --function-coverage \ |
| 86 | + --branch-coverage |
| 87 | +
|
| 88 | + - name: Create archive of test report |
| 89 | + run: | |
| 90 | + mkdir -p artifacts |
| 91 | + cp -r --parents bazel-testlogs/src/**/test.xml artifacts/ |
| 92 | + cp -r rust_coverage artifacts/ |
| 93 | + zip -r ${{ github.event.repository.name }}_coverage_report.zip artifacts/ |
| 94 | + shell: bash |
| 95 | + |
| 96 | + - name: Upload artifacts |
| 97 | + uses: actions/upload-artifact@v4 |
| 98 | + with: |
| 99 | + name: ${{ github.event.repository.name }}_coverage_report.zip |
| 100 | + path: ${{ github.event.repository.name }}_coverage_report.zip |
| 101 | + |
| 102 | + - name: Upload release asset (attach ZIP to GitHub Release) |
| 103 | + uses: softprops/action-gh-release@v2.5.0 |
| 104 | + with: |
| 105 | + files: ${{ github.event.repository.name }}_coverage_report.zip |
| 106 | + env: |
| 107 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments