pyvec / naucse-hooks

Hooks for naucse.python.cz
MIT License
3 stars 3 forks source link

Trigger GitHub CI workflow dispatch instead of Travis CI #20

Closed Kobzol closed 2 years ago

Kobzol commented 2 years ago

This PR changes deployment trigger from Travis to GitHub. Now only a single route /trigger is exposed. When called with

{"repository": "...", "branch": "..."}

it will look inside naucse, find the corresponding repository and check if it should be updated (same as before). If yes, the build will be triggered via a Github Actions CI workflow in the pyvec/naucse.python.cz repository (https://github.com/pyvec/naucse.python.cz/pull/707).

encukou commented 2 years ago

Would it be possible to add the new hook without removing everything else?

Several courses are live right now; deploying this would break auto-deployment for them.

I also wonder if this wouldn't be better off as a separate app, since doesn't really share anything with the existing one. @mikicz, do you want to keep running the naucse hooks? Or should I set up hooks for a GHA-based workflow elsewhere?

mikicz commented 2 years ago

I'm not planning to get rid off my VPS any time soon, so happy to keep running the hooks, also happy to deploy any new versions if they need to be etc!

Do you also want help with the review of the code? I can do that as well if you'd like, although am probably missing a bit of the context here

Kobzol commented 2 years ago

The overarching goal here is to get rid of courses that exist as (branches in) forks of naucse. Ideally, courses should be separate repositories. In addition, to make better use of GH Actions, we'd like to do something like this:

1) naucse will have a GH CI workflow that will rebuild and redeploy the website. 2) A new trigger (hook) website will be deployed (this PR). It will offer an endpoint that will trigger the naucse GH workflow and thus redeploy naucse. The endpoint will not be authenticated in anyway, it will just receive a repo/branch combination and check that it is inside naucse and that it has some changes. 3) Each course will be a separate repository. It will have a GH CI workflow that will build the course into a separate branch (e.g. compiled). And at the end of the workflow, it will send a POST request to the trigger application, which will in turn trigger a rebuild of naucse.

encukou commented 2 years ago

I've added one more simplification, and a rudimentary "front page". @Kobzol, does this look OK?

@mikicz, if you want to take a look, please do, but I don't think it's necessary. Thanks for running the hooks!

Kobzol commented 2 years ago

@encukou It looks OK, thanks!

encukou commented 2 years ago

@hroncok Would it be appropriate to use @pyvecpusher's token for naucse-hooks (GHA)?