Skip to content

Commit

Permalink
Validate generated release.tar.gz on CI (#1681)
Browse files Browse the repository at this point in the history
  • Loading branch information
brentleyjones authored Jan 27, 2023
1 parent b1e6c20 commit adf3500
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
13 changes: 13 additions & 0 deletions buildbuddy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,24 @@ x_templates:
- &examples_cc_workspace
bazel_workspace_dir: examples/cc
git_clean_exclude:
- setup-bazel-output-base
- examples/cc/bazel-output-base
- examples/cc/setup-bazel-output-base
- &examples_integration_workspace
bazel_workspace_dir: examples/integration
git_clean_exclude:
- setup-bazel-output-base
- examples/integration/bazel-output-base
- examples/integration/setup-bazel-output-base
- &examples_sanitizers_workspace
bazel_workspace_dir: examples/sanitizers
git_clean_exclude:
- setup-bazel-output-base
- examples/sanitizers/bazel-output-base
- examples/sanitizers/setup-bazel-output-base

commands:
- &set_release_archive_override "--output_base=setup-bazel-output-base run --config=workflows @com_github_buildbuddy_io_rules_xcodeproj//tools:set_release_archive_override"
- &validate_integration "run --config=workflows --noexperimental_enable_bzlmod //test/fixtures:validate"
- &build_all "build --config=workflows --noexperimental_enable_bzlmod //..."
- &test_all "test --config=workflows --noexperimental_enable_bzlmod //..."
Expand Down Expand Up @@ -167,3 +171,12 @@ actions:
bazel_commands:
- *validate_integration
- *build_all

- name: Validate release.tar.gz
<<: *arm64
<<: *normal_resources
<<: *action_base
<<: *examples_cc_workspace
bazel_commands:
- *set_release_archive_override
- run --config=workflows //:xcodeproj
4 changes: 2 additions & 2 deletions tools/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sh_binary(
name = "set_bazel_5",
srcs = ["set_bazel_5.sh"],
name = "set_release_archive_override",
srcs = ["set_release_archive_override.sh"],
tags = ["manual"],
)

Expand Down
30 changes: 30 additions & 0 deletions tools/set_release_archive_override.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -euo pipefail

cd "$BUILD_WORKSPACE_DIRECTORY"

# Go to parent directory and create a release archive
echo
echo "Changing to parent directory"
pushd "../../" > /dev/null
echo "Building release.tar.gz"
echo
bazel --output_base=setup-bazel-output-base build //distribution:release

archive_path="$(bazel --output_base=setup-bazel-output-base info output_path)/darwin_arm64-opt/bin/distribution/release.tar.gz"
integrity="sha256-$(cut -d' ' -f 1 $archive_path.sha256 | xxd -r -p | openssl base64 -A)"

echo
echo "archive_path: $archive_path"
echo "integrity: $integrity"

# Adjust MODULE.bazel to point to the release archive
echo
echo "Changing back to root directory"
popd > /dev/null

echo "Adjusting MODULE.bazel to point to release.tar.gz"
perl -i -p0e \
"s|local_path_override\(\s*module_name = \"rules_xcodeproj\",\n\s*path.*|archive_override(\n module_name = \"rules_xcodeproj\",\n integrity = \"$integrity\",\n urls = [\"file://$archive_path\"],|" \
MODULE.bazel

0 comments on commit adf3500

Please sign in to comment.