Skip to content

Commit

Permalink
Post-0.12.1 release CI updates (#4873)
Browse files Browse the repository at this point in the history
### What

- Fixes #4763
- Fixes #4366

Updates to scripts/workflows:
- [x] Ensure `sync_release_assets.py` fails if some requested asset is
not found
- This has tripped people up multiple times. The assets were not synced,
but the job also didn't fail.
- [x] Automate GitHub release
- The `0.12.1` tag must be created on the release commit, otherwise the
asset sync won't be able to find the assets.

Failure fixes:
- [x] Fix `latest` branch update
- We have both a `latest` tag and a `latest` branch, and git doesn't
know what the destination of
`push release-x.y.z:latest` should be. The fix is to specify explicitly
    `refs/heads/release-x.y.z:refs/heads/latest`
  - Also deleted the tag because it was really out of date.
- [x] Fix post-release version bump
- The job was checking out the default branch and then it ran into merge
conflicts in the `git pull`, solution should be to check out the release
commit and skipping the `git pull`

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using newly built examples:
[app.rerun.io](https://app.rerun.io/pr/4873/index.html)
* Using examples from latest `main` build:
[app.rerun.io](https://app.rerun.io/pr/4873/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[app.rerun.io](https://app.rerun.io/pr/4873/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG

- [PR Build Summary](https://build.rerun.io/pr/4873)
- [Docs
preview](https://rerun.io/preview/5db0e755be09fa2642987305a049681e79a29a7c/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/5db0e755be09fa2642987305a049681e79a29a7c/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
  • Loading branch information
jprochazk authored Jan 23, 2024
1 parent 965d063 commit 5bfb48e
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 15 deletions.
52 changes: 50 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,60 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.version.outputs.release-commit }}

- name: Update latest branch
shell: bash
run: |
git fetch
git checkout ${{ github.ref_name }}
git push --force origin ${{ github.ref_name }}:latest
git push --force origin refs/heads${{ github.ref_name }}:refs/heads/latest
github-release:
name: "GitHub Release"
if: inputs.release-type == 'final'
needs:
[
version,
update-docs,
publish-crates,
publish-wheels,
publish-web,
publish-rerun_c,
publish-rerun-cli,
publish-npm,
]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.version.outputs.release-commit }}
token: ${{ secrets.RERUN_BOT_TOKEN }}

- name: Release tag
env:
GH_TOKEN: ${{ secrets.RERUN_BOT_TOKEN }}
run: |
version="${{ needs.version.outputs.final }}"
git tag $version
git push origin $version
gh release create $version --verify-tag --draft --title $version
- name: Create comment
env:
GH_TOKEN: ${{ secrets.RERUN_BOT_TOKEN }}
run: |
pr_number=$(gh pr view --json number | jq '.number')
version="${{ needs.version.outputs.final }}"
cat <<EOF > comment-body.txt
GitHub release draft: [$version](https://github.com/rerun-io/rerun/releases/tag/$version)
EOF
gh pr comment $pr_number --body-file comment-body.txt
post-release-version-bump:
name: "Post-Release Version Bump"
Expand All @@ -318,12 +364,15 @@ jobs:
publish-rerun_c,
publish-rerun-cli,
publish-npm,
github-release,
]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.version.outputs.release-commit }}
token: ${{ secrets.RERUN_BOT_TOKEN }}

- uses: actions/setup-node@v4
Expand Down Expand Up @@ -361,7 +410,6 @@ jobs:
git config --global user.name "rerun-bot"
git config --global user.email "[email protected]"
git commit -am "Bump versions to ${{ steps.update-version.outputs.version }}"
git pull --rebase
git push
comment-artifact-links:
Expand Down
49 changes: 36 additions & 13 deletions scripts/ci/sync_release_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,23 @@ def fetch_binary_assets(
bucket = gcs.bucket("rerun-builds")

commit_short = commit[:7]
print(f"Fetching binary assets for #{commit_short}…")
print(f" - wheels: {do_wheels}")
print(f" - C libs: {do_rerun_c}")
print(f" - C++ uber SDK: {do_rerun_cpp_sdk}")
print(f" - CLI (Viewer): {do_rerun_cli}")
print(f"Fetching the following binary assets for #{commit_short}:")
if do_wheels:
print(" - Python wheels")
if do_rerun_c:
print(" - C libs")
if do_rerun_cpp_sdk:
print(" - C++ uber SDK")
if do_rerun_cli:
print(" - CLI (Viewer)")

all_found = True

# Python wheels
if do_wheels:
found = False
wheel_blobs = list(bucket.list_blobs(prefix=f"commit/{commit_short}/wheels"))
for blob in [bucket.get_blob(blob.name) for blob in wheel_blobs if blob.name.endswith(".whl")]:
for blob in (bucket.get_blob(blob.name) for blob in wheel_blobs if blob.name.endswith(".whl")):
if blob is not None and blob.name is not None:
name = blob.name.split("/")[-1]

Expand All @@ -76,10 +83,14 @@ def fetch_binary_assets(
#
# if "win_amd64" in name:
# name = f"rerun_sdk-{tag}-x86_64-pc-windows-msvc.whl"

print(f" Found Python wheel: {name} ")
print(f"Found Python wheels: {name}")
found = True
assets[name] = blob

if not found:
all_found = False
print("Python wheels not found")

# rerun_c
if do_rerun_c:
rerun_c_blobs = [
Expand All @@ -102,19 +113,25 @@ def fetch_binary_assets(
]
for name, blob in rerun_c_blobs:
if blob is not None:
print(f" Found Rerun C library: {name}")
print(f"Found Rerun C library: {name}")
assets[name] = blob
else:
all_found = False
print(f"Rerun C library {name} not found")

# rerun_cpp_sdk
if do_rerun_cpp_sdk:
rerun_cpp_sdk_blob = bucket.get_blob(f"commit/{commit_short}/rerun_cpp_sdk.zip")
for blob in [rerun_cpp_sdk_blob]:
if blob is not None and blob.name is not None:
name = blob.name.split("/")[-1]
print(f" Found Rerun cross-platform bundle: {name}")
print(f"Found Rerun cross-platform bundle: {name}")
assets[name] = blob
# NOTE: Want a versioned one too.
assets[f"rerun_cpp_sdk-{tag}-multiplatform.zip"] = blob
else:
all_found = False
print("Rerun cross-platform bundle not found")

# rerun-cli
if do_rerun_cli:
Expand All @@ -138,8 +155,14 @@ def fetch_binary_assets(
]
for name, blob in rerun_cli_blobs:
if blob is not None:
print(f" Found Rerun CLI binary: {name}")
print(f"Found Rerun CLI binary: {name}")
assets[name] = blob
else:
all_found = False
print(f"Rerun CLI binary {name} not found")

if not all_found:
raise Exception("some requested assets were not found")

return assets

Expand All @@ -148,7 +171,7 @@ def remove_release_assets(release: GitRelease):
print("Removing pre-existing release assets…")

for asset in release.get_assets():
print(f" Removing {asset.name}…")
print(f"Removing {asset.name}…")
asset.delete_asset()


Expand All @@ -162,7 +185,7 @@ def update_release_assets(release: GitRelease, assets: Assets):
# the upload in all kinds of unexpected ways (including SSL errors!) depending on the versions
# of your reqwest & pygithub dependencies.
blob_raw_size = len(blob_contents)
print(f" Uploading {name} ({blob_raw_size} bytes)…")
print(f"Uploading {name} ({blob_raw_size} bytes)…")
release.upload_asset_from_memory(
blob_contents,
blob_raw_size,
Expand Down

0 comments on commit 5bfb48e

Please sign in to comment.