format #117
This file contains 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
--- | |
name: Bazel | |
on: [push, pull_request] | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
name: ${{ matrix.platform }} | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Cache Setup | |
uses: actions/cache@v4 | |
id: cache-bazel | |
with: | |
path: ~/.cache/bazel | |
key: ${{ runner.os }}-bazel | |
- name: Bazel Setup | |
uses: jwlawson/actions-setup-bazel@v2 | |
with: | |
bazel-version: 'latest' | |
- name: Bazel Version | |
run: bazel --version | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build | |
run: bazel build --disk_cache ~/.cache/bazel //... | |
- name: Test | |
run: bazel test --disk_cache ~/.cache/bazel --test_timeout 10 //... | |
- name: Upload Test Results | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: Test Results (${{ matrix.platform }}) | |
path: | | |
bazel-testlogs*/**/test.log | |
bazel-bin*/example/* | |
bazel-bin*/src/* | |
!bazel-bin*/**/_objs/ | |
!bazel-bin*/**/*.cppmap | |
!bazel-bin*/**/*.params | |
!bazel-bin*/**/*.runfiles* | |
coverage: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Cache Setup | |
uses: actions/cache@v4 | |
id: cache-bazel | |
with: | |
path: ~/.cache/bazel | |
key: ${{ runner.os }}-bazel | |
- name: Bazel Setup | |
uses: jwlawson/actions-setup-bazel@v2 | |
with: | |
bazel-version: 'latest' | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build | |
run: > | |
bazel build | |
--disk_cache ~/.cache/bazel | |
--collect_code_coverage | |
--instrument_test_targets | |
--instrumentation_filter="^//..." | |
-- | |
//... | |
- name: Coverage | |
run: > | |
bazel coverage | |
--disk_cache ~/.cache/bazel | |
--instrument_test_targets | |
--instrumentation_filter="^//..." | |
--combined_report=lcov | |
-- | |
//... | |
- name: Strip Branch Coverage | |
# Bazel 7 generates branch coverage, but we prefer line coverage reports. | |
run: sed -i '/^BR/d' bazel-out/_coverage/_coverage_report.dat | |
- name: Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: bazel-out/_coverage/_coverage_report.dat |