By default, the
test task will also build all build-able targets,
so a typical configuration file does not use the
There are a few cases where a
build task can be useful:
- When the
--build_tests_onlyflag is passed to Bazel, then the
testtask will not build targets which aren't a dependency of any tests.
- Some test targets may be known to be broken. A
buildtask can be used to only build the tests, but not run them.
A simple configuration looks like:
Building specific targets
By default, Workflows builds all targets in the workspace, by running
bazel build //....
Specific targets may be selected with the
# All targets in project A
# But excluding this subpackage
We recommend that flags typically be checked into a
Workflows looks for a
.aspect/workflows/bazelrc file, and if it exists then Workflows will pass
--bazelrc=.aspect/workflows/bazelrc to every invocation of Bazel.
Flags can also be placed in the configuration file. They may go at the top-level and also under a task:
# Allow any actions to see the value of $HOME
# Allow tests to fetch private container images from Docker Hub
The exhaustive list of attributes for the
build task are found at