Skip to content

Commit

Permalink
Update vignette and GH Action (#514)
Browse files Browse the repository at this point in the history
* Probably won't fix, but add new line to Windows file and fix spacing

* Add missing `client_name` in vignette info

* Add missing login, remove print from some logins, add missing skip

* Fix check
  • Loading branch information
Aryllen authored Aug 27, 2021
1 parent 75424f7 commit 04e1b43
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ jobs:
cat > "$OUTPUT_FILE" << EOM
[authentication]
username = "${{ secrets.SYNAPSE_USER }}"
apikey = "${{ secrets.SYNAPSE_APIKEY}}"
apikey = "${{ secrets.SYNAPSE_APIKEY }}"
EOM
chmod +x "$OUTPUT_FILE"
- name: Setup Synapse config file for testing (Windows)
if: runner.os == 'Windows'
run: |
"[authentication]`nusername = ${{ secrets.SYNAPSE_USER }}`napikey = ${{ secrets.SYNAPSE_APIKEY}}" | Out-File -FilePath "$HOME\.synapseConfig"
"[authentication]`nusername = ${{ secrets.SYNAPSE_USER }}`napikey = ${{ secrets.SYNAPSE_APIKEY }}`n" | Out-File -FilePath "$HOME\.synapseConfig"
- name: Check
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "warning", check_dir = "check")
Expand Down
6 changes: 3 additions & 3 deletions R/df-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ gather_template_id_biospecimen <- function(templates, species,
return(NA)
}
if (species %in% names(templates[["biospecimen_templates"]])) {
if (any(
if (any(c(
length(biospecimen_type) < 0,
is.na(biospecimen_type),
biospecimen_type %in% ""
)) {
biospecimen_type %in% c("", "NaN")
))) {
# Grab based on species
return(templates[["biospecimen_templates"]][[species]])
} else {
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-check-all.R
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ test_that("check_all doesn't run check_cols if missing template col", {
})

test_that("check_all runs check_cols if not missing template col", {
skip_if_not(logged_in(syn))
data <- tibble::tibble(
metadataType = c(
"manifest",
Expand Down
14 changes: 12 additions & 2 deletions tests/testthat/test-get-template.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
context("test-get-template.R")

syn <- attempt_instantiate()
tryCatch(
attempt_login(syn),
error = function(e) {
print(glue::glue("Did not log into Synapse: {e$message}"))
}
)

test_that("get_template fails when not logged in to Synapse", {
skip_if(is.null(syn))
Expand All @@ -14,8 +20,12 @@ test_that("get_template fails when not logged in to Synapse", {
)
})

attempt_login(syn)

tryCatch(
attempt_login(syn),
error = function(e) {
print(glue::glue("Did not log into Synapse: {e$message}"))
}
)

test_that("get_template errors for files from synID that are not xlsx or csv", {
skip_if_not(logged_in(syn = syn))
Expand Down
2 changes: 1 addition & 1 deletion vignettes/customizing-dccvalidator.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ To create a custom version of the app, you'll need to follow these steps:
[example of how to create a project with appropriate permissions](https://github.com/Sage-Bionetworks/dccvalidator/blob/master/inst/app/create_project.R).
1. Fork the [dccvalidator](https://github.com/Sage-Bionetworks/dccvalidator/blob/master/config.yml)
GitHub repository.
1. (For a production version): register a Synapse OAuth client (see [Synapse Docs](https://help.synapse.org/docs/Using-Synapse-as-an-OAuth-Server.2048327904.html#UsingSynapseasanOAuthServer-RegisteringandLinkinganOAuth2.0Client)) and store the `client_id` and `client_secret` in a .Renviron file within the repository. Ensure you are the only person who has access to this file (e.g. `chmod 600 .Renviron` or `chmod 400 .Renviron`).
1. (For a production version): register a Synapse OAuth client (see [Synapse Docs](https://help.synapse.org/docs/Using-Synapse-as-an-OAuth-Server.2048327904.html#UsingSynapseasanOAuthServer-RegisteringandLinkinganOAuth2.0Client)) and store the `client_name`, `client_id` and `client_secret` in a .Renviron file within the repository. Ensure you are the only person who has access to this file (e.g. `chmod 600 .Renviron` or `chmod 400 .Renviron`).
1. (For running locally only): create a .synapseConfig file in your home directory with your Synapse authentication credentials (see the [synapser docs for an example](https://r-docs.synapse.org/articles/manageSynapseCredentials.html#use-synapseconfig)).
1. Create a new configuration in the `config.yml` file. Note that any values you
do not customize will be inherited from the default configuration. The configuration file must have a `default` configuration.
Expand Down
2 changes: 1 addition & 1 deletion vignettes/deploying-dccvalidator.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ stand up a new version that is customized for a different community):
1. `git clone` the repository into the folder you've created
1. If needed, make any changes to the application's behavior by editing the
files, or check out a branch that contains your changes
1. Create a .Renviron file with the [verified OAuth](https://help.synapse.org/docs/Using-Synapse-as-an-OAuth-Server.2048327904.html#UsingSynapseasanOAuthServer-RegisteringandLinkinganOAuth2.0Client) `client_id` and `client_secret`
1. Create a .Renviron file with the [verified OAuth](https://help.synapse.org/docs/Using-Synapse-as-an-OAuth-Server.2048327904.html#UsingSynapseasanOAuthServer-RegisteringandLinkinganOAuth2.0Client) `client_name`, `client_id` and `client_secret`
and restrict permissions (`chmod 600 .Renviron` or `chmod 400 .Renviron`)
1. To ensure packages are up-to-date, open an R session and run `renv::restore()`
1. To ensure each connection has its own R process, the Sage Shiny Server administrator must configure the utilization scheduler. This is not necessary for the app to function, but might improve performance.
Expand Down

0 comments on commit 04e1b43

Please sign in to comment.