-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update R functions to include additional args in YAML files
- Loading branch information
1 parent
4f09a34
commit 82fb038
Showing
16 changed files
with
915 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,61 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
workflow_call: | ||
|
||
name: build-pkgdown | ||
|
||
jobs: | ||
pkgdown: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::pkgdown, local::. | ||
needs: website | ||
|
||
- name: build pkgdown | ||
run: | | ||
Rscript -e 'pkgdown::build_site()' | ||
- name: save pkgdown output | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: pkgdown-site | ||
path: docs/ | ||
|
||
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
workflow_call: | ||
inputs: | ||
additional_args_windows: | ||
required: false | ||
type: string | ||
default: "" | ||
additional_args_macos: | ||
required: false | ||
type: string | ||
default: "" | ||
additional_args_ubuntu: | ||
required: false | ||
type: string | ||
default: "" | ||
|
||
name: build-pkgdown | ||
|
||
jobs: | ||
pkgdown: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: run additional args on windows | ||
if: matrix.config.os == 'windows-latest' | ||
run: ${{ inputs.additional_args_windows }} | ||
|
||
- name: run additional args on macOS | ||
if: matrix.config.os == 'macOS-latest' | ||
run: ${{ inputs.additional_args_macos }} | ||
|
||
- name: run additional args on ubuntu | ||
if: matrix.config.os == 'ubuntu-latest' | ||
run: ${{ inputs.additional_args_ubuntu }} | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::pkgdown, local::. | ||
needs: website | ||
|
||
- name: build pkgdown | ||
run: | | ||
Rscript -e 'pkgdown::build_site()' | ||
- name: save pkgdown output | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: pkgdown-site | ||
path: docs/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Checks that the pkgdown site builds for a repository. | ||
# this assumes pkgdown is already set up. | ||
name: call-build-pkgdown | ||
# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows | ||
on: | ||
# this workflow runs on pushes to main or master or any time a new tag is pushed | ||
# it also runs everytime a pull request to main or master is opened. | ||
push: | ||
branches: [main, master] | ||
tags: ['*'] | ||
pull_request: | ||
branches: [main, master] | ||
jobs: | ||
call-workflow: | ||
uses: nmfs-fish-tools/ghactions4r/.github/workflows/build-pkgdown.yml@add-input-option-workflows | ||
# uses: nmfs-fish-tools/ghactions4r/.github/workflows/build-pkgdown.yml@main | ||
with: | ||
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 | ||
additional_args_macos: | | ||
brew install curl | ||
additional_args_windows: | | ||
tree | ||
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 | ||
additional_args_macos: | | ||
brew install curl | ||
additional_args_windows: | | ||
tree | ||
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 | ||
additional_args_macos: | | ||
brew install curl | ||
additional_args_windows: | | ||
tree | ||
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 | ||
additional_args_macos: | | ||
brew install curl | ||
additional_args_windows: | | ||
tree | ||
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 | ||
additional_args_macos: | | ||
brew install curl | ||
additional_args_windows: | | ||
tree | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,5 @@ jobs: | |
additional_args_macos: | | ||
brew install curl | ||
additional_args_windows: | | ||
tree | ||
tree | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,26 @@ | ||
# updates exiting pkgdown site for a repository | ||
# deploys to a branch gh-pages | ||
name: call-update-pkgdown | ||
# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows | ||
on: | ||
# this workflow runs on pushes to main or master or any time a new tag is pushed | ||
workflow_dispatch: | ||
push: | ||
branches: [main, master] | ||
tags: ['*'] | ||
jobs: | ||
call-workflow: | ||
uses: nmfs-fish-tools/ghactions4r/.github/workflows/update-pkgdown.yml@main | ||
# updates exiting pkgdown site for a repository | ||
# deploys to a branch gh-pages | ||
name: call-update-pkgdown | ||
# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows | ||
on: | ||
# this workflow runs on pushes to main or master or any time a new tag is pushed | ||
workflow_dispatch: | ||
push: | ||
branches: [main, master] | ||
tags: ['*'] | ||
jobs: | ||
call-workflow: | ||
uses: nmfs-fish-tools/ghactions4r/.github/workflows/update-pkgdown.yml@add-input-option-workflows | ||
# uses: nmfs-fish-tools/ghactions4r/.github/workflows/update-pkgdown.yml@main | ||
with: | ||
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 | ||
additional_args_macos: | | ||
brew install curl | ||
additional_args_windows: | | ||
tree | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,32 @@ | ||
# functions to check inputs | ||
|
||
#' Check the workflow name is formatted correctly | ||
#' | ||
#' Basically check that it is a filename that ends in .yml | ||
#' @template workflow_name | ||
check_workflow_name <- function(workflow_name) { | ||
stopifnot(is.character(workflow_name)) | ||
stopifnot(length(workflow_name) == 1) | ||
get_ext <- grep("\\.yml$", workflow_name) | ||
stopifnot(isTRUE(length(get_ext) == 1)) | ||
return(invisible(workflow_name)) | ||
} | ||
# functions to check inputs | ||
|
||
#' Check the workflow name is formatted correctly | ||
#' | ||
#' Basically check that it is a filename that ends in .yml | ||
#' @template workflow_name | ||
check_workflow_name <- function(workflow_name) { | ||
stopifnot(is.character(workflow_name)) | ||
stopifnot(length(workflow_name) == 1) | ||
get_ext <- grep("\\.yml$", workflow_name) | ||
stopifnot(isTRUE(length(get_ext) == 1)) | ||
return(invisible(workflow_name)) | ||
} | ||
|
||
#' Validate additional arguments for R functions | ||
#' | ||
#' @inheritParams use_r_cmd_check | ||
validate_additional_args <- function(additional_args) { | ||
if (!is.null(additional_args)) { | ||
if (!is.list(additional_args)) { | ||
cli::cli_abort("{.var additional_args} must be a named list.") | ||
} | ||
invalid_platforms <- setdiff(names(additional_args), c("windows", "macos", "ubuntu")) | ||
if (length(invalid_platforms) > 0 | is.null(invalid_platforms)) { | ||
cli::cli_abort("Invalid platform in {.var additional_args}: {.val {invalid_platforms}}. | ||
Allowed platforms are {.val windows}, {.val macos}, and {.val ubuntu}.") | ||
} | ||
if (!all(vapply(additional_args, is.character, logical(1)))) { | ||
cli::cli_abort("All values in {.var additional_args} must be character vectors.") | ||
} | ||
} | ||
} |
Oops, something went wrong.