diff --git a/.bazelrc b/.bazelrc index caf256cf64625814d29734cc65144cd5e24d06f7..d394b1db6df8022855b2cba23ee421e93cc78b37 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,3 +1,6 @@ +# Enable `bzlmod` +common --enable_bzlmod + # Build cache build --experimental_guard_against_concurrent_changes @@ -10,5 +13,8 @@ build --nolegacy_external_runfiles # Avoid building all targets when testing test --build_tests_only +# Print relative paths where possible to reduce noise +common --attempt_to_print_relative_paths + # User-specific .bazelrc try-import %workspace%/.bazelrc.user diff --git a/.bazelrc.ci b/.bazelrc.ci index f7e08f12d92b5d1df101a98d2ed50a4beb8f0fb0..045e1ab1e0d57d974076bb974db10cb89536a112 100644 --- a/.bazelrc.ci +++ b/.bazelrc.ci @@ -29,5 +29,36 @@ test --test_output=errors test --test_verbose_timeout_warnings # These locations are cached on the CI -build --disk_cache=${CI_PROJECT_DIR}/.cache/bazel/disk -build --repository_cache=${CI_PROJECT_DIR}/.cache/bazel/repo +build:local --disk_cache=${CI_PROJECT_DIR}/.cache/bazel/disk +build:local --repository_cache=${CI_PROJECT_DIR}/.cache/bazel/repo + +# Use remote cache/execution for our builds +build:remote --remote_executor=${CI_REMOTE_EXECUTOR} +build:remote --remote_cache=${CI_REMOTE_CACHE} +build:remote --remote_timeout=3600 +build:remote --remote_header=${CI_REMOTE_HEADER} +build:remote --experimental_remote_cache_compression +build:remote --jobs=${CI_REMOTE_JOBS} + +# Upload results to the Build Event Service +build:remote --bes_results_url=${CI_BES_RESULTS_URL} +build:remote --bes_backend=${CI_BES_BACKEND} + +# Add build metadata +build:remote --build_metadata=REPO_URL=${CI_PROJECT_URL} +build:remote --build_metadata=BRANCH_NAME=${CI_COMMIT_REF_NAME} +build:remote --build_metadata=COMMIT_SHA=${CI_COMMIT_SHA} +build:remote --build_metadata=HOST=${CI_SERVER_HOST} +build:remote --build_metadata=ROLE=CI +build:remote --build_metadata=USER=gitlab-ci + +# Provide detailed timing information to the remote executor +build:remote --noslim_profile +build:remote --experimental_profile_include_target_label +build:remote --experimental_profile_include_primary_output + +# Eliminate duplicate references in the Build Event Stream +build:remote --nolegacy_important_outputs + +# TODO: remove this when `bazel/ape` binaries work on remote execution `arm64` instances +build:remote --host_platform=@toolchain_utils//toolchain/platform:amd64-linux-gnu diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 27e708d860562aab2f657dfe53ad4deb6fc60d58..33095a53bd36b09cb533a8c54a8d407bd845370b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,19 @@ include: - - component: "${CI_SERVER_HOST}/ci/component/bazelisk/bazelisk@v1.0.0-beta.2" + - component: "${CI_SERVER_HOST}/ci/component/bazelisk/bazelisk@v1.0.0-beta.3" + inputs: + variables: | + CI_PROJECT_DIR + CI_PROJECT_ID + CI_REMOTE_EXECUTOR + CI_REMOTE_CACHE + CI_REMOTE_HEADER + CI_REMOTE_JOBS + CI_BES_RESULTS_URL + CI_BES_BACKEND + CI_PROJECT_URL + CI_COMMIT_REF_NAME + CI_COMMIT_SHA + CI_SERVER_HOST default: tags: @@ -10,8 +24,13 @@ test: parallel: matrix: - ROOT: - - . - - e2e + - . + - e2e + CONFIG: + - local + - remote + script: + - cd "${ROOT}"; bazelisk test --config="${CONFIG}" //... # TODO: switch this out for `rules_semantic_release` semantic-release: diff --git a/e2e/.bazelrc b/e2e/.bazelrc index caf256cf64625814d29734cc65144cd5e24d06f7..d394b1db6df8022855b2cba23ee421e93cc78b37 100644 --- a/e2e/.bazelrc +++ b/e2e/.bazelrc @@ -1,3 +1,6 @@ +# Enable `bzlmod` +common --enable_bzlmod + # Build cache build --experimental_guard_against_concurrent_changes @@ -10,5 +13,8 @@ build --nolegacy_external_runfiles # Avoid building all targets when testing test --build_tests_only +# Print relative paths where possible to reduce noise +common --attempt_to_print_relative_paths + # User-specific .bazelrc try-import %workspace%/.bazelrc.user diff --git a/e2e/.bazelrc.ci b/e2e/.bazelrc.ci index f7e08f12d92b5d1df101a98d2ed50a4beb8f0fb0..045e1ab1e0d57d974076bb974db10cb89536a112 100644 --- a/e2e/.bazelrc.ci +++ b/e2e/.bazelrc.ci @@ -29,5 +29,36 @@ test --test_output=errors test --test_verbose_timeout_warnings # These locations are cached on the CI -build --disk_cache=${CI_PROJECT_DIR}/.cache/bazel/disk -build --repository_cache=${CI_PROJECT_DIR}/.cache/bazel/repo +build:local --disk_cache=${CI_PROJECT_DIR}/.cache/bazel/disk +build:local --repository_cache=${CI_PROJECT_DIR}/.cache/bazel/repo + +# Use remote cache/execution for our builds +build:remote --remote_executor=${CI_REMOTE_EXECUTOR} +build:remote --remote_cache=${CI_REMOTE_CACHE} +build:remote --remote_timeout=3600 +build:remote --remote_header=${CI_REMOTE_HEADER} +build:remote --experimental_remote_cache_compression +build:remote --jobs=${CI_REMOTE_JOBS} + +# Upload results to the Build Event Service +build:remote --bes_results_url=${CI_BES_RESULTS_URL} +build:remote --bes_backend=${CI_BES_BACKEND} + +# Add build metadata +build:remote --build_metadata=REPO_URL=${CI_PROJECT_URL} +build:remote --build_metadata=BRANCH_NAME=${CI_COMMIT_REF_NAME} +build:remote --build_metadata=COMMIT_SHA=${CI_COMMIT_SHA} +build:remote --build_metadata=HOST=${CI_SERVER_HOST} +build:remote --build_metadata=ROLE=CI +build:remote --build_metadata=USER=gitlab-ci + +# Provide detailed timing information to the remote executor +build:remote --noslim_profile +build:remote --experimental_profile_include_target_label +build:remote --experimental_profile_include_primary_output + +# Eliminate duplicate references in the Build Event Stream +build:remote --nolegacy_important_outputs + +# TODO: remove this when `bazel/ape` binaries work on remote execution `arm64` instances +build:remote --host_platform=@toolchain_utils//toolchain/platform:amd64-linux-gnu