Skip to content

Commit

Permalink
Use GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
juyeongkim committed Dec 19, 2020
1 parent 6ee2e1e commit 38b0171
Show file tree
Hide file tree
Showing 18 changed files with 186 additions and 162 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
^\.Rproj\.user$
^\.travis\.yml$
^check\.R$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
95 changes: 95 additions & 0 deletions .github/workflows/R-CMD-check-plus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

name: R-CMD-check-plus

jobs:
R-CMD-check-plus:
runs-on: macOS-latest

name: ${{ matrix.config.check }} ${{ matrix.config.file }}

strategy:
fail-fast: false
matrix:
config:
- {check: "checkRawFiles", file: "gene_expression_files"}
- {check: "checkRawFiles", file: "gene_expression_matrices"}
- {check: "checkRawFiles", file: "fcs_control_files"}
- {check: "checkRawFiles", file: "fcs_sample_files"}
- {check: "checkRawFiles", file: "protocols"}
- {check: "checkStudyCompliance"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
ISR_login: ${{ secrets.ISR_login }}
ISR_pwd: ${{ secrets.ISR_pwd }}

steps:
- name: Set environment for branch
run: |
if [[ $GITHUB_REF == "refs/heads/master" ]]; then
echo "ISR_machine=www.immunespace.org" >> "$GITHUB_ENV"
else
echo "ISR_machine=test.immunespace.org" >> "$GITHUB_ENV"
fi
shell: bash

- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@v1

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: R CMD check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Check
run: |
labkey.netrc.file <- ImmuneSpaceR:::.get_env_netrc()
labkey.url.base <- ImmuneSpaceR:::.get_env_url()
ImmuneSpaceMaintenance::check("{{ matrix.config.check }}", "{{ matrix.config.file }}")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ matrix.config.check }}-r${{ matrix.config.file }}-results
path: check
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

4 changes: 0 additions & 4 deletions Checks/checkFCS_control_1.R

This file was deleted.

4 changes: 0 additions & 4 deletions Checks/checkFCS_control_2.R

This file was deleted.

4 changes: 0 additions & 4 deletions Checks/checkFCS_sample_1.R

This file was deleted.

4 changes: 0 additions & 4 deletions Checks/checkFCS_sample_2.R

This file was deleted.

3 changes: 0 additions & 3 deletions Checks/checkGEF.R

This file was deleted.

3 changes: 0 additions & 3 deletions Checks/checkGEM.R

This file was deleted.

3 changes: 0 additions & 3 deletions Checks/checkProtocols.R

This file was deleted.

2 changes: 0 additions & 2 deletions Checks/checkStudyCompliance.R

This file was deleted.

10 changes: 7 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ImmuneSpaceMaintenance
Title: Utility Package for ImmuneSpace Maintenance
Version: 0.0.0.9000
Version: 0.0.1
Authors@R:
person("ImmuneSpace Maintainer",
email = "[email protected]",
Expand All @@ -15,11 +15,14 @@ Imports:
Rlabkey,
rjson,
parallel,
httr
httr,
testthat
Remotes:
RGLab/ImmuneSpaceR
License: GPL-2
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
RoxygenNote: 7.1.1
Collate:
'ISM.R'
'ISM-checkExpressionSet.R'
Expand All @@ -29,3 +32,4 @@ Collate:
'ISM-checkStudyCompliance.R'
'ISM-removeOrphanGEMs.R'
'ISM-utils.R'
'check.R'
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Generated by roxygen2: do not edit by hand

export(ISM)
export(check)
import(ImmuneSpaceR)
import(data.table)
importFrom(R6,R6Class)
importFrom(Rlabkey,labkey.executeSql)
Expand All @@ -14,3 +16,4 @@ importFrom(httr,http_type)
importFrom(parallel,detectCores)
importFrom(parallel,mclapply)
importFrom(rjson,fromJSON)
importFrom(testthat,capture_messages)
64 changes: 64 additions & 0 deletions R/check.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#' @import ImmuneSpaceR data.table
#' @importFrom testthat capture_messages
#' @export
check <- function(check_type, file_type, batch = "") {
con <- ISM$new("")

if (check_type == "checkStudyCompliance") {
msg <- testthat::capture_messages(
res <- con$checkStudyCompliance()
)

# Remove studies with known GEM issues that are not fixable at the moment
badGE <- c(
"SDY74",
"SDY314",
"SDY789",
"SDY820",
"SDY903",
"SDY1092",
"SDY1361"
)
res <- res[ !names(res) %in% badGE ]

if (length(res) > 0) {
dt <- as.data.table(do.call(rbind, res))
dt[, study := names(res)]
setcolorder(dt, c("study", "modules"))
print(dt[])

stop(
"\n",
length(res), " studies are not compliant: ",
paste(names(res), collapse = ", "),
"\n",
msg
)
}

} else if (check_type == "checkRawFiles" & file_type != "") {
msg <- testthat::capture_messages(
res <- con$checkRawFiles(file_type = file_type,
mc.cores = 1, # > 1 cores generates errors
batch = batch)
)

if (sum(!res$file_exists) > 0) {
res <- res[!res$file_exists, c("study_accession", "file_info_name")]
res <- res[ , list(files_missing = .N), by = study_accession]
print(res)
stop("Please download studies above!")
}
print(msg[1])

} else if (check_type == "checkPublicVsStudySchema"){
msg <- testthat::capture_messages(
res <- con$checkPublicVsStudySchema()
)
if (any(lengths(res)) > 0){
res <- res[ lengths(res) > 0 ]
print(res)
stop(msg)
}
}
}
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Initialize an ISM connection
# ImmuneSpace Maintenance Tasks

```R
<!-- badges: start -->
[![R-CMD-check-plus](https://github.com/RGLab/ImmuneSpaceMaintenance/workflows/R-CMD-check-plus/badge.svg)](https://github.com/RGLab/ImmuneSpaceMaintenance/actions)
<!-- badges: end -->

## Installation

``` r
# install.packages("remotes")
remotes::install_github("ImmuneSpaceMaintenance")
```

## Initialize an `ISM` connection

``` r
library(ImmuneSpaceMaintenance)
con <- ISM$new(study = "", onTest = TRUE)
```
68 changes: 0 additions & 68 deletions check.R

This file was deleted.

Loading

0 comments on commit 38b0171

Please sign in to comment.