File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5454 extra-packages : any::covr, any::xml2
5555 needs : coverage
5656
57+ - name : setup r-reticulate
58+ shell : Rscript {0}
59+ run : |
60+ python = Sys.which("python")
61+ writeLines(sprintf("RETICULATE_PYTHON=%s", python), Sys.getenv("GITHUB_ENV"))
62+ reticulate::py_config()
63+
5764 - name : Test coverage
5865 run : |
5966 cov <- covr::package_coverage(
Original file line number Diff line number Diff line change @@ -22,15 +22,20 @@ ee_Init <- function(drive=FALSE, ...) {
2222}
2323
2424# ' @export
25- ee_auth_ci <- function () {
25+ ee_auth_ci <- function (token = NULL ) {
2626 ci_auth <- system.file(" python/ci_auth.py" , package = " rgee2" )
2727 reticulate :: source_python(ci_auth )
28- auto_Initialize()
28+
29+ if (is.null(token )) {
30+ token = os.getenv(" EARTHENGINE_TOKEN" )
31+ }
32+ auto_Initialize(token )
33+ print(" ee_auth_ci: Authentication successful!" )
2934}
3035
3136# ' @export
3237use_backend <- function () {
33- reticulate :: py_require(" earthengine-api" , pip = TRUE )
38+ reticulate :: py_require(" earthengine-api" )
3439}
3540
3641# ' @export
Original file line number Diff line number Diff line change 55import google .oauth2 .credentials
66
77
8- def auto_Initialize ():
8+ def auto_Initialize (token ):
99 # with open("token.json", "r") as f:
1010 # stored = json.load(f)
11- stored = json .loads (os . getenv ( "EARTHENGINE_TOKEN" ) )
11+ stored = json .loads (token )
1212
1313 credentials = google .oauth2 .credentials .Credentials (
1414 None ,
Original file line number Diff line number Diff line change @@ -5,15 +5,19 @@ test_that("auth works", {
55 # ci_auth()
66 }
77
8+ # token <- paste(readLines("token.json", encoding = "UTF-8"), collapse = "")
9+ token <- Sys.getenv(" EARTHENGINE_TOKEN" )
10+
811 tryCatch({
912 python <- system(" which python" )
1013 print(python )
1114
12- use_backend()
13- # Sys.setenv(RETICULATE_PYTHON = python)
15+ # use_backend()
16+ Sys.setenv(RETICULATE_PYTHON = python )
17+ reticulate :: py_config()
1418
1519 print(system(" pip list earthengine-api | grep earthengine-api" ))
16- ee_auth_ci()
20+ ee_auth_ci(token )
1721 }, error = function (e ) {
1822 message(sprintf(" %s" , e $ message ))
1923 })
You can’t perform that action at this time.
0 commit comments