Skip to content

Setup a CI to push generated bindings to a dedicated branch #60

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

Merged

Conversation

yutannihilation
Copy link
Contributor

@yutannihilation yutannihilation commented Jun 19, 2021

Related to #57

This pull request adds a job to gather the uploaded generated bindings and commit them to generated_bindings branch. We can create a pull request from that branch at any point we want to update the bindings. Of course we can commit this to the master branch, but I feel this should be done manually with checking the diffs by our eyes, at least at the moment.

This does nothing if there's no diffs, and even if something goes wrong, this pushes to non-master, where no CI is set up. So, I believe this should be safe.

This pull request adds a scheduled run setting. I use this on https://github.com/ggplot2-exts/gallery for a while and it works fine.

@Ilia-Kosenkov @clauswilke
Please let me know if there's any concern, or any topic to discuss.

@Ilia-Kosenkov
Copy link
Member

The idea looks good. What about adding workflow_dispatch: trigger? This will allow us to manually force re-generation without making a PR.

Also, what if we somehow notify that there are new bindings? Is it possible to create an automatic issue in this repository? I am afraid that re-generated bindings will disappear silently in the notifications.

@yutannihilation
Copy link
Contributor Author

What about adding workflow_dispatch: trigger? This will allow us to manually force re-generation without making a PR.

Thanks, sounds good. Could you explain a bit more about the latter sentence? Do you mean workflow_dispatch triggers a push to master directly? Or, is that about some new mechanism we might introduce in the future?

Also, what if we somehow notify that there are new bindings? Is it possible to create an automatic issue in this repository?

I think it's possible. Should it create a pull request, instead of a issue, when there are new bindings? Regarding notification, it seems it's also possible to notify on Discord: https://github.com/marketplace/actions/actions-for-discord.

@Ilia-Kosenkov
Copy link
Member

Thanks, sounds good. Could you explain a bit more about the latter sentence? Do you mean workflow_dispatch triggers a push to master directly?

No no, it is just another trigger. We trigger on PR, you add cron (every 3 days), I suggest to also have workflow_dispatch. That way you can trigger it directly from the Actions menu on GitHub. If there are no downsides to this, I think it is a good addition. Imagine that your scheduled run was yesterday, a new version of R is released today, and we have to wait for 2 days for bindings to re-generate or create a PR/commit to trigger the workflow. With dispatch, we can just start it when we need (in addition to on pull request and cron).

I think it's possible. Should it create a pull request, instead of a issue, when there are new bindings? Regarding notification, it seems it's also possible to notify on Discord: https://github.com/marketplace/actions/actions-for-discord.

I was thinking about the following. If new bindings are generated, then we crate an issue saying: "The generated bindings have changed for these platforms" and some additional information (like diffs?), maybe the version of R and cargo used for generation. That way a maintainer can see there is an issue and decide what to do manually -- update bindings, publish new version to crates.io, ignore, etc.

@yutannihilation
Copy link
Contributor Author

a PR/commit to trigger the workflow

Ah, thanks for clarifying! Sorry, I didn't explain that this runs only on master and ignores pull requests (so I was a bit confused why pull request is related here but it's totally my fault...). You can see commit_generated_bindings is actually skipped on this pull request.

# Do not run this on pull request
if: github.ref == 'refs/heads/master'

Then I think I get your point. Let's add workflow_dispatch.

@yutannihilation
Copy link
Contributor Author

If new bindings are generated, then we crate an issue saying: "The generated bindings have changed for these platforms" and some additional information (like diffs?), maybe the version of R and cargo used for generation.

I feel it might be a bit easier to use pull requests to include diffs, but I'll investigate both way.

@yutannihilation
Copy link
Contributor Author

Here's example issue and pull request:

Looking at the actual diffs, I'm afraid this happens too often as there are such information like SVN revisions included. So, I'd stick with no issue or pull request for now. It's probably too complicated to handle programmatically.

@Ilia-Kosenkov
Copy link
Member

OK, let's see how it goes.

Copy link
Member

@clauswilke clauswilke left a comment

Choose a reason for hiding this comment

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

Fine by me. One issue we'll have to think through at some point is what to do with old bindings for older R versions that we're not covering anymore in our CI setup. Whenever a new R version is released, an old one drops out of coverage. Do we delete those bindings? Ideally we should, I think, since otherwise they can get out of sync with other changes in libR-sys.

@yutannihilation
Copy link
Contributor Author

Do we delete those bindings?

Sorry, I forgot to answer this question on #57. I agree we should. Let's discuss this again on #57.

It's probably too complicated to handle programmatically.

Thinking this again, maybe we can just ignore the devel bindings...? Let's revisit here when we need better mechanism to notify.

@yutannihilation yutannihilation merged commit 4f9ad8a into extendr:master Jun 20, 2021
@yutannihilation yutannihilation deleted the ci/generated_bindings_branch branch June 20, 2021 00:48
@yutannihilation
Copy link
Contributor Author

yutannihilation commented Jun 20, 2021

Hmm, this fails because bindings-macos-x86_64-R4.1.rs is generated on two macOS runners (I didn't notice this because macOS-11 runner don't run on my fork).

cp: will not overwrite just-created 'bindings/bindings-macos-x86_64-R4.1.rs' with 'generated_binding-macOS-latest-R-release-rust-stable/bindings-macos-x86_64-R4.1.rs'

@yutannihilation
Copy link
Contributor Author

@Ilia-Kosenkov
Do you remember why macos-11 runner needs to check default target in addition to aarch64-apple-darwin? I briefly checked discussions around #45, but couldn't find the reason. If we can remove this, we can avoid the above conflict.

- {os: macOS-11, r: 'release', rust-version: 'nightly', targets: ['default', 'aarch64-apple-darwin'],
no-test-targets: 'aarch64-apple-darwin', emit-bindings: 'true'}

I already added an workaround for this (8fd988b), so this isn't very urgent, but I'd like to know the background.

@Ilia-Kosenkov
Copy link
Member

I am not sure, but I think we tested to make sure it works on the next MacOS version. I guess it can be removed. I am sorry that I did not write any comments, at that time we were just trying to add macos11 to get arm bindings.

@yutannihilation
Copy link
Contributor Author

I see, then I'll create a pull request to update the runner. No worries.

CGMossa pushed a commit to CGMossa/libR-sys that referenced this pull request Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants