-
Notifications
You must be signed in to change notification settings - Fork 121
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
Add prebuilt mozjs archive CI #454
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not really fan of doing manual uploads using curl commands. We should use actions to make this less complex. You can take a look how this is done in servo: https://github.com/servo/servo/blob/main/.github/workflows/nightly.yml. In servo we also mark releases that are not full as draft (and mark them as final if all runs succeed).
I think mac-arm and x86 could be merged into one job with matrix.
Furthermore I think we can simply use main workflow insted of adding new one and add |
Then there is also option to start CI on release, that could check that archives actually work. |
Alright! Let me move the workflow into main one. |
Move CI into one file
I am not sure we want to do releases on forks. Only on servo/servo would be enough (but only for push to main, we would want to make release for every PR). There is Also to simplify things even more, instead of firstly creating draft release we should just do normal run uploading archives as artifacts (already done). Then at the end do release job that would download all artifacts and upload them all to the release. Also upload-release-asset@v1 seems to be unmaintained, maybe we can do this by gh command. |
I need
I'll simplify the workflow a bit. I also aware of gh command but have some trouble with multiple build steps. Maybe it can be easier if the release workflow is simplified. |
Simplify release workflow
There are some restrictions on recursive calls on workflow and auto release. So I chose I think that's all for the workflow that can create releases and then verify it when the release is published. Let me know if I still miss or need to fix something. |
I completely forgot about those. Does it fail running release CI job or does it just not get run. If it's the later case we might still want to have it trigger on release (in addition to workflow call) in case we do manual release. |
Update trigger condition and remove deps
It won't be triggered to run. I'll add the condition to trigger on manual release. |
Merge all jobs in release into one
Update release jobs
.github/workflows/rust.yml
Outdated
- id: release | ||
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }} | ||
run: | | ||
RELEASE_TAG=$(date "+%F-%H-%M") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be problematic, if we have two updates in a day (it happens sometimes), so using commit hash might be better, but I don't know how we could bake this info in for #450. Can we get dependency commit hash using cargo without baking it in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rusty_v8 does this using CARGO_PKG_VERSION
:
https://github.com/denoland/rusty_v8/blob/9dd629e1c3c50fbbe70435ed50f6f09e9b69d7bb/build.rs#L320
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CARGO_PKG_VERSION
seems like a better approach. I also hope this repo can provide version release again.
I'll update release job to use mozjs_sys's CARGO_PKG_VERSION
, and it will skip the release if the version is already exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think CARGO_PKG_VERSION
is actually the only way to go and because we moved all .c* files to mozjs-sys, the only thing that needs versions bumps is mozjs-sys
when there are any C/C++ file changes.
It would be nice to make CI check for this too, but I think this can be done as a followup if (ever) needed. For now I think it would be enough if we test always latest release on push to main (instead of testing release only if it's new).
Update release tag name and check if exist before release
We should not fail here, right?
https://github.com/sagudev/mozjs/actions/runs/8207125754/job/22448383805#step:5:11 |
I think we should just skip release creation in this case, but still verify it. |
This SO question looks similar to us. I'll add |
I am not sure this will solve it. I simply run workflow twice (second time with empty commit), both times on main. I think we just need to not fail in this case. So maybe something like |
.github/workflows/rust.yml
Outdated
if git show-ref --tags --verify --quiet "refs/tags/${RELEASE_TAG}"; then | ||
RELEASE_TAG='' | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or did you refer to that code? In that case we can simply remove this and make next step to not fail, which will ensure to test all merged commits with latest release available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry I didn't read your comments before pushing. gh create release ... || exit 0
seems simpler. I'll update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you did is actually way better, because using ||
we hide all gh create release
failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah okay! Let me revert it. 😅
Edit: Here's my run with second try: https://github.com/wusyong/mozjs/actions/runs/8212872566
.github/workflows/rust.yml
Outdated
RELEASE_TAG=mozjs-sys-v$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "mozjs_sys") | .version') | ||
git fetch --tags --quiet | ||
if ! git show-ref --tags --verify --quiet "refs/tags/${RELEASE_TAG}" ; then | ||
gh release create ${{ steps.check-tag.outputs.RELEASE_TAG }} ./*.tar.gz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${{ steps.check-tag.outputs.RELEASE_TAG }}
is not available here yet (step is not finished), but ${RELEASE_TAG}
should work. https://github.com/sagudev/mozjs/actions/runs/8213051004/job/22464164401#step:4:5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all your great work!
I can't wait to start using this work in servo.
Another part of #439. This PR adds a CI pipeline to publish prebuilt mozjs archive.
I've tried to run it and created a working version release: https://github.com/wusyong/mozjs/releases/tag/2024-02-29
I set the workflow trigger on the main branch update since there are few commits for this repo.
Let me know if there's preferred condition.