Add CI workflow for build and test - #7
Conversation
Set up CI workflow for building and testing the project using Bazel.
There was a problem hiding this comment.
Pull request overview
Adds a GitHub Actions CI workflow intended to build and run unit tests with Bazel on pushes and pull requests.
Changes:
- Introduces a new GitHub Actions workflow under
.github/workflows/. - Runs
bazel build //... --config=release. - Runs
bazel test //... --config=release.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| branches: [ "master" ] | ||
| pull_request: | ||
| branches: [ "master" ] | ||
|
|
There was a problem hiding this comment.
This workflow only runs for pushes/PRs on the master branch. If you want CI to validate PRs from any branch (common for feature branches), consider removing the branches filter under pull_request, and/or triggering pushes on the repository’s default branch (often main).
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| branches: [ "main" ] | |
| pull_request: | |
| - uses: actions/checkout@v4 | ||
| - uses: bazel-contrib/setup-bazel@0.14.0 |
There was a problem hiding this comment.
For supply-chain safety, consider pinning GitHub Actions (e.g., actions/checkout and bazel-contrib/setup-bazel) to a commit SHA instead of a mutable tag like @v4 / @0.14.0. This reduces the risk of an upstream tag being moved to unexpected code.
| - uses: actions/checkout@v4 | |
| - uses: bazel-contrib/setup-bazel@0.14.0 | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - uses: bazel-contrib/setup-bazel@4d953e67229547324f8a156392c767bdafa5df42 # 0.14.0 |
| - uses: actions/checkout@v4 | ||
| - uses: bazel-contrib/setup-bazel@0.14.0 | ||
| with: | ||
| # Avoid downloading Bazel every time. | ||
| bazelisk-cache: true | ||
| # Store build cache per workflow. | ||
| disk-cache: ${{ github.workflow }} | ||
| # Share repository cache between workflows. | ||
| repository-cache: true | ||
| - name: Build | ||
| run: bazel build //... --config=release | ||
| - name: Unit Tests | ||
| run: bazel test //... --config=release |
There was a problem hiding this comment.
steps: is not indented correctly. As written, the - uses: entries are siblings of steps rather than elements of the steps array, which will make the workflow YAML invalid (or the job have no steps). Indent each - ... under steps:.
| - uses: actions/checkout@v4 | |
| - uses: bazel-contrib/setup-bazel@0.14.0 | |
| with: | |
| # Avoid downloading Bazel every time. | |
| bazelisk-cache: true | |
| # Store build cache per workflow. | |
| disk-cache: ${{ github.workflow }} | |
| # Share repository cache between workflows. | |
| repository-cache: true | |
| - name: Build | |
| run: bazel build //... --config=release | |
| - name: Unit Tests | |
| run: bazel test //... --config=release | |
| - uses: actions/checkout@v4 | |
| - uses: bazel-contrib/setup-bazel@0.14.0 | |
| with: | |
| # Avoid downloading Bazel every time. | |
| bazelisk-cache: true | |
| # Store build cache per workflow. | |
| disk-cache: ${{ github.workflow }} | |
| # Share repository cache between workflows. | |
| repository-cache: true | |
| - name: Build | |
| run: bazel build //... --config=release | |
| - name: Unit Tests | |
| run: bazel test //... --config=release |
Set up CI workflow for building and testing the project using Bazel.