| # 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-latest |
| 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-10 \ |
| 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-latest |
| 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-10 \ |
| 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-latest |
| 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-10 \ |
| 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 |
| fuzzer_run_tests_java: |
| name: Brief fuzz test runs (Java) |
| runs-on: ubuntu-latest |
| 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-10 |
| - 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-latest |
| 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-10 |
| - 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-latest |
| 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/... |