Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: add additional args to yaml files #147

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

Bai-Li-NOAA
Copy link
Collaborator

This PR addresses issue #144

  • update the following YAML files to support additional arguments on Windows, macOS, and Ubuntu: .github/workflows/build-pkgdown.yml, .github/workflows/r-cmd-check.yml, and .github/workflows/update-pkgdown.yml
  • allow additional arguments to be specified after checking out the repo and before setting up R
  • add a helper function validate_additional_args() to validate additional arguments for R functions
  • add a helper function add_args() to include platform-specific additional arguments in a YAML file
  • add additional_args to use_r_cmd_check(), use_update_pkgdown(), and use_build_pkgdown() to pass additional arguments to YAML files (e.g., call_*.yml)
  • add unit and integration tests to verify the new feature

@codecov-commenter
Copy link

codecov-commenter commented Nov 19, 2024

Codecov Report

Attention: Patch coverage is 99.36709% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.19%. Comparing base (d1ca9b5) to head (29b7717).

Files with missing lines Patch % Lines
R/use_r_workflows.R 99.20% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #147      +/-   ##
==========================================
+ Coverage   94.01%   95.19%   +1.18%     
==========================================
  Files           3        4       +1     
  Lines         167      208      +41     
==========================================
+ Hits          157      198      +41     
  Misses         10       10              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@Bai-Li-NOAA
Copy link
Collaborator Author

Bai-Li-NOAA commented Nov 19, 2024

@e-perl-NOAA, could you review this pull request? I will do a final cleanup after the review before merging the changes into the main branch.

Also, could you test the new feature using SS3 repos? For example:

  • Copy and paste the following code chunk into the call-r-cmd-check.yml file. See an example here
    uses: nmfs-fish-tools/ghactions4r/.github/workflows/r-cmd-check.yml@add-additional-args-to-yaml
    # uses: nmfs-fish-tools/ghactions4r/.github/workflows/r-cmd-check.yml@main
    with:
      additional_args_ubuntu: |
        sudo apt-get update
        sudo apt-get install -y libcurl4-openssl-dev
        sudo add-apt-repository ppa:ubuntu-toolchain-r/test
        sudo apt-get install --only-upgrade libstdc++6
  • Use the R code below to modify the YAML file. See an example here
use_update_pkgdown(
  workflow_name = "call-update-pkgdown.yml",
  additional_args = list(
    "ubuntu" = c(
      "sudo apt-get update",
      "sudo apt-get install -y libcurl4-openssl-dev",
      "sudo add-apt-repository ppa:ubuntu-toolchain-r/test",
      "sudo apt-get install --only-upgrade libstdc++6"
    )
  )
)

Let me know if you have any questions!

@e-perl-NOAA
Copy link
Contributor

Okay, I just added things in the r4ss repo which calls these workflows. It will take awhile for the tests to run and confirm that they work but I will let you know when they do. The r function to update the workflow does work (at least for the ubuntu additions) though of course I did have to change the branch once added from main to this one so that it will work when the github actions are running right now.

@e-perl-NOAA
Copy link
Contributor

Ummm, so I keep getting this result which is weird because I'm pretty sure everything is right. Idk if this is just one of those situations (like many other things these days) where everything has decided to stop working properly or something else

@Bai-Li-NOAA
Copy link
Collaborator Author

@e-perl-NOAA, my bad! I gave the wrong branch name. The correct one is add-additional-args-to-yaml

uses: nmfs-fish-tools/ghactions4r/.github/workflows/r-cmd-check.yml@add-additional-args-to-yaml
    # uses: nmfs-fish-tools/ghactions4r/.github/workflows/r-cmd-check.yml@main

@e-perl-NOAA
Copy link
Contributor

Okay it's working in r4ss (there is a problem with the macos run but that's a me problem with gh and APIs and github enterprise with single sign on, not a you problem)!

@e-perl-NOAA
Copy link
Contributor

@Bai-Li-NOAA would it be too much trouble to add an input for env portion to the r-cmd-check for me to test out? I might not be able to get it to do what I want it to and thus it may not matter in the end. This could also be done in another branch not associated with this PR.

@e-perl-NOAA
Copy link
Contributor

The env is to try to deal with API calls to the mac github actions runner.

@Bai-Li-NOAA
Copy link
Collaborator Author

@e-perl-NOAA Feel free to add an input of env to test in this branch or another branch, either works for me. I am not entirely sure about the desired input format for env portion, but let me know the details of the user case if you would like me to work on it.

@e-perl-NOAA
Copy link
Contributor

Actually nevermind on the env, it already uses it. It looks like macs will just always cause strife in my life.

@e-perl-NOAA
Copy link
Contributor

I assume that you will re-run with spell check before you merge.

@e-perl-NOAA
Copy link
Contributor

I tried adding it and then realized that you already had the GITHUB_TOKEN in there which is what I wanted to try. Its nothing for you to worry about.

@Bai-Li-NOAA
Copy link
Collaborator Author

@e-perl-NOAA, okay, thanks for the update! I will do a final cleanup, including fixing the spell check GHA, before merging the PR.

@Bai-Li-NOAA Bai-Li-NOAA force-pushed the add-additional-args-to-yaml branch from 2440da6 to 0d34ba8 Compare November 22, 2024 17:57
- update the following YAML files to support additional arguments on
  Windows, macOS, and Ubuntu: .github/workflows/build-pkgdown.yml,
  .github/workflows/r-cmd-check.yml, and
  .github/workflows/update-pkgdown.yml
- allow additional arguments to be specified after checking out the repo
  and before setting up R
- add a helper function validate_additional_args() to validate
  additional arguments for R functions
- add a helper function add_args() to include platform-specific
  additional arguments in a YAML file
- add additional_args to use_r_cmd_check(), use_update_pkgdown(), and
  use_build_pkgdown() to pass additional arguments to YAML files (e.g.,
  call_*.yml)
- add unit and integration tests to verify the new feature
- update the WORDLIST to pass the spell check
- import the cli package and use its functions to signal errors with a cli
  formatted message
@Bai-Li-NOAA Bai-Li-NOAA force-pushed the add-additional-args-to-yaml branch from 0d34ba8 to 29b7717 Compare November 22, 2024 18:03
@Bai-Li-NOAA Bai-Li-NOAA merged commit 540ba70 into main Nov 26, 2024
11 checks passed
@Bai-Li-NOAA Bai-Li-NOAA deleted the add-additional-args-to-yaml branch November 26, 2024 14:01
@Bai-Li-NOAA
Copy link
Collaborator Author

@e-perl-NOAA I have merged the PR. You might need to update some GHA workflows in the SS3 repositories. Let me know if you have any questions!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an input option in r-cmd-check workflow to let users include additional install arguments
3 participants