Enable CI tests to fail when test commands fail #2493
Workflow file for this run
This file contains hidden or 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
| # SPDX-FileCopyrightText: 2020 VMware, Inc. | |
| # | |
| # SPDX-License-Identifier: Apache-2.0 | |
| name: "Test Bazel Build" | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| schedule: | |
| - cron: "0 0 * * *" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| BAZEL: bazelisk-linux-amd64 | |
| BUILDIFIER: buildifier-linux-amd64 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - name: Mount bazel cache | |
| uses: actions/cache@v6 | |
| with: | |
| # See https://docs.bazel.build/versions/master/output_directories.html | |
| path: "~/.cache/bazel" | |
| # Create a new cache entry whenever Bazel files change. | |
| # See https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows | |
| key: bazel-${{ runner.os }}-build-${{ hashFiles('**/*.bzl', '**/*.bazel') }} | |
| restore-keys: | | |
| bazel-${{ runner.os }}-build- | |
| - name: Install Buildifier | |
| run: | | |
| curl -LO "https://github.com/bazelbuild/buildtools/releases/download/v8.5.1/$BUILDIFIER" | |
| chmod +x $BUILDIFIER | |
| sudo mv $BUILDIFIER /usr/local/bin/buildifier | |
| - name: Run Buildifier | |
| run: | | |
| BZL_FILES=$(git ls-files | grep -E 'BUILD.*|\.bzl$|\.bazel$') | |
| if ! buildifier --mode=check $BZL_FILES; then | |
| echo "::error::Buildifier formatting issues found." | |
| echo "::group::Buildifier Diff" | |
| buildifier --mode=diff $BZL_FILES | |
| echo "::endgroup::" | |
| exit 1 | |
| else | |
| echo "All files are formatted correctly." | |
| fi | |
| - name: Install bazelisk | |
| run: | | |
| curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.29.0/$BAZEL" | |
| chmod +x $BAZEL | |
| sudo mv $BAZEL /usr/local/bin/bazel | |
| - name: Build and run tests | |
| run: bazel test //proto/tests:pi_proto_tests //proto/tests:pi_proto_server_tests |