Skip to content

Commit

Permalink
Add GH token to all code check steps
Browse files Browse the repository at this point in the history
  • Loading branch information
bschilder committed Oct 2, 2024
1 parent 99c958d commit e4259a9
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 53 deletions.
98 changes: 49 additions & 49 deletions .Rhistory
Original file line number Diff line number Diff line change
@@ -1,52 +1,3 @@
jsn <- jsonlite::read_json(path)
names(jsn)
testthat::expect_true(
all(c("image","features","customizations") %in% names(jsn))
)
devtools::check_man()
file.edit("Rprofile")
file.edit(".Rprofile")
BiocManager::repositories()
devtools::check_man()
library(rworkflows)
deparse(BiocManager::repositories())
cat(deparse(BiocManager::repositories()))
cont4 <- construct_cont(default_tag = "release",
default_registry = "ghcr.io",
run_check_cont = TRUE)
cont4 <- construct_cont(default_tag = "release",
default_registry = NULL,
run_check_cont = TRUE)
is.null(c("a","b"))
library(rworkflows)
cont4 <- construct_cont(default_tag = "release",
default_registry = NULL,
run_check_cont = TRUE)
devoptera::args2vars(construct_cont)
default_registry
default_registry=NULL
default_registry <- check_registry(registry = default_registry)
#### Remove any trailing : (e.g. when default_tag=NULL) ####
cont <- lapply(cont, function(x){
if(is.null(x)) NULL else trimws(x,whitespace = ":")
})
#### Run QC ####
cont2 <- lapply(cont,function(co){
if(is.null(co)){
return(NULL)
} else if(!grepl("/",co) &&
!is.null(default_cont)){
messager("Only tag name supplied to 'cont'.",
"Assuming default=",shQuote(default_cont),v=verbose)
co <- paste(default_cont,co,sep=":")
} else if(!grepl(":",co) |
!grepl(default_cont,co)) {
return(co)
}
splt <- strsplit(co,":")[[1]]
bioc_version <- rev(splt)[1]
if(isTRUE(versions_explicit)){
if(grepl(":",co)){
info <- bioc_r_versions(bioc_version = bioc_version)
return(
paste0(splt[[1]],":RELEASE_",gsub("[.]","_",info$bioc))
Expand Down Expand Up @@ -510,3 +461,52 @@ library(rworkflows)
?testthat::skip_on_cran()
testthat::skip_if_offline()
readLines("https://hub.docker.com/v2/repositories//bioconductor/bioconductor_docker/tags?page_size=1000")
devtools::check_man()
devtools::install_dev_deps()
devtools::install_dev_deps()
gh::gh_token()
file.edit("~/.Renviron")
credentials::set_github_pat()
gh::gh_token()
devtools::install_dev_deps()
credentials::set_github_pat()
devtools::install_dev_deps()
devtools::build()
devtools::check_man()
version
version
install.packages("devtools")
install.packages("BiocManager")
install.packages("devtools")
devtools::install_dev_deps()
devtools::check_man()
install.packages("roxygen2")
devtools::check_man()
devtools::install_dev_deps()
packageVersion("roxygen2")
version
version
version()
version()
version
rworkflows::use_workflow()
rworkflows::use_workflow(force_new = T)
gh::gh_token()
credentials::set_github_pat()
a1 <- construct_authors()
library()
library(rworkflows)
a1 <- construct_authors()
testthat::expect_equal(as.character(a1), "yourGivenName yourFamilyName <[email protected]> [cre] (yourOrcidId)")
a2 <- construct_authors(authors = "Test 1, Test1")
testthat::expect_equal(as.character(a2), "Test 1, Test1")
testthat::expect_equal(as.character(a1), "yourGivenName yourFamilyName <[email protected]> [cre] (yourOrcidId)")
testthat::expect_true(as.character(a1) %in%
c("yourGivenName yourFamilyName <[email protected]> [cre] (ORCID: yourOrcidId)",
"yourGivenName yourFamilyName <[email protected]> [cre] (yourOrcidId)"))
installed.packages()
names(installed.packages())
rownames(installed.packages())
"reticulate" %in% rownames(installed.packages())
credentials::set_github_pat()
remotes::install_github("r-lib/remotes")
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rworkflows
Type: Package
Title: Test, Document, Containerise, and Deploy R Packages
Version: 1.0.2
Version: 1.0.3
Authors@R:
c(person(given = "Brian",
family = "Schilder",
Expand Down
14 changes: 13 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
# rworkflows 1.0.3

## New features

* New arg `run_telemetry` allows users to disable workflow telemetry.

## Bug fixes

* Add `GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}` to all code check steps.

# rworkflows 1.0.2

## New features

* Update to R 4.4.1 and ensure everything stil works.
* Update to R 4.4.1 and ensure everything still works.
* Update *rworkflows.yml* to use new Bioc release, 3.19

## Bug fixes

* Get back up on CRAN after deprecation occurred while I was away.
* Remove .*Rprofile* (didn't seem to help CRAN and was getting outdated)
* *test-construct_conda_yml.R*: Add conditional to only run certain steps
if `reticulate` is installed (for `noSuggests` tests in CRAN).

# rworkflows 1.0.1

Expand Down
14 changes: 14 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,17 @@ inputs:
description: >
Free up additional disk space by deleting non-essential sofwares.
default: false
run_telemetry:
description: >
Whether to run the workflow telemetry action:
https://github.com/catchpoint/workflow-telemetry-action
default: true

runs:
using: 'composite'
steps:
- name: 🔭 Collect Workflow Telemetry
if: inputs.run_telemetry == 'true'
uses: runforesight/workflow-telemetry-action@v1
continue-on-error: true
with:
Expand Down Expand Up @@ -391,6 +397,7 @@ runs:
AS_CRAN: ${{ inputs.as_cran }}
run_vignettes: ${{ inputs.run_vignettes }}
timeout: ${{ inputs.timeout }}
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
run: |
options(crayon.enabled = TRUE, timeout=Sys.getenv("timeout"))
if(!require("rcmdcheck", quietly=TRUE)) install.packages("rcmdcheck")
Expand All @@ -414,6 +421,7 @@ runs:
if: inputs.has_runit == 'true'
env:
timeout: ${{ inputs.timeout }}
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
run: |
options(crayon.enabled = TRUE, timeout=Sys.getenv("timeout"))
BiocGenerics:::testPackage()
Expand All @@ -427,6 +435,7 @@ runs:
run_vignettes: ${{ inputs.run_vignettes }}
as_cran: ${{ inputs.as_cran }}
timeout: ${{ inputs.timeout }}
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
run: |
options(crayon.enabled = TRUE, timeout=Sys.getenv("timeout"))
#### Install deps ####
Expand All @@ -449,6 +458,7 @@ runs:
if: inputs.run_covr == 'true' && runner.os == 'Linux'
env:
CODECOV_TOKEN: ${{ inputs.CODECOV_TOKEN }}
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
run: |
## NOTE: codecov() uses CODECOV_TOKEN env var if specified.
## (recommended)
Expand All @@ -457,6 +467,8 @@ runs:

- name: 🛠 Install package ️
if: inputs.run_pkgdown == 'true' && runner.os == 'Linux'
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
run: R CMD INSTALL .
shell: bash {0}

Expand Down Expand Up @@ -507,6 +519,8 @@ runs:

- name: 📦 Build pkgdown site
if: inputs.run_pkgdown == 'true' && runner.os == 'Linux'
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
run: |
options(crayon.enabled = TRUE)
pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
Expand Down
5 changes: 4 additions & 1 deletion tests/testthat/test-construct_authors.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
test_that("construct_authors works", {

a1 <- construct_authors()
testthat::expect_equal(as.character(a1), "yourGivenName yourFamilyName <[email protected]> [cre] (yourOrcidId)")

testthat::expect_true(as.character(a1) %in%
c("yourGivenName yourFamilyName <[email protected]> [cre] (ORCID: yourOrcidId)",
"yourGivenName yourFamilyName <[email protected]> [cre] (yourOrcidId)"))

a2 <- construct_authors(authors = "Test 1, Test1")
testthat::expect_equal(as.character(a2), "Test 1, Test1")
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-construct_conda_yml.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ test_that("construct_conda_yml works", {


#### Construct an actual conda env ####
if(conda_installed() &&
if("reticulate" %in% rownames(installed.packages()) &&
conda_installed() &&
is_gha() &&
.Platform$OS.type != "windows"){
envname <- "testenv"
Expand Down

0 comments on commit e4259a9

Please sign in to comment.