Skip to content

Commit

Permalink
Fix GH Actions (#490)
Browse files Browse the repository at this point in the history
* Add missing title to .onLoad

* Remove use of cached packages and explicitly add shinyBS

* Style and fix example typo

* Add boto3 and pandas to requirements

* Add and remove ", where needed

* Add newline at end of pkgdown.yaml

* Try reticulate::py_discover_config()

* Wrap login attempt in case credentials not provided

Print error message if not logged in. This is due to challenges printing the credentials in the Windows CI environment. Hopefully we can just skip tests for now.
  • Loading branch information
Aryllen authored Jun 16, 2021
1 parent 731a01f commit 27f0de2
Show file tree
Hide file tree
Showing 18 changed files with 107 additions and 51 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ jobs:
- name: Install dependencies
run: |
library(remotes)
deps <- readRDS("depends.Rds")
deps[["installed"]] <- vapply(deps[["package"]], remotes:::local_sha, character(1))
deps <- readRDS('depends.Rds')
deps[['installed']] <- vapply(deps[['package']], remotes:::local_sha, character(1))
update(deps)
remotes::install_cran("rcmdcheck")
remotes::install_cran('rcmdcheck')
shell: Rscript {0}

- name: Install Miniconda
Expand All @@ -88,9 +88,8 @@ jobs:

- name: Install Python deps
run: |
Rscript -e "reticulate::conda_create('r-reticulate', packages = c('python==3.7.0'))"
Rscript -e "remotes::install_local()"
Rscript -e "reticulate::py_install(c('pandas', 'numpy','boto3', 'synapseclient'), pip = TRUE)
Rscript -e "reticulate::py_discover_config()"
Rscript -e "reticulate::py_install(c('pandas', 'numpy', 'boto3', 'synapseclient'), pip = TRUE)"
- name: Setup Synapse config file for testing
if: runner.os != 'Windows'
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,22 @@ jobs:
saveRDS(remotes::dev_package_deps(dependencies = TRUE), "depends.Rds", version = 2)
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: macOS-r-3.6-${{ hashFiles('depends.Rds') }}
restore-keys: macOS-r-3.6-

- name: Install system dependencies
run: |
brew install harfbuzz fribidi
- name: Install dependencies
run: |
install.packages("remotes")
remotes::install_deps(dependencies = TRUE)
install.packages("pkgdown", type = "binary")
library(remotes)
deps <- readRDS("depends.Rds")
deps[["installed"]] <- vapply(deps[["package"]], remotes:::local_sha, character(1))
update(deps)
install.packages(c("pkgdown", "shinyBS"), type = "binary")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Deploy package
run: pkgdown::deploy_to_branch(new_process = FALSE)
shell: Rscript {0}
shell: Rscript {0}
4 changes: 2 additions & 2 deletions R/metadata-template-dictionary.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ verify_dictionary_structure <- function(dictionary) {

return(check_pass(
msg = "All keys had a single description and columnType",
behavior = "All keys should have a single descrioption and columnType"
behavior = "All keys should have a single description and columnType"
))
}

Expand Down Expand Up @@ -255,8 +255,8 @@ add_dictionary_sheets <- function(template_xlsx_path, annotations) {
#' "A person's family name",
#' "A person's family name"
#' )
#' generate_key_description(annots)
#' )
#' generate_key_description(annots)
#' }
generate_key_description <- function(annots) {
if (!(all(c("key", "description") %in% colnames(annots)))) {
Expand Down
22 changes: 11 additions & 11 deletions R/mod-synapse-oauth.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ app_url <- NULL
claims_param <- NULL
authorization_url <- NULL

#' @title
#' @title Set up Synapse and OAuth variables
#'
#' @description Bring in the Synapse Python Client and set up global variables
#' for OAuth at startup. Requires global variables initialized to NULL: synapse,
Expand All @@ -31,7 +31,7 @@ authorization_url <- NULL
#' @title Synapse Oauth Module
#'
#' @description Create the Synapse OAuth component of a Shiny app.
#'
#'
#' If this is
#' the first time signing in, will need to do OAuth the process. The OAuth
#' process will redirect back here and an authorization code
Expand All @@ -41,7 +41,7 @@ authorization_url <- NULL
#' (i.e. the function specified in the `ui` parameter here
#' `shinyApp(ui = app_ui, server = app_server)`), which receives the `request`
#' object and can pass it along.
#'
#'
#' IMPORTANT: this module assumes the following
#' global variables are available and valid: app, api, authorization_url,
#' app_url, claims_params, scope. See \code{\link{setup_global_oauth_vars}}.
Expand All @@ -58,16 +58,16 @@ authorization_url <- NULL
#' \dontrun{
#' library("dccvalidator")
#' app_ui <- function(request) {
#' mod_synapse_oauth_ui(id = "oauth", request = request)
#' mod_synapse_oauth_ui(id = "oauth", request = request)
#' }
#' app_server <- function(input, output, session) {
#' synapse <- reticulate::import("synapseclient")
#' syn <- synapse$Synapse()
#' syn <- mod_synapse_oauth_server(
#' id = "oauth",
#' syn = syn
#' )
#' shiny::req(inherits(syn, "synapseclient.client.Synapse"), logged_in(syn))
#' synapse <- reticulate::import("synapseclient")
#' syn <- synapse$Synapse()
#' syn <- mod_synapse_oauth_server(
#' id = "oauth",
#' syn = syn
#' )
#' shiny::req(inherits(syn, "synapseclient.client.Synapse"), logged_in(syn))
#' }
#' run_app()
#' }
Expand Down
2 changes: 1 addition & 1 deletion man/dot-onLoad.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions man/mod_synapse_oauth_ui.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
backports.csv==1.0.7
boto3==1.17.95
certifi==2019.9.11
chardet==3.0.4
Deprecated==1.2.4
entrypoints==0.3
future==0.18.2
idna==2.8
keyring==12.0.2
pandas==1.2.4
requests==2.22.0
six==1.13.0
synapseclient==1.9.4
Expand Down
7 changes: 6 additions & 1 deletion tests/testthat/test-check-all.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ context("test-check-all.R")

library("tibble")
syn <- attempt_instantiate()
attempt_login(syn)
tryCatch(
attempt_login(syn),
error = function(e) {
print(glue::glue("Did not log into Synapse: {e$message}"))
}
)
annots <- tribble(
~key, ~value, ~columnType,
"assay", "rnaSeq", "STRING",
Expand Down
7 changes: 6 additions & 1 deletion tests/testthat/test-check-annotation-keys.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ context("test-check-annotation-keys.R")

library("tibble")
syn <- attempt_instantiate()
attempt_login(syn = syn)
tryCatch(
attempt_login(syn),
error = function(e) {
print(glue::glue("Did not log into Synapse: {e$message}"))
}
)
Sys.setenv(R_CONFIG_ACTIVE = "testing")

annots <- tribble(
Expand Down
7 changes: 6 additions & 1 deletion tests/testthat/test-check-annotation-values.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ context("test-check-annotation-values.R")

library("tibble")
syn <- attempt_instantiate()
attempt_login(syn)
tryCatch(
attempt_login(syn),
error = function(e) {
print(glue::glue("Did not log into Synapse: {e$message}"))
}
)
Sys.setenv(R_CONFIG_ACTIVE = "testing")
annots <- tribble(
~key, ~value, ~columnType,
Expand Down
7 changes: 6 additions & 1 deletion tests/testthat/test-check-certified-user.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
context("test-chec-certified-user.R")

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

test_that("check_certified_user returns check_pass if certified", {
Expand Down
14 changes: 12 additions & 2 deletions tests/testthat/test-check-col-names.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
context("test-check-col-names.R")

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

test_that("check_col_names returns condition object when check passes", {
Expand Down Expand Up @@ -37,7 +42,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("check_cols_individual works for individual columns", {
skip_if_not(logged_in(syn = syn))
Expand Down
7 changes: 6 additions & 1 deletion tests/testthat/test-check-team-membership.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
context("test-check-team-membership.R")

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

test_that("check_team_membership() returns check_pass if user is in the team", {
Expand Down
7 changes: 6 additions & 1 deletion tests/testthat/test-create-folder.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
context("test-create-folder.R")

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

test_that("create_folder() creates a folder", {
Expand Down
7 changes: 6 additions & 1 deletion tests/testthat/test-get-synapse-annotations.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
context("test-get-synapse-annotations.R")

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

test_that("get_synapse_table returns a data frame", {
Expand Down
7 changes: 6 additions & 1 deletion tests/testthat/test-get-user-teams.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
context("test-get-user-teams.R")

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

test_that("get_user_teams gets team memberships", {
Expand Down
7 changes: 6 additions & 1 deletion tests/testthat/test-metadata-template-dictionary.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ context("metadata-template-dictionary.R")

# update_template_dictionaries ------------------------------------------------
syn <- attempt_instantiate()
attempt_login(syn)
tryCatch(
attempt_login(syn),
error = function(e) {
print(glue::glue("Did not log into Synapse: {e$message}"))
}
)
Sys.setenv(R_CONFIG_ACTIVE = "testing")

test_that("update_template_dictionaries returns updated Synapse file list", {
Expand Down
7 changes: 6 additions & 1 deletion tests/testthat/test-python-helpers.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
context("test-python-helpers.R")

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

test_that("dict_to_list converts annotations", {
Expand Down

0 comments on commit 27f0de2

Please sign in to comment.