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

Update generate & Add template for GitHub container action #26

Merged
merged 12 commits into from
May 1, 2020

Conversation

erikmd
Copy link
Member

@erikmd erikmd commented Apr 26, 2020

This PR is a follow-up of a discussion with @Zimmi48, and of the release of docker-coq-action:

https://github.com/coq-community/docker-coq-action/releases/tag/v1.0.0

see the commit messages for more details

@erikmd erikmd added documentation Improvements or additions to documentation enhancement New feature or request labels Apr 26, 2020
erikmd added 2 commits April 26, 2020 23:33
Note: GitHub actions relies on the ${{ _ }} syntax, which conflicts
with mustache.

This can be workarounded by changing the delimiters beforehand, as
suggested by theK42 <https://stackoverflow.com/a/13695429/9164010> and
documented in https://mustache.github.io/mustache.5.html#Set-Delimiter
@erikmd erikmd force-pushed the update-generate+add-github-action branch from c2abac4 to 2a94c07 Compare April 26, 2020 21:33
coq-action.yml.mustache Outdated Show resolved Hide resolved
coq-action.yml.mustache Show resolved Hide resolved
generate.sh Outdated Show resolved Hide resolved
generate.sh Outdated Show resolved Hide resolved
@Zimmi48
Copy link
Member

Zimmi48 commented Apr 27, 2020

@liyishuai As this PR takes us even further away from your own proposal to use a Makefile instead of the generate.sh script, maybe you want to participate to reviewing it and weight your own concerns in?

generate.sh Outdated Show resolved Hide resolved
@liyishuai
Copy link
Member

My main purpose for a Makefile was to avoid copying files or commands. Whatever approach that better automates the generation process is good to me.

@erikmd
Copy link
Member Author

erikmd commented Apr 29, 2020

@liyishuai

Whatever approach that better automates the generation process is good to me.

👍 BTW note that from the current version of the PR, it'd be easy to add other yes/no (or open) questions within the script, e.g. to ask whether the user would like to get a Travis CI configuration or not, etc. (although such extra changes would deserve a separate PR, maybe)

generate.sh Outdated Show resolved Hide resolved
@Zimmi48
Copy link
Member

Zimmi48 commented Apr 29, 2020

FTR, I also tried to install the npm "mustache" package but it doesn't support YAML, only JSON (like the OCaml version IIUC).

@erikmd erikmd force-pushed the update-generate+add-github-action branch from f54013c to 7303c58 Compare April 29, 2020 09:54
@erikmd
Copy link
Member Author

erikmd commented Apr 29, 2020

FTR, I also tried to install the npm "mustache" package but it doesn't support YAML, only JSON (like the OCaml version IIUC).

Yes but this is not a issue at first sight, the mustache ecosystem is not very uniform, but I guess that the current script should be OK with any mustache supporting YAML − cf. the remark in the README anyway:

We suggest you rely on a YAML-compatible mustache implementation such as ruby-mustache (available for instance as an Ubuntu or Debian package).

@erikmd
Copy link
Member Author

erikmd commented Apr 29, 2020

(FTR that README remark had been added in #17 )

@Zimmi48
Copy link
Member

Zimmi48 commented Apr 29, 2020

I confirm the current script works well with mustache-go.

@Zimmi48
Copy link
Member

Zimmi48 commented Apr 29, 2020

@erikmd What do you think of removing the prompt and making the generation of files entirely automated based on whether some variables are set or not in the meta.yml file? For instance, right now, we already have one such variable for travis because we put the badge in the README only if it is set. We could do the same for the GitHub Action (and include a badge as well).

@Zimmi48
Copy link
Member

Zimmi48 commented Apr 29, 2020

One major interest of a fully automated generation process (without any prompt) would be that we could add some more automation: CI checks that the generated files correspond to the ones checked in the repository / a call to @coqbot to regenerate the files based on the latest version of the template and the meta.yml in a PR...

@Zimmi48
Copy link
Member

Zimmi48 commented Apr 29, 2020

One inspirational example is the automation that is used to manage https://github.com/conda-forge (see in particular https://github.com/conda-forge/conda-smithy).

@erikmd
Copy link
Member Author

erikmd commented Apr 29, 2020

@erikmd What do you think of removing the prompt and making the generation of files entirely automated based on whether some variables are set or not in the meta.yml file? For instance, right now, we already have one such variable for travis because we put the badge in the README only if it is set. We could do the same for the GitHub Action (and include a badge as well).

Yes, I fully agree with your idea :-)
(But I guess I won't be able to work on this before the evening.)

One major interest of a fully automated generation process (without any prompt) would be that we could add some more automation: CI checks that the generated files correspond to the ones checked in the repository / a call to @coqbot to regenerate the files based on the latest version of the template and the meta.yml in a PR...

👍 Looks great (IINM you suggest to incorporate in the Travis/GitHub actions config a job that would run on the target project repo, clone the coq-community templates repo, and do a checkup?), anyway that feature itself would probably deserve a separated PR ;-)

@Zimmi48
Copy link
Member

Zimmi48 commented Apr 29, 2020

👍 Looks great (IINM you suggest to incorporate in the Travis/GitHub actions config a job that would run on the target project repo, clone the coq-community templates repo, and do a checkup?), anyway that feature itself would probably deserve a separated PR ;-)

Yes, that's just an idea, but worth being discussed further of course. The problem of automatically checking compatibility with the latest templates would be that it would force people to manually update at every iteration of the templates, even if that wasn't needed for them. A possible solution could be:

  1. Doing releases of the templates repo, at a rate TBD, so that updates happen only at a new release;
  2. Providing a way to automatically migrate meta.yml files (if a variable is renamed, or if one is introduced whose value was implicit previously);
  3. Having @coqbot open PRs on every coq-community repository with a meta.yml file to update the meta.yml and the auto-generated files.

Just food for thought for now. Related to #20.

@erikmd erikmd force-pushed the update-generate+add-github-action branch from b6d0fcc to 11de289 Compare April 30, 2020 22:51
@erikmd
Copy link
Member Author

erikmd commented Apr 30, 2020

Hi @Zimmi48

What do you think of removing the prompt and making the generation of files entirely automated based on whether some variables are set or not in the meta.yml file? For instance, right now, we already have one such variable for travis because we put the badge in the README only if it is set. We could do the same for the GitHub Action (and include a badge as well).

done, feel free to react if you'd like that I refactor the generate.sh in another way.

[…] Just food for thought for now. Related to #20.

BTW this new version of the PR maybe reduces a bit the "discoverability" of the GitHub action template, as the selected examples do not contain action: true, anyway this just amounts to say this is related to #24 :-)

@Zimmi48
Copy link
Member

Zimmi48 commented May 1, 2020

BTW this new version of the PR maybe reduces a bit the "discoverability" of the GitHub action template, as the selected examples do not contain action: true, anyway this just amounts to say this is related to #24 :-)

Exactly!

Copy link
Member

@Zimmi48 Zimmi48 left a comment

Choose a reason for hiding this comment

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

This looks great! Thank you very much.

README.md Outdated Show resolved Hide resolved
generate.sh Outdated Show resolved Hide resolved
@erikmd erikmd force-pushed the update-generate+add-github-action branch 2 times, most recently from 3cb3a8c to b633986 Compare May 1, 2020 13:45
@erikmd
Copy link
Member Author

erikmd commented May 1, 2020

done, thanks @Zimmi48 for the review! in passing I fixed the condition related to travis:/action: so that the CI badge in the README will be inserted iff the .yml CI file is generated.

@erikmd erikmd force-pushed the update-generate+add-github-action branch 2 times, most recently from 7bd2371 to 8369930 Compare May 1, 2020 14:34
@erikmd
Copy link
Member Author

erikmd commented May 1, 2020

sorry wait a minute before merging, I did a too aggressive rebase -i…

@erikmd erikmd force-pushed the update-generate+add-github-action branch from 8369930 to 9f2a454 Compare May 1, 2020 14:40
@erikmd
Copy link
Member Author

erikmd commented May 1, 2020

@Zimmi48 done :) − sorry for the noise…

Copy link
Member

@Zimmi48 Zimmi48 left a comment

Choose a reason for hiding this comment

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

I don't think generating default.nix or not should be based on whether travis is activated. You could test tested_coq_nix_versions instead.

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

Zimmi48 commented May 1, 2020

In particular, we might want to add support for building with Nix using GitHub Actions as well.

@Zimmi48
Copy link
Member

Zimmi48 commented May 1, 2020

Feel free to merge by yourself BTW 😉

@erikmd erikmd force-pushed the update-generate+add-github-action branch from 9f2a454 to f623a57 Compare May 1, 2020 14:54
@erikmd
Copy link
Member Author

erikmd commented May 1, 2020

@Zimmi48 indeed; updated as suggested.

@erikmd erikmd merged commit cb4cced into coq-community:master May 1, 2020
@erikmd erikmd deleted the update-generate+add-github-action branch May 1, 2020 14:55
This was referenced May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants