Skip to content
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

Refactor teal.gallery into a directory structure for individual shiny apps #31

Merged
merged 34 commits into from
Jul 19, 2023

Conversation

vedhav
Copy link
Contributor

@vedhav vedhav commented Jul 10, 2023

Closes #29 and #20

@vedhav
Copy link
Contributor Author

vedhav commented Jul 13, 2023

Abandoning this branch and PR in favor of the inst/apps structure.

@vedhav vedhav closed this Jul 13, 2023
@vedhav vedhav reopened this Jul 13, 2023
@vedhav vedhav marked this pull request as ready for review July 17, 2023 15:04
@vedhav vedhav force-pushed the 29_refactor_app_structure@main branch from e6bc4c9 to 3b16e5c Compare July 18, 2023 12:39
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a next big step let's do the docs workflow. You will find a good example in tlg-catalog repo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the CI for this and tested the deployment in fork: https://vedhav.github.io/teal.gallery

sys.source(".Rprofile")
options(renv.config.cache.symlinks = FALSE)
options(renv.config.install.remotes = FALSE)
renv::restore(clean = TRUE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is quite lenghty command to complete. At the current moment it's 40+ mins and still counting... for multiple apps...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, the cache does not seem to work. But once the renv cache works this should not take too long for renv.lock that has no change. I haven't debugged the cause for this yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In local once the packages are installed it should not take too long. I also made sure that other apps use the same version of the packages so there won't be too much waiting for the second app. This is quite natural for a large shiny app, As far as I know, there is not much we can do about it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we have 9 apps checked on 2 platforms which gives us 18 workflows to be run. Each of them lasts aproximately ~1h (rounding up) which makes each commit "costs" us 18 hours of CI time. That's way to much.

This is quite natural for a large shiny app, As far as I know, there is not much we can do about it.

Yes that's true - that's why I am asking. Do we really want to trigger this on each commit? Maybe trigger it on changes in .lock files only? I was even thinking of abandoning this at all and leave it for deploy action to handle as deploy will have to anyway restore lock files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the idea of triggering it on changes to the lock file. Ideally, the current CI file should be cached based on renv.lock hash but for some incorrect config the cache is not working.

I like abandoning this and merging this with the deploy CI. Additionally, we could benefit from running them in series as most of the package across the renv.lock are same.
Regardless we should fix the renv cache issue to speed up the CI runs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest doing now the latter - i.e. remove it complitely and include that in the deploy CI

@vedhav vedhav force-pushed the 29_refactor_app_structure@main branch from 5334a7f to bb04112 Compare July 19, 2023 06:41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am aware that this is a bigger topic outside of this PR but let me ask you to start thinking about it (but please don't do this here because we would never finish this PR lol).

This .lock file is a snapshot type of data that reflects the state as of certain point in time (most likely: the last update of this file). The whole ecosystem of R packages is moving quite fast and it's very likely that this information become outdated very soon. We need to have some autoupdate functionality to update refs in .lock file to the newest release of any of the dependencies. How to do that? I can't imagine this being a human responsibility so to me that should be handled in CI using bot commits. How to deal with dependencies coming from GH? I was thinking about having DESC field with Remotes section and get gh refs from there. I am open for ideas.

Copy link
Contributor Author

@vedhav vedhav Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree that we should do it, and couldn't agree more that this must be automated.

I can see an additional thing we should do before we do the automatic update:

  • Adding an end-to-end test that just visits every tab automatically and checks if there was any error.

Having an e2e test like that is the only way we can make sure that the updated packages do not break any app. This can also potentially be valuable to find some bugs with the integration of different nest packages. I know it can be done because I remember this was done with the help of {rhino} when we rewrote the FDA pilot (thanks to André who added this) https://github.com/Appsilon/rhino-fda-pilot/blob/main/tests/cypress/integration/app.spec.js
So, all we need to do is replicate that without {rhino}, generalise it and potentially add it in the https://github.com/insightsengineering/r.pkg.template/tree/main/.github/workflows

Copy link
Contributor

@pawelru pawelru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thank you!

@vedhav vedhav merged commit bf2deaa into main Jul 19, 2023
@vedhav vedhav deleted the 29_refactor_app_structure@main branch July 19, 2023 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Refactor the structure similar to shiny apps gallery
2 participants