-
Notifications
You must be signed in to change notification settings - Fork 20
191 lines (188 loc) · 6.43 KB
/
bazel_test.yml
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Bazel Test
on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
env:
# Run daily CI checks against a very recent Bazel commit, but use the version
# pinned in .bazelrc for regular PR checks.
# This is a hacky workaround for GitHub Action's lack of inline conditionals.
# It is important that the value in the true case is not the empty string,
# see:
# https://github.com/actions/runner/issues/409#issuecomment-1013325196
USE_BAZEL_VERSION: ${{ github.event.schedule != '' && 'last_green' || '' }}
jobs:
unit_tests:
name: All unit tests
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -yq \
clang \
libunwind-dev \
libblocksruntime-dev
- name: Run unit tests
run: |
bazel test --test_tag_filters=-fuzz-test --build_tests_only //...
- name: Run Address Sanitizer tests
run: |
bazel test --test_tag_filters=-fuzz-test --build_tests_only --config=asan //...
fuzzer_run_tests:
name: Brief fuzz test runs (C++)
runs-on: ubuntu-20.04
timeout-minutes: 30
strategy:
matrix:
config: ["asan-libfuzzer", "msan-libfuzzer", "asan-honggfuzz"]
target: ["//examples:empty_fuzz_test_run", "//examples:re2_fuzz_test_run"]
exclude:
# MSAN currently fails on the RE2 target.
- config: "msan-libfuzzer"
target: "//examples:re2_fuzz_test_run"
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -yq \
clang \
libunwind-dev \
libblocksruntime-dev
- name: Run smoke test
run: |
bazel run ${{ matrix.target }} --config=${{ matrix.config }} -- --clean --timeout_secs=5
regression_tests:
name: Regression tests (C++)
runs-on: ubuntu-20.04
timeout-minutes: 30
strategy:
matrix:
config: ["asan-replay", "asan-libfuzzer", "asan-honggfuzz"]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -yq \
clang \
libunwind-dev \
libblocksruntime-dev
- name: Run regression tests
run: |
bazel test --verbose_failures --test_output=all \
--build_tag_filters=fuzz-test --config=${{ matrix.config }} \
//examples:all
coverage:
name: Coverage gathering (C++)
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -yq \
clang \
llvm \
libunwind-dev \
libblocksruntime-dev
- name: Gather coverage
run: |
bazel coverage //examples:re2_fuzz_test
- name: Check coverage report
run: |
grep "SF:examples/re2_fuzz_test.cc" bazel-out/_coverage/_coverage_report.dat
fuzzer_run_tests_java:
name: Brief fuzz test runs (Java)
runs-on: ubuntu-20.04
timeout-minutes: 30
strategy:
matrix:
config: ["jazzer", "asan-jazzer"]
target: ["//examples/java:EmptyFuzzTest_run"]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -yq clang
- name: Run smoke test
run: |
bazel run ${{ matrix.target }} --config=${{ matrix.config }} -- --clean --timeout_secs=5
regression_tests_java:
name: Regression tests (Java)
runs-on: ubuntu-20.04
timeout-minutes: 30
strategy:
matrix:
config: ["jazzer", "asan-jazzer"]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -yq clang
- name: Run regression tests
run: |
bazel test --verbose_failures --test_output=all \
--build_tag_filters=fuzz-test --config=${{ matrix.config }} \
//examples/java/...
regression_tests_gcc:
name: Regression tests (GCC)
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Run regression tests with GCC
run: |
bazel test --action_env=CC=gcc --action_env=CXX=g++ \
--verbose_failures --test_output=all \
//examples/...
regression_tests_mac:
name: Regression tests (macOS)
runs-on: macos-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Run regression tests on macOS
run: |
bazel test --verbose_failures --test_output=all //examples/...
bzlmod_examples_libfuzzer:
name: Bzlmod examples (libFuzzer)
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Run regression tests on macOS
run: |
cd examples/bzlmod
bazel test --verbose_failures --test_output=all --@my_rules_fuzzing//fuzzing:cc_engine=@my_rules_fuzzing//fuzzing/engines:libfuzzer //...
bzlmod_examples_replay:
name: Bzlmod examples (replay)
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Run regression tests on macOS
run: |
cd examples/bzlmod
bazel test --verbose_failures --test_output=all --@my_rules_fuzzing//fuzzing:cc_engine=@my_rules_fuzzing//fuzzing/engines:replay //...