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

[feature:] setup github actions to build main branch and dev branch case studies #51

Open
2 of 3 tasks
k-doering-NOAA opened this issue Jan 15, 2025 · 9 comments
Open
2 of 3 tasks
Assignees
Labels
kind: feature New feature or request

Comments

@k-doering-NOAA
Copy link
Member

k-doering-NOAA commented Jan 15, 2025

Describe the situation that led to the request and a solution

initiating GitHub actions to:

  • update the FIMS package to the latest main branch version and rerun the main branch of the case-studies repository on a regular basis (already set up this way)
  • update the FIMS pkg to the latest dev branch version and rerun the dev branch of the case-studies repository run on a regular basis, maybe even every push to dev
  • Have Kelli push the commit to set up the CRON jobs so that the email notifications go to her.

Alternative solutions

use the send email action to send Kelli notifications instead.

Statistical validity

No response

Additional context

No response

@k-doering-NOAA k-doering-NOAA added kind: feature New feature or request status: triage_needed This is not approved for this milestone, do not work on it yet labels Jan 15, 2025
@k-doering-NOAA k-doering-NOAA self-assigned this Jan 15, 2025
@k-doering-NOAA
Copy link
Member Author

@kellijohnson-NOAA , to make it so you can get a notification for the cron run, could you make a push to main that edits this line?

- cron: '0 0 * * 0' # runs At 00:00 on Sunday

For example, I think you could simply change the time at which it runs, e.g., At 01:30 on Sunday. Times are in UTC, I believe.

@k-doering-NOAA
Copy link
Member Author

@Bai-Li-NOAA I think you may be able to help here - I'm trying to figure out how to " update the FIMS pkg to the latest dev branch version and rerun the dev branch of the case-studies repository run on a regular basis, maybe even every push to dev".

It looks like the version of FIMS download is defined here:

remotes::install_github("NOAA-FIMS/FIMS")

By default, it will be installing the main branch. Can you think of a way to keep installation of FIMS in this file, but install the main version of FIMS if the GHA is running on main, and install the dev version of FIMS if the GHA is running on a branch called dev? One hacky solution would be to have the GHA on dev edit this file before it runs, it seems like there should be a more transparent way.

Other thoughts are I'm not sure what the default should be for feature branches, or if the case studies qmd is running on someone's local computer.

@kellijohnson-NOAA I think this question is for you: Is the goal of the dev branch for case studies is just a place for the dev version of FIMS to be installed, or will case study developments happen in dev before they are pushed to main?

@Bai-Li-NOAA
Copy link
Contributor

@k-doering-NOAA, I was thinking we could modify line 15 in the setup.qmd file with the following code to ensure that when folks are running case studies on a non-main branch, FIMS is always installed from the dev branch:

on_main_branch <- system("git branch --show-current") == "main"

if (on_main_branch){
  remotes::install_github("NOAA-FIMS/FIMS")
} else {
  remotes::install_github("NOAA-FIMS/FIMS", ref = "dev")
}

Not sure if this will work on all OSs or if the git command is usable in R setup on GitHub Actions. If that’s an issue, we could adjust the "Install packages" step in .github/workflows/render.yml to include remotes::install_github("NOAA-FIMS/FIMS", ref = "dev"). Let me know if you would like me to test either approach in a branch!

@kellijohnson-NOAA
Copy link
Contributor

@k-doering-NOAA regarding "Is the goal of the dev branch for case studies is just a place for the dev version of FIMS to be installed, or will case study developments happen in dev before they are pushed to main?" My response is I would like main to be static in between releases and have the case-studies repository operate a bit more like the FIMS repository where changes happen in branches off of dev and the pull requests go to dev. Then when there is a FIMS release, the case studies dev branch is ready to be merged into main at the same time.

kellijohnson-NOAA added a commit that referenced this issue Jan 16, 2025
Pushing to make sure that I get notifications from this GitHub action.
Part of #51
@k-doering-NOAA
Copy link
Member Author

@Bai-Li-NOAA , thank you for the solution! That sounds like it could work well :)

@kellijohnson-NOAA , thanks for clarifying the intentions!

An alternative/addition would be to use renv to control versions of all packages - although I'm not sure if that would play well with the main/dev setups (for example, it would seem we would always be making commits that change dev to main when we want to update main with the latest release, and that seems a bit tedious). However, it could help with other things, e.g., making sure the main branch case studies continue to work!

k-doering-NOAA added a commit that referenced this issue Jan 27, 2025
k-doering-NOAA added a commit that referenced this issue Feb 11, 2025
@k-doering-NOAA k-doering-NOAA removed the status: triage_needed This is not approved for this milestone, do not work on it yet label Feb 11, 2025
k-doering-NOAA added a commit that referenced this issue Feb 11, 2025
Download main branch of Fims if using main in the feature branch name

Co-authored-by: Bai Li - NOAA <[email protected]>
Co-authored-by: Andrea-Havron-NOAA <[email protected]>
Co-authored-by: alexjensen-NOAA <[email protected]>
@k-doering-NOAA
Copy link
Member Author

k-doering-NOAA commented Feb 11, 2025

For code club today, we worked on code that would allow a main branch to use the main version of FIMS, any branch that includes the word "main" in its name to use the main version of FIMS, and any other branch would use the dev version of FIMS. We worked in the branch called "gha".

We weren't sure how often dev should be updated practically, so we might always expect it to be broken fairly often, but the main branch to work

Future steps to take:

  • Document how this works for users
  • optional: Use repository "ruleset" to enforce a "main" naming convention (potentially?), if it would help people know how to name their branch (example here of rules with dev and main naming conventions: https://github.com/NOAA-FIMS/test-rulesets/settings/rules)
  • Work with @kellijohnson-NOAA to create the dev branch (there are currently many feature branches, so they likely need to get wrapped up before merging in these changes and making the dev branch)
  • perhaps open this in a separate issue: Work with @MOshima-PIFSC to set up renv on the case studies repository, to help make sure main is always working ( I did not ask Meg about is she is ok doing this, sorry Meg! Perhaps this could be a future seaside chat or code club topic)

@kellijohnson-NOAA
Copy link
Contributor

I rebased cleanup and made a PR to main. The scamp branch/PR by @Andrea-Havron-NOAA is the only other one that needs to be merged into main and then you can create a dev branch, and rebase gha to dev and do a PR of gha to dev. All other remaining branches can just rebase to dev once it is up and running.

@k-doering-NOAA
Copy link
Member Author

@kellijohnson-NOAA sounds good! Let me know when the time is right for creating the dev branch.

@kellijohnson-NOAA
Copy link
Contributor

@k-doering-NOAA all PR have been merged in and you are free to create a dev branch off of main or rebase your branch to main and rename it as dev.

k-doering-NOAA added a commit that referenced this issue Feb 21, 2025
k-doering-NOAA added a commit that referenced this issue Feb 21, 2025
Download main branch of Fims if using main in the feature branch name

Co-authored-by: Bai Li - NOAA <[email protected]>
Co-authored-by: Andrea-Havron-NOAA <[email protected]>
Co-authored-by: alexjensen-NOAA <[email protected]>
kellijohnson-NOAA pushed a commit that referenced this issue Feb 21, 2025
kellijohnson-NOAA pushed a commit that referenced this issue Feb 21, 2025
Download main branch of Fims if using main in the feature branch name

Co-authored-by: Bai Li - NOAA <[email protected]>
Co-authored-by: Andrea-Havron-NOAA <[email protected]>
Co-authored-by: alexjensen-NOAA <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants