NSLS-II / scientific-python-cookiecutter

a tutorial and 'cookiecutter' template for a scientific Python library
https://nsls-ii.github.io/scientific-python-cookiecutter/
BSD 3-Clause "New" or "Revised" License
115 stars 41 forks source link

migration from Travis to GitHub actions #102

Closed vstadnytskyi closed 1 year ago

vstadnytskyi commented 3 years ago

Did you guys consider migrating from Travis to GitHub Actions? It is one less service to worry about. Or do you think it would be useful to provide instruction on how to set up GitHub Actions instead of Travis-ci?

vstadnytskyi commented 3 years ago

I have learned today that Travis-CI is pretty much paid only. I am going to figure out how to use GitHub Actions and I will share whatever I learn with you guys.

danielballan commented 3 years ago

Yes, we have moved most of our projects over to GH Actions and we have a decent pattern for it now. @AbbyGi plans to update the cookiecutter and docs.

vstadnytskyi commented 3 years ago

This is awesome! I did figure out pytests already but I have been really struggling with creating the documentation files. I will definitely look into some of the links you made for the BlueSky project or wait for @AbbyGi

vstadnytskyi commented 3 years ago

Great to see the progress in transition from Travis-CI to Github Actions. I have looked into some of the files and copying it to my repositories (created with the cookiecutter).

I am struggling with "Deploy keys". I think it is one the last pieces to make docs publishing working via Github Actions.

In the GitHub workflow file, there is a variable "secrets.ACTIONS_DOCUMENTATION_DEPLOY_KEY". I understand that I need to deploy a key in settings for my repository.

Screen Shot 2021-08-17 at 9 36 50 AM

but I really struggle with it because of lack of understanding how SSH public keys work. I do need to learn more about it. But also I appreciate if one have a link to how to do it, so I can move ahead of setting up GitHub actions.

https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key

vstadnytskyi commented 3 years ago

OK. I think I figure out how I generate SSH key for travis-ci. Not a surprise it was in the documentation for the cookiecutter.

vstadnytskyi commented 3 years ago

I have figured it out. Just an action of writing to you guys always great help.

The DoTo list on top should include on how to generate keys: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-create-ssh-deploy-key

and that 'ACTIONS_DEPLOY_KEY' in the docs above should be replaced with 'ACTIONS_DOCUMENTATION_DEPLOY_KEY' - this is what you use in GitHub workflow files.

This was crucial piece I was missing.

Also, It seems like you can generate one public/private rsa key pair and use it in all the repositories. Right? But it might not be wise. Is that correct?

The command ssh-keygen -t rsa -b 4096 -C "$(git config email@address.com)" -f gh-pages -N ""

generates a pair of files in the directory. In my case, I ran them in the repository I was working in, so know I have two files that should not be publicly posted. I had three choices: 1) add names to .gitignore 2) move them elsewhere. 3) delete completely and generate new pair whenever I need to create a new pair. Which one would you recommend? I think choice number 3 is a way to go, it is more work, since you need to generate the pair every time. But it one time generation and it is probably more secure to have different pairs in different repositories in any case.

Meteodan commented 1 year ago

Hi all, I have been a user of this cookiecutter in the past and like someone said on one of the other open issues, it has been an absolute godsend in my work, so thank you! I am commenting on here as I'm getting ready to bootstrap another scientific python package for my work and I've noticed that many things have changed in the overall ecosystem since I first started using it. Most notably, the fact that Travis CI is no longer free and everyone seems to be migrating over to Github Actions (which I have no idea how to use but need to learn). I was happy to see that this group is working on it. My question is if it would be advisable to go ahead and start using the updated code in #105 or if I should wait until it has been merged. Also, is there an updated version of the documentation?

asmeurer commented 1 year ago

FWIW, I've switched from doctr (which is effectively dead at this point as it only supports Travis) to https://github.com/JamesIves/github-pages-deploy-action using ssh-key (a deploy key is not the default for that repo, but I would prefer it as it's more secure). You have to create and upload a deploy key manually unlike doctr which helped you do it automatically (see https://github.com/marketplace/actions/deploy-to-github-pages#using-an-ssh-deploy-key-), but other than that it more or less works just as well.

You may also be interested in the setup we use for SymPy (and have used in many other repos) to upload a preview of the docs on PR builds, which is completely separate from that action. https://github.com/sympy/sympy/blob/master/.github/workflows/docs-preview.yml and https://github.com/sympy/sympy/blob/master/.circleci/config.yml

asmeurer commented 1 year ago

I guess you are using https://github.com/peaceiris/actions-gh-pages instead. I'm curious if you find any any advantages of that one vs. the JamesIves one.