Skip to content

Commit

Permalink
Fix shell commands in bcr testing (#3070)
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre authored Dec 10, 2024
1 parent bd37938 commit dcf0a57
Show file tree
Hide file tree
Showing 22 changed files with 57 additions and 179 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ build --incompatible_merge_fixed_and_default_shell_env
## Bzlmod
###############################################################################

# A configuration for disabling bzlmod.
common:no-bzlmod --noenable_bzlmod --enable_workspace

# Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock
common --lockfile_mode=off

Expand Down
5 changes: 1 addition & 4 deletions .bcr/extensions/bindgen/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bcr_test_module:
module_path: ""
module_path: "extensions/bindgen"
matrix:
platform: ["macos_arm64", "ubuntu2004", "windows"]
bazel: ["7.x"]
Expand All @@ -8,8 +8,5 @@ bcr_test_module:
name: "Run test module"
platform: ${{ platform }}
bazel: ${{ bazel }}
# Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile.
shell_commands:
- "rm MODULE.bazel.lock"
test_targets:
- "//..."
4 changes: 2 additions & 2 deletions .bcr/extensions/bindgen/source.template.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}_bindgen-{VERSION}.tar.gz"
"strip_prefix": "extensions/bindgen",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.tar.gz"
}
5 changes: 1 addition & 4 deletions .bcr/extensions/prost/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bcr_test_module:
module_path: ""
module_path: "extensions/prost"
matrix:
platform: ["macos_arm64", "ubuntu2004", "windows"]
bazel: ["7.x"]
Expand All @@ -8,8 +8,5 @@ bcr_test_module:
name: "Run test module"
platform: ${{ platform }}
bazel: ${{ bazel }}
# Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile.
shell_commands:
- "rm MODULE.bazel.lock"
test_targets:
- "//..."
4 changes: 2 additions & 2 deletions .bcr/extensions/prost/source.template.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}_prost-{VERSION}.tar.gz"
"strip_prefix": "extensions/prost",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.tar.gz"
}
5 changes: 1 addition & 4 deletions .bcr/extensions/protobuf/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bcr_test_module:
module_path: ""
module_path: "extensions/protobuf"
matrix:
platform: ["macos_arm64", "ubuntu2004", "windows"]
bazel: ["7.x"]
Expand All @@ -8,8 +8,5 @@ bcr_test_module:
name: "Run test module"
platform: ${{ platform }}
bazel: ${{ bazel }}
# Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile.
shell_commands:
- "rm MODULE.bazel.lock"
test_targets:
- "//..."
4 changes: 2 additions & 2 deletions .bcr/extensions/protobuf/source.template.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}_protobuf-{VERSION}.tar.gz"
"strip_prefix": "extensions/protobuf",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.tar.gz"
}
5 changes: 1 addition & 4 deletions .bcr/extensions/wasm_bindgen/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bcr_test_module:
module_path: ""
module_path: "extensions/wasm_bindgen"
matrix:
platform: ["macos_arm64", "ubuntu2004", "windows"]
bazel: ["7.x"]
Expand All @@ -8,8 +8,5 @@ bcr_test_module:
name: "Run test module"
platform: ${{ platform }}
bazel: ${{ bazel }}
# Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile.
shell_commands:
- "rm MODULE.bazel.lock"
test_targets:
- "//..."
4 changes: 2 additions & 2 deletions .bcr/extensions/wasm_bindgen/source.template.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}_wasm_bindgen-{VERSION}.tar.gz"
"strip_prefix": "extensions/wasm_bindgen",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.tar.gz"
}
8 changes: 4 additions & 4 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ bcr_test_module:
name: "Run test module"
platform: ${{ platform }}
bazel: ${{ bazel }}
# Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile.
shell_commands:
- "rm MODULE.bazel.lock"
# Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile.
- "rm MODULE.bazel.lock || true"
run_targets:
- "//third-party-in-workspace:vendor"
- "@rules_rust//tools/rust_analyzer:gen_rust_project"
Expand All @@ -28,9 +28,9 @@ bcr_test_module_windows:
name: "Run test module"
platform: windows
bazel: ${{ bazel }}
# Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile.
shell_commands:
- "rm MODULE.bazel.lock"
# Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile.
- "rm MODULE.bazel.lock || true"
run_targets:
- "//third-party-in-workspace:vendor"
build_targets:
Expand Down
20 changes: 12 additions & 8 deletions .github/release_notes.template
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ bazel_dep(name = "rules_rust_bindgen", version = "{version}")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_rust_bindgen",
integrity = "sha256-{ext_bindgen_sha256_base64}",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust_bindgen-{version}.tar.gz"],
integrity = "sha256-{sha256_base64}",
strip_prefix = "extensions/bindgen",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust-{version}.tar.gz"],
)
```

Expand All @@ -60,8 +61,9 @@ bazel_dep(name = "rules_rust_prost", version = "{version}")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_rust_prost",
integrity = "sha256-{ext_prost_sha256_base64}",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust_prost-{version}.tar.gz"],
integrity = "sha256-{sha256_base64}",
strip_prefix = "extensions/prost",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust-{version}.tar.gz"],
)
```

Expand All @@ -83,8 +85,9 @@ bazel_dep(name = "rules_rust_protobuf", version = "{version}")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_rust_protobuf",
integrity = "sha256-{ext_protobuf_sha256_base64}",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust_protobuf-{version}.tar.gz"],
integrity = "sha256-{sha256_base64}",
strip_prefix = "extensions/protobuf",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust-{version}.tar.gz"],
)
```

Expand All @@ -106,8 +109,9 @@ bazel_dep(name = "rules_rust_wasm_bindgen", version = "{version}")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_rust_wasm_bindgen",
integrity = "sha256-{ext_wasm_bindgen_sha256_base64}",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust_wasm_bindgen-{version}.tar.gz"],
integrity = "sha256-{sha256_base64}",
strip_prefix = "extensions/wasm_bindgen",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust-{version}.tar.gz"],
)
```

Expand Down
113 changes: 0 additions & 113 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,97 +140,21 @@ jobs:
--exclude=".git" \
--exclude=".github" \
--exclude="crate_universe/target" \
--exclude="extensions" \
examples/bzlmod \
--exclude="examples" \
.
# Save the sha256 checksum of the distro archive to the environment
sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)"
echo "ARCHIVE_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV
env:
CARGO_BAZEL_GENERATOR_URL: file://${{ github.workspace }}/crate_universe/target/artifacts/x86_64-unknown-linux-gnu/cargo-bazel
ARTIFACTS_DIR: ${{ github.workspace }}/crate_universe/target/artifacts
URL_PREFIX: https://github.com/${{ github.repository_owner }}/rules_rust/releases/download/${{ env.RELEASE_VERSION }}
- name: Create the rules extensions archive for Bindgen
run: |
# Build an archive of the repo contents.
tar -czf ${{ github.workspace }}/.github/rules_rust_bindgen.tar.gz \
-C ${{ github.workspace }}/extensions/bindgen \
--exclude="examples" \
.
# Save the sha256 checksum of the distro archive to the environment
sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust_bindgen.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)"
echo "ARCHIVE_EXT_BINDGEN_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV
- name: Create the rules extensions archive for Prost
run: |
# Build an archive of the repo contents.
tar -czf ${{ github.workspace }}/.github/rules_rust_prost.tar.gz \
-C ${{ github.workspace }}/extensions/prost \
--exclude="examples" \
.
# Save the sha256 checksum of the distro archive to the environment
sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust_prost.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)"
echo "ARCHIVE_EXT_PROST_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV
- name: Create the rules extensions archive for Protobuf
run: |
# Build an archive of the repo contents.
tar -czf ${{ github.workspace }}/.github/rules_rust_protobuf.tar.gz \
-C ${{ github.workspace }}/extensions/protobuf \
--exclude="examples" \
.
# Save the sha256 checksum of the distro archive to the environment
sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust_protobuf.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)"
echo "ARCHIVE_EXT_PROTOBUF_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV
- name: Create the rules extensions archive for wasm-bindgen
run: |
# Build an archive of the repo contents.
tar -czf ${{ github.workspace }}/.github/rules_rust_wasm_bindgen.tar.gz \
-C ${{ github.workspace }}/extensions/wasm_bindgen \
--exclude="examples" \
.
# Save the sha256 checksum of the distro archive to the environment
sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust_wasm_bindgen.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)"
echo "ARCHIVE_EXT_WASM_BINDGEN_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV
# Upload the artifact in case creating a release fails so all artifacts can then be manually recovered.
- uses: actions/upload-artifact@v3
with:
name: "rules_rust.tar.gz"
path: ${{ github.workspace }}/.github/rules_rust.tar.gz
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: "rules_rust_bindgen.tar.gz"
path: ${{ github.workspace }}/.github/rules_rust_bindgen.tar.gz
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: "rules_rust_prost.tar.gz"
path: ${{ github.workspace }}/.github/rules_rust_prost.tar.gz
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: "rules_rust_protobuf.tar.gz"
path: ${{ github.workspace }}/.github/rules_rust_protobuf.tar.gz
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: "rules_rust_wasm_bindgen.tar.gz"
path: ${{ github.workspace }}/.github/rules_rust_wasm_bindgen.tar.gz
if-no-files-found: error
- name: Generate release notes
run: |
# Generate the release notes
sed 's#{version}#${{ env.RELEASE_VERSION }}#g' ${{ github.workspace }}/.github/release_notes.template \
| sed 's#{sha256_base64}#${{ env.ARCHIVE_SHA256_BASE64 }}#g' \
| sed 's#{ext_bindgen_sha256_base64}#${{ env.ARCHIVE_EXT_BINDGEN_SHA256_BASE64 }}#g' \
| sed 's#{ext_prost_sha256_base64}#${{ env.ARCHIVE_EXT_PROST_SHA256_BASE64 }}#g' \
| sed 's#{ext_protobuf_sha256_base64}#${{ env.ARCHIVE_EXT_PROTOBUF_SHA256_BASE64 }}#g' \
| sed 's#{ext_wasm_bindgen_sha256_base64}#${{ env.ARCHIVE_EXT_WASM_BINDGEN_SHA256_BASE64 }}#g' \
> ${{ github.workspace }}/.github/release_notes.txt
- name: Create release
uses: softprops/action-gh-release@v1
Expand All @@ -253,43 +177,6 @@ jobs:
asset_path: ${{ github.workspace }}/.github/rules_rust.tar.gz
asset_content_type: application/gzip

- name: "Upload the bindgen extension archive"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.rules_rust_release.outputs.upload_url }}
asset_name: rules_rust_bindgen-${{ env.RELEASE_VERSION }}.tar.gz
asset_path: ${{ github.workspace }}/.github/rules_rust_bindgen.tar.gz
asset_content_type: application/gzip
- name: "Upload the prost extension archive"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.rules_rust_release.outputs.upload_url }}
asset_name: rules_rust_prost-${{ env.RELEASE_VERSION }}.tar.gz
asset_path: ${{ github.workspace }}/.github/rules_rust_prost.tar.gz
asset_content_type: application/gzip
- name: "Upload the protobuf extension archive"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.rules_rust_release.outputs.upload_url }}
asset_name: rules_rust_protobuf-${{ env.RELEASE_VERSION }}.tar.gz
asset_path: ${{ github.workspace }}/.github/rules_rust_protobuf.tar.gz
asset_content_type: application/gzip
- name: "Upload the wasm_bindgen extension archive"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.rules_rust_release.outputs.upload_url }}
asset_name: rules_rust_wasm_bindgen-${{ env.RELEASE_VERSION }}.tar.gz
asset_path: ${{ github.workspace }}/.github/rules_rust_wasm_bindgen.tar.gz
asset_content_type: application/gzip

# There must be a upload action for each platform triple we create
- name: "Upload aarch64-apple-darwin"
uses: actions/upload-release-asset@v1
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module(
name = "rules_rust",
version = "0.55.3",
version = "0.55.4",
)

###############################################################################
Expand Down
4 changes: 4 additions & 0 deletions extensions/bindgen/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ common:no-bzlmod --noenable_bzlmod --enable_workspace
# Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock
common --lockfile_mode=off

# Allow bazel configuration flags to locate the core rules to avoid adding local
# override paths to the `MODULE.bazel` file and breaking downstream consumers.
common --override_module=rules_rust=../../

###############################################################################
## Custom user flags
##
Expand Down
9 changes: 2 additions & 7 deletions extensions/bindgen/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@

module(
name = "rules_rust_bindgen",
version = "0.55.3",
version = "0.55.4",
)

bazel_dep(
name = "rules_rust",
version = "0.55.3",
version = "0.55.4",
)
local_path_override(
module_name = "rules_rust",
path = "../..",
)

bazel_dep(
name = "bazel_skylib",
version = "1.7.1",
Expand Down
4 changes: 4 additions & 0 deletions extensions/prost/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ common:no-bzlmod --noenable_bzlmod --enable_workspace
# Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock
common --lockfile_mode=off

# Allow bazel configuration flags to locate the core rules to avoid adding local
# override paths to the `MODULE.bazel` file and breaking downstream consumers.
common --override_module=rules_rust=../../

###############################################################################
## Custom user flags
##
Expand Down
9 changes: 2 additions & 7 deletions extensions/prost/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@

module(
name = "rules_rust_prost",
version = "0.55.3",
version = "0.55.4",
)

bazel_dep(
name = "rules_rust",
version = "0.55.3",
version = "0.55.4",
)
local_path_override(
module_name = "rules_rust",
path = "../..",
)

bazel_dep(
name = "platforms",
version = "0.0.10",
Expand Down
Loading

0 comments on commit dcf0a57

Please sign in to comment.