lfortran / lcompilers_frontend

The sources of the web LFortran GUI interface
https://dev.lfortran.org/
MIT License
14 stars 9 forks source link

Building this repository using webhook #31

Open Shaikh-Ubaid opened 2 years ago

Shaikh-Ubaid commented 2 years ago

Looks like it can be done: https://kontent.ai/blog/how-to-trigger-github-action-using-webhook-with-no-code/

  # Allows external webhook trigger
  repository_dispatch:
    types:
      - webhook

_Originally posted by @certik in https://github.com/lfortran/lcompilers_frontend/issues/3#issuecomment-1215150243_

Shaikh-Ubaid commented 2 years ago

This is the missing piece that we need to (I guess) figure out and then (hopefully) things should work, that is:

Shaikh-Ubaid commented 2 years ago

doubt: Please, could someone possibly share if it should be the wasm_builds repository triggering the CI of this repository? Because the resources needed by this repository to build are available at wasm_builds, so until wasm_builds completes its build and deploy stages, we are unable to fetch the required files.

certik commented 2 years ago

Right. Probably that's right. Note that there is a delay when publishing to the GitHub pages.

Shaikh-Ubaid commented 2 years ago

Right. Probably that's right. Note that there is a delay when publishing to the GitHub pages.

Got it. Thank you for the clarification.

certik commented 2 years ago

Just setup the webhook from lfortran --- after it pushes the commit into wasm_builds.

certik commented 2 years ago

I think we have time at our CI due to the Windows build. So add 60s delay after "git push to wasm_builds", so that GitHub has enough time to publish the page, then issue the "webhook" from the same CI task at LFortran. That should work robustly.

Shaikh-Ubaid commented 2 years ago

I think we have time at our CI due to the Windows build. So add 60s delay after "git push to wasm_builds", so that GitHub has enough time to publish the page, then issue the "webhook" from the same CI task at LFortran. That should work robustly.

Got it.

Shaikh-Ubaid commented 2 years ago

This work flow https://github.com/lfortran/wasm_builds/actions/runs/2878330373 at wasm_builds took around 1 min, 7 secs. It seems 60 secs may not be robust. Shall we wait 120 secs?

certik commented 2 years ago

Yes. And I wonder if we should not do automatic updates like this --- it seems very fragile.

We could create a PR after 120s in this repository, that updates the hash. Then we do not need to setup any webhooks, we just create a PR, and the CI in this repository will run and upload a testing website and we can manually review that everything works, and then just merge manually.

And if we want things to work automatically, we can later set "merge if pipeline succeeds" button at the PR.

So I think that is a better design, more robust. What do you think?

Shaikh-Ubaid commented 2 years ago

What do you think?

It seems https://github.com/lfortran/lcompilers_frontend/pull/24 might be a possible solution.

We could create a PR after 120s in this repository, that updates the hash. Then we do not need to setup any webhooks, we just create a PR, and the CI in this repository will run and upload a testing website and we can manually review that everything works, and then just merge manually.

Automated commits might/would have looked nice. Though, this approach also seems fine.

certik commented 2 years ago

I am not opposed, but I am worried about the complexity / fragility. It's hard to add just one latest commit automatically, so far we didn't manage. So the PR approach seems like something that we can manage, and we can iteratively improve it (up to and including full automation), while being 100% robust at every step all the time.