Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: automate creation of GitHub releases and tags #1571

Merged
merged 9 commits into from
Aug 19, 2024

Conversation

galargh
Copy link
Contributor

@galargh galargh commented Jul 23, 2024

This automates the creation of GitHub releases and associated GitHub tags based on the changes to the version in the root Cargo.toml file.

The automation uses the same principles as the one you might know from Go projects where we control the current version via version.json file (https://github.com/ipdxco/unified-github-workflows?tab=readme-ov-file#versioning). This is the exact same workflow just updated to workflow with Cargo.toml.

@galargh galargh requested review from BigLep and rvagg July 23, 2024 14:28
@galargh galargh marked this pull request as ready for review July 23, 2024 14:29
@BigLep BigLep requested a review from rjan90 July 23, 2024 19:54
Copy link
Member

@BigLep BigLep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually seems right to me, but will leave to @rvagg or @rjan90 to approve since I haven't done a release in this repo before.

Also, for the record, this closes addresses some of #1566. It doesn't close the issue because we need to also ensure we automate the publishing of assets.

@BigLep
Copy link
Member

BigLep commented Jul 23, 2024

Actually, I guess because we have https://github.com/filecoin-project/builtin-actors/blob/master/.github/workflows/release.yml, automated asset publishing is happening and merging this issue does fully handle #1566. (It's using its own script, and it isn't using the usual IPDX workflows).

@rjan90 and @Stebalien: I know there are concerns about making sure consistent bundles get created when the same commit is used between tags. Do you see any issue here with this approach? (I don't know how the non-determinism was being avoided when things were being done manually.)

@rvagg
Copy link
Member

rvagg commented Jul 24, 2024

I don't think we have much choice but to manually overwrite the uploaded assets when doing something like the v14.0.0 final where it didn't differ from the previous and we didn't want new bundles.

I wonder though whether we'd better having an option to not upload the assets on publish so we're not in a place of having the wrong assets on the release page until the creator manages to replace them with the desired one. Maybe a label to put on the PR that skips the upload?

@rjan90
Copy link
Contributor

rjan90 commented Jul 24, 2024

I don't think we have much choice but to manually overwrite the uploaded assets when doing something like the v14.0.0 final where it didn't differ from the previous and we didn't want new bundles.

When publishing the final v14.0.0 yesterday, I actually got the same assets generated in v14.0.0 as in v14.0.0-rc1. Which might be because the build was executed on the exact same machine/OS.

There is a bit more historical context are reproducible build here: #171 (comment).

I wonder though whether we'd better having an option to not upload the assets on publish so we're not in a place of having the wrong assets on the release page until the creator manages to replace them with the desired one. Maybe a label to put on the PR that skips the upload?

Agree that having this option would be nice though.

@galargh
Copy link
Contributor Author

galargh commented Jul 24, 2024

To summarise, if we merge it, the release flow would be:

  1. Create a PR that bumps a version in Cargo.toml
  2. release-check.yml is triggered; it creates a draft GitHub Release
  3. Merge the PR
  4. releaser.yml is triggered; it publishes the GitHub Release that was created in 2.; publishing the release creates a git tag
  5. release.yml is triggered (by GitHub release publishing); it uploads assets to the release

Is that the desired behaviour here?

@BigLep
Copy link
Member

BigLep commented Jul 24, 2024

Idea: what if we do the flow like this:

  1. Create a PR that bumps a version in Cargo.toml
  2. release-check.yml is triggered; it creates a draft GitHub Release
  3. (reordered) release.yml` is triggered (by GitHub draft release creation); it uploads assets to the release
  4. Merge the PR
  5. releaser.yml is triggered; it publishes the GitHub Release that was created in 3.; publishing the release creates a git tag

This gives the PR reviewer a chance to check the CIDs before they actually merge the PR. If the PRs are off for some reason, they can manually upload assets.

@galargh
Copy link
Contributor Author

galargh commented Jul 25, 2024

I haven't tested this yet, but this should do it - fc7fce7

Would that be the desired setup?

Copy link
Member

@BigLep BigLep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, although it would be good to get approval from @rjan90 or @rvagg as well.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
__release_target_asset=`echo $__release_response | jq -r ".assets | .[] | select(.name == \"$release_target\")"`

if [ -n "$__release_target_asset" ]; then
echo "deleting $release_target"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the delete fails? Will the following upload fail as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A delete failure should fail the script.

@BigLep
Copy link
Member

BigLep commented Aug 1, 2024

2024-08-01 conversation between IPDX and FilOz:

@rvagg
Copy link
Member

rvagg commented Aug 2, 2024

I'd like to see a unification of the work in filecoin-project/ref-fvm#2027 and filecoin-project/actors-utils#235 into here too so we have roughly the same pattern across them all, including --dry-run and the rest that Steb is identifying.

galargh and others added 2 commits August 5, 2024 21:21
Co-authored-by: Steve Loeppky <stvn@loeppky.com>
Co-authored-by: Steve Loeppky <stvn@loeppky.com>
@galargh
Copy link
Contributor Author

galargh commented Aug 5, 2024

In this repo, we're using cargo to create a .car asset which we upload to the releases instead. Let me know if there's anything else you'd like to see in this PR.

README.md Outdated Show resolved Hide resolved
@BigLep
Copy link
Member

BigLep commented Aug 5, 2024

@rvagg : I believe this is ready for your re-review.

exit 1
fi

__release_upload_url=`echo $__release_response | jq -r '.upload_url' | cut -d'{' -f1`

__release_target_asset=`echo $__release_response | jq -r ".assets | .[] | select(.name == \"$release_target\")"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a blocker, more of a preference thing so take it or leave it: I prefer subshell $() use rather than backticks for this kind of thing, better ergonomics and IMO better readability

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, but it was a convention already used in the script and I didn't want to update all the occurrences at this time given all the other changes we're introducing.

Copy link
Member

@rvagg rvagg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, seems OK, although I do kind of agree with @Stebalien @ filecoin-project/actors-utils#235 (review) that auto-publish is the ultimate form of this. The disconnect between here and actually publishing means we could easily end up with tagged but unpublished (and unpublishable?) crate versions.

@galargh
Copy link
Contributor Author

galargh commented Aug 13, 2024

Sure, seems OK, although I do kind of agree with @Stebalien @ filecoin-project/actors-utils#235 (review) that auto-publish is the ultimate form of this. The disconnect between here and actually publishing means we could easily end up with tagged but unpublished (and unpublishable?) crate versions.

Do we do cargo publish in this repo? I couldn't find any mention of that.

I now described the entire release process in this repo in 562eee7 and included a section on possible future improvements.

Copy link
Member

@BigLep BigLep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates!

Do we do cargo publish in this repo? I couldn't find any mention of that.

Agreed. I don't believe we do a cargo publish for this repo. Per https://github.com/filecoin-project/lotus/blob/master/documentation/misc/Update_Dependencies_Lotus.md#updating-builtin-actors , I believe it gets pulled in via other means.

Looking at https://crates.io/search?q=filecoin%20actors&sort=recent-updates , everything there is coming from Chainsafe.

RELEASE.md Show resolved Hide resolved
RELEASE.md Show resolved Hide resolved
RELEASE.md Show resolved Hide resolved
RELEASE.md Outdated Show resolved Hide resolved
Co-authored-by: Steve Loeppky <stvn@loeppky.com>
RELEASE.md Outdated Show resolved Hide resolved
Copy link
Member

@BigLep BigLep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a few suggestions to make it clear where the git tag gets created. Sorry that I wasn't picking up on this earlier.

RELEASE.md Outdated Show resolved Hide resolved
RELEASE.md Show resolved Hide resolved
RELEASE.md Outdated Show resolved Hide resolved
@BigLep
Copy link
Member

BigLep commented Aug 15, 2024

In ffda880 I incorporated a couple of suggestions from me about where the git tag is created.

I'm going to squash/merge given verbal during 2024-08-14 Lotus maintainers call where @Stebalien said these changes are good given we don't have to do crate publishing.

@BigLep BigLep added this pull request to the merge queue Aug 19, 2024
Merged via the queue into master with commit 6906288 Aug 19, 2024
12 checks passed
@BigLep BigLep deleted the ipdx-unified-github-workflows branch August 19, 2024 18:13
@galargh
Copy link
Contributor Author

galargh commented Aug 23, 2024

Thank you for all the reviews, and help getting it merged 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ☑️ Done (Archive)
Development

Successfully merging this pull request may close these issues.

4 participants