-
Notifications
You must be signed in to change notification settings - Fork 460
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
Create a standard GitHub action for Lean projects #3950
Comments
Based on these requirements, GitHub recommends we put the custom action in it's own repository. This would allow lean projects to use the action by adding, - uses: leanprovercommunity/lean-action@{version-number-tag} to their continuous integration workflow config. To give an idea, here is an action with elan -> cache -> build -> test -> lint capabilities. Currently the action is configured by three inputs:
Here are two repos to demonstrate usage:
Does this seems like the right approach? If so I can expand this to,
|
Yes, this is the right approach, and I'm really happy to see this! It would be fantastic if we could provide a good default for |
I thought it would be nice to include caching the |
@Seasawher We could potentially cache some of the build files using the cache action. It takes a list of paths to cache and a key to match caches on, usually a hash of a lock file. Potentially we could use |
@semorrison I think you are right that the existence of How about greping the Updated usage examples:
The grep solution is still somewhat brittle if the dependency is not declared in Does lake have something similar to cargo tree which would give a more reliable graph of the dependencies? If not, |
That would mean new build results are not cached as long as that file is unchanged. You should instead make sure that each unique build generates a unique key but also can fall back to previous caches using |
Ah, okay. Thanks for the tip @Kha. I have added the cache action before running any lake commands with the following configuration: - uses: actions/cache@v4
with:
path: .lake
key: ${{ runner.os }}-lake-${{ github.sha }}
# if no cache hit, fall back to the (latest) previous cache
restore-keys: ${{ runner.os }}-lake- One area for improvement is that the github cache will cache the Mathlib cache generated by |
The action now includes an optional step to check reservoir eligibility using the inclusion criteria. It verifies the repository,
|
Nice! Another possibility useful tweak is to save the cache even upon build or test failures: This way when you fix a build failure, the build will continue from there. Very useful if otherwise you'd be watching it compile std over and over again :-) |
Thanks for the suggestion, @nomeata. I've added a step to preserve the cache after |
Regarding To support both use cases, we could modify the inputs to resemble action-python, where users specify the exact steps to run. However, this may complicate the user interface more than it adds value. As an alternative, we could create a separate action in the same repo for these tasks, perhaps named |
Maybe a cron-based job isn't great for the fits-80%-solution anyways? It is annoying with forks, and with low activity repositories GitHub after a while sends annoying mails about disabling the cron job. Maybe to keep it simple make running lean4checker optional and leave it at that? |
Yes, thinking about it again let's keep lean4checker as a push-triggered event. For small repositories it runs fast enough it shouldn't be a problem. |
I'm really excited to see this work: don't hesitate to ping me if I can help with next steps. I would suggest we create a repository under the |
@semorrison A repository under I an create a README.md and make an initial PR so development can continue in that repository. |
@austinletson, I have created leanprover/lean-action, and added you as a maintainer. |
Great to see this functionality being made more accessible as an action. I worry that |
Why not include lean update actions in this as well? Actions that automatically update Lean and mathlib versions should be in demand, as Lean is frequently updated. |
I believe standard use would be that some workflow tasks need to run on commits and PRs whilst others need to be run periodically. Consequently they must be separate actions. Also separate actions allow more per repo customization and better feedback when something fails. |
I was exaggerating when I wrote "must be separate actions", the comment above explains a style of having one action with multiple functionality where different functionality is selected using input variables. I believe above it was decided to opt for the style of separate actions. In this use case I believe separate actions will be more comfortable for the majority of people who use it. However my experience of lean is much less than my experience with github actions so it is for others with more lean experience to decide! |
Thanks! I will move over the current version and update documentation to reflect the change. |
@oliver-butterley this is a good point. If the vision is to have multiple action repos for the periodic and push/PR actions, I had originally thought that it may make sense to have two actions in one repository, but it seems like GitHub doesn't recommend this. This is actually a requirement for publishing the action on GitHub Marketplace. Note, we don't have to publish the action on GitHub marketplace in order for Lean projects to use it.
|
My understanding is that |
Alright, thanks for the context. @semorrison I have moved the work which was done for this issue to leanprover/lean-action and created a few initial issues there from todos in this issue, including one to track an initial beta release. Additionally, I did an initial test of |
Given that lean-action has had a v1 release, I think we can close this! Thank you very much, @austinletson! |
We should create a GitHub action that users can add to their
.github/workflows/ci.yml
file (and indeed,lake init
can create such).It should automatically:
lake exe cache get
lake build
lake test
Probably also, but certainly with an easy mechanism to opt-out (that is explained on failure)
lean4checker
on the project (make it easy to run in a cron job, as this can slow down CI)It could also:
lake update && lake build
, and reports (either via emails, notifications, or opening PRs) the result.The text was updated successfully, but these errors were encountered: