-
Notifications
You must be signed in to change notification settings - Fork 1
122 lines (102 loc) · 2.78 KB
/
test_bazel.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
---
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*
test_with_old_bazel:
runs-on: ubuntu-latest
steps:
- name: Bazel Setup
uses: jwlawson/actions-setup-bazel@v2
with:
bazel-version: "5.4.1"
- name: Checkout
uses: actions/checkout@v4
- name: Prepare
run: touch WORKSPACE
- name: Test
run: >
bazel test
--check_direct_dependencies=error
--experimental_enable_bzlmod
--ignore_dev_dependency
-- //...
coverage:
runs-on: ubuntu-latest
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