dwyl / mvp

📲 simplest version of the @dwyl app
https://mvp.fly.dev
GNU General Public License v2.0
84 stars 2 forks source link

Create new Github Action for review apps #229

Closed SimonLab closed 1 year ago

SimonLab commented 1 year ago

Create new Github action file to create review apps

codecov[bot] commented 1 year ago

Codecov Report

Merging #229 (2828396) into main (302c079) will decrease coverage by 0.32%. The diff coverage is n/a.

@@             Coverage Diff             @@
##              main     #229      +/-   ##
===========================================
- Coverage   100.00%   99.67%   -0.33%     
===========================================
  Files           13       13              
  Lines          309      309              
===========================================
- Hits           309      308       -1     
- Misses           0        1       +1     
Impacted Files Coverage Δ
lib/app_web/live/app_live.ex 99.07% <0.00%> (-0.93%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

SimonLab commented 1 year ago

Creating review app failed: image

I can see a few issues already From https://github.com/marketplace/actions/pr-review-apps-on-fly-io

By default, Fly apps will be named with the scheme pr-{number}-{repo_org}-{repo_name}.

However the name is pr-229-null-null So the org_name and repo_name is not found/set properly. Seems an open issue here: https://github.com/superfly/fly-pr-review-apps/issues/10

Then mix not found in path. I might need to copy more things from our working Github action to install Elixir and Phoenix first.

SimonLab commented 1 year ago

Added Elixir, however: image

environment DATABASE_URL is missing

SimonLab commented 1 year ago

After looking at the code in https://github.com/superfly/fly-pr-review-apps/blob/main/entrypoint.sh I think the attach postgres is not up to date with the latest flyctl version (ex: the --postgres-app flag has been removed). I'm going to do some manual test and try to deploy multiple Phoenix application connected to the same Postgres cluster. If this work I'll be able to add the specific flyctl commands we want to run in our Github action.

nelsonic commented 1 year ago

Good plan. Hope it works. 🤞

SimonLab commented 1 year ago

I've managed to create manually using the flyctl commands a review app and attach the current database to this new app. I've also managed to create a Github action that can run a bash script which use the flyctl command. I had a few blockers while doing this so I'll write a bit of documentation on how to do this. I'm now able to create the full script to have review apps created/removed when a PR is open/closed. I just need a bit of time to make sure I have all the edge cases cover (PR is updated -> redeploy, do not create review app when main branch is updated...)

SimonLab commented 1 year ago

Closing in favour of #230