-
Notifications
You must be signed in to change notification settings - Fork 30
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
GitHub Actions #351
Comments
You can add actions to the marketplace. There are already some actions for GitHub pages, such as https://github.com/crazy-max/ghaction-github-pages, but they don't seem as well developed as doctr (e.g., the one I linked there uses personal access tokens instead of deploy keys). So I think we should make doctr work with actions and add it to the marketplace. |
We'd love to hear if someone has successfully used Doctr as part of a GitHub action, or if the recommended practice is something else entirely? |
@asmeurer Now that Travis CI just announced that they are no longer going to be free for open source beyond a fixed number of trial minutes that don't renew, the mass migration to Github actions is likely to intensify, and we're going to have to do so at some point soon for spyder-ide/spyder-docs . Any plans for this, and any ways we can help (time, funding, testing, etc)? Or is there an alternative for Github actions you would recommend? Thanks! |
I'm open to adding support for any public CI system to doctr. GitHub actions seems like a common alternative. I think we should try to get it set up so that it is in the marketplace. I don't know how much time I will have myself to work on it, though, so if someone wants to pick up the work, please do. I can answer any questions and help review things, and also give people push access if it is needed. |
I should note that there are already some things on the GitHub actions marketplace that push to GitHub pages. But none of the options I saw handle things as nicely as doctr, so there's still room for doctr to do better. |
@ccordoba12 's going to talk to you about it to see what we can work out. Thanks! |
Since Travis now no longer supports OSS at all, cf #371 (comment), moving to Github Actions seems inevitable. I played around briefly with deploying documentation to Still, I kind of would love to keep the "doctr" package involved, mostly because otherwise it would make the branding of my doctr_versions_menu package (which is still used in the Action) a little awkward ;-) Thus, I'd be rather enthusiastic about seeing the doctr package consolidate and include something like the steps I've now done manually in the Github Action. |
So you don't need a deploy key to push to gh-pages from GitHub actions? I have a WIP at #372 but it's basically reusing the exact same logic as Travis. If we don't need a deploy key, that's interesting. I haven't seen any examples like that before. If that's the case guess doctr could still be useful for its syncing. Either way, I haven't had a chance to continue work on this. If you want to pick it up, let me know. |
Yes, I was pleasantly surprized to find out that apparently you don't need a deploy key for any action that involves only the repository that triggered the workflow. A "git push" works directly, and for marketplace actions it seems there is a pre-defined If I understand that documentation correctly, for use cases where there is a separated "docs" repo, i.e. you're not pushing to the repo that triggered the workflow, you'd still need a separate deploy key, though. I suppose Doctr would still want to cover that use case, although it's not something I'd use, personally. I don't think I'll be available to work on GH Actions integration for Doctr directly in the near future, but if @ccordoba12 and @CAM-Gerlach are still on this, I would very much approve (and be happy to test it in the context of |
I see, so we still need the full logic for pushing to another repo, which is an important use-case. I think for my PR, we mainly need to set up the GitHub actions yaml file, with all the same tests as from the Travis file. And we also should implement the logic for not needing a deploy key for the same repo (should be easy). |
I was just thinking about migrating SymPy's doctr job from Travis to Actions but I wasn't actually sure what doctr was. I've just taken a little time to go through the README here, read a few issue like this one, and look at alternatives in the actions marketplace. I hadn't realised until reading the README that doctr was designed very specifically for Travis and can't immediately be used with Actions. I see that there is #372 which looks to make it possible to use doctr with Actions but seems to have stalled 2 months ago. I'm not familiar with this repo but from a quick glance the PR looks like a complete rewrite of this codebase. There are alternatives in the Actions marketplace that seem to be used. The one linked above is: There are other possibilities though: Note both of those are projects that are aimed at Github pages specifically but actually all that's really needed is something to handle the secrets involved in pushing to another repo. There are also generic "push to repo" actions available (these are just first hits from a google search for "github actions push to another repo" - I saw more developed looking ones earlier but don't have the links handy): I'm wondering now if the rationale for using
I haven't looked very hard and haven't tried anything but from a quick skim of options my current favourite is: |
Yep, that's the way to go. I've made a demo here: I've probably overcomplicated things by using artifacts in that demo. If you already have an actions config that has a job that builds the docs then the deploy step is just something like:
Obviously you need to actually set up the deploy keys for the two repos for that to work though. From the README in the demo:
The reason I used artifacts in the demo is because it makes it possible to download the built docs for a PR once the Actions checks have completed which I think would be useful. We also probably want to use artifacts for other things like the benchmark/coverage reports. |
For another example, we ported spyder-ide/spyder-docs from Doctr to Github Actions in spyder-ide/spyder-docs#218 ; on one hand, we deploy to the
We used JamesIves/github-pages-deploy-action since we saw it recommended elsewhere, it has about the same number of stars and actively developed but not sure if there's a clear winner between the two. |
Part of the original motivation for doctr is setting up the deploy key stuff for you. I'm glad to see that action is using a deploy key. When I looked a year ago, all the options on the marketplace were using personal access tokens, which are worse (a deploy key gives access to a single repo, whereas a personal access token gives full access to all the repos of the person who created it). I'm not a fan of how either peaceiris/actions-gh-pages or JamesIves/github-pages-deploy-action recommend using a personal access token at all. They should generally be avoided. |
@asmeurer also, doctr handles versioned docs in an elegant way. It took me quite a few steps to achieve the same with those GHA. So the key setup is not the only advantage. |
Yeah, and for the simple case of deploying to the
I'd be very interested to understand how you handled versioned docs, @ocefpaf , since we had to devote quite a bit of effort to that issue. At least how we had it set up (with Sphinx-Multiversion), it was completely orthogonal to doctr and was all handled by our build system and scripts, and was completely transparent to the deploy and CI layer such that no changes were needed to any of that when we ported over to Github Actions, . Perhaps that had to do with the basic design of Sphinx-Multiversion, with all the docs built simultaneously rather than independently by branch. |
@CAM-Gerlach Not the OP, but this is where I'd like to plug Doctr Versions Menu |
Ah, I see—thanks @goerz . Its too bad we weren't aware of that when we added multiversion support some months back; it takes a very different approach from Sphinx-Multiversion (making multi-version support part of the deploy rather than the build stage, and operating on each branch individually rather than orchestrating one synchronized pipeline) that has some advantages and disadvantages, but certainly would have been worth considering as an option. However, especially for a basic use case (deploying to a name: Docs
on: [push]
jobs:
deploy_docs:
name: Build Sphinx docs
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python 3.8
with:
python-version: 3.8
- name: Install Tox and other build requirements
run: pip install tox zip-files
- name: Run Tox
run: tox -e docs
- name: Run doctr-versions-menu
run: doctr-versions-menu
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to
FOLDER: <BUILD_DIRECTORY> # The folder the action should deploy |
Also, @asmeurer the JamesIves GH pages action does describe step by step how to use it with a deploy key; its certainly more involved than using Doctr and I'd miss having it there, but its mostly the same underlying process (just without Doctr's automation and nicities), and not as tricky as with Travis I don't think. It does also mention use with an access token, but it doesn't actually describe the specifics, rather referring users to the general Github docs if they are interested in that route. |
I've only recently (since around December, when Travis effectively shut down) started to move from Travis to Github Actions. Right now, the "recommendations" I put in Doctr-Versions-Menu for using it with Github Actions are basically just what I've cooked up personally, and tried out in some projects (e.g. krotov and the slightly more elaborate qalgebra). They're not necessarily best practice and I'm very open to figuring out better ways to do this, like using an existing Marketplace Action. I'm actually also waiting to see how Doctr will ultimately decide to deal with support for Github Actions. If Doctr eventually provides its own Action for everything, I'd probably want to use that. If not, that is if Doctr remains focused on Travis, which I'm not going to support going forward, I'm likely to rename "Doctr-Versions-Menu" to "Docs-Versions-Menu" and focus its documentation on deployment with Github Actions. So far, my "manual" approach seemed relatively straightforward to me. It seemed like existing actions for deploying to Github Pages wouldn't be helping much, really only replacing the "rsync" step. There's some "nice" optional stuff I'm doing like generating the Again, I'm open to switching to an appropriate Action, or even possibly writing one. I'm personally really only interested in the "simple" case of deploying to the |
The reason why there are two jobs: I always want to build the documentation, even on pull-requests and topic branches, to make sure that it works. However, I only want to deploy to Anyway, I don't want to hijack this thread too much... You can open an issue on the doctr-versions-menu repo or just email me to discuss this further. |
Hi all. As you've probably noticed, very little progress has been made on this. I've basically been too busy to work on this. Heavy development on doctr is very time consuming, as it requires a lot of manual testing. If people still want to see doctr updated for GH Actions, most likely someone else will need to pick up the work on #372 (or start anew if that seems simpler). If someone is interested in working on it, I'd be happy to give you the necessary permissions to make it happen. |
Thanks for the update, @asmeurer. As I understand it, the advantages/features of Nowadays, the JamesIves/github-pages-deploy-action has added and simplified the authentication functionality with v4.0, allowing deploying to the same repo (the most common case) with no extra configuration and fully supporting both token and ssh-key authentication for deployment to a different one with relatively simple and documented setup. peaceiris/gihtub-pages-action offers very similar functionality as well. Both seem to offer most of the additional features/configuration doctr does, including custom deploy branch, repo, directory, etc., selection of what branches/tags to build from, exclude of files, etc. The main things it appears doctr offers over these options are walking the user through the process of running the Other than adding support for running a command on the remote repo (@goerz 's use case), given these existing actions pretty much cover the deployment functionality, maybe it would be more sustainable to focus doctr more tightly on just providing the Unfortunately I can't commit time right now to implementing it, especially since I'm familiar with doing it myself, but it would focus on the part of |
I haven't used GitHub actions deploying enough to comment fully, but that sounds reasonable. The main point of doctr was always to handle the secrets stuff for you, since doing it manually is a huge pain, and you're liable to mess things up in a way that leaks account secrets. Another advantage is that doctr will always prefer the deploy key method over creating a token, unless explicitly told to. Deploy keys provide push access only to a single repo, whereas if a token leaks, it's like leaking your GitHub password. Deploy keys can also easily be revoked by anyone with push access. The syncing functionality of doctr is also useful, that is, being able to place files in the root of gh-pages, and correctly doing things like deleting files. It's not all that complicated, but is more work than simply |
We're in the GitHub actions beta.
I'm not sure if there's really much for doctr to potentially do with GitHub actions. I think it can be set up much easier to push to gh-pages, since it already has the permissions. Maybe it could be useful for the syncing stuff.
The text was updated successfully, but these errors were encountered: