Skip to content

Commit

Permalink
Switch to GitHub Actions for CI and Deployment
Browse files Browse the repository at this point in the history
Switch to GitHub Actions (GHA) for CI and Deployment. GHA
provides a richer build matrix and longer build times than Travis
as well as smoother integration. (Additionally, remove AppVeyor
which was always a bit flakey). 

In addition, this branch addresses several bugs identified by the new
CI, mainly related to updated tidyverse packages and stricter recycling
rules inside if() clauses.
  • Loading branch information
michaelweylandt committed Apr 16, 2020
2 parents 3c1af11 + af86574 commit 3e6f5d7
Show file tree
Hide file tree
Showing 13 changed files with 192 additions and 198 deletions.
24 changes: 16 additions & 8 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
## CI Files
^.github$
^codecov\.yml$
^appveyor\.yml$

## RStudio Files
^.*\.Rproj$
^\.Rproj\.user$

## Pkgdown docs
_pkgdown.yml
^docs$
^_pkgdown\.yml$
^pkgdown$
^.travis\.yml$

## GH files (not part of package)
.gitignore.deploy
README.Rmd
README.md
^data-raw$

## Other autogenerated files
^README-.*\.png$
figs/*
build_steps.R
^codecov\.yml$

## Misc other files
LICENSE
CONTRIBUTORS
.github/*
^appveyor\.yml$
File renamed without changes.
149 changes: 149 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Adapted from https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml
on:
push:
branches:
- develop
pull_request:
branches:
- develop

name: R-CMD-check and Deploy

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: '3.6'}
- {os: macOS-latest, r: '3.6'}
- {os: macOS-latest, r: 'devel'}
- {os: ubuntu-16.04, r: '3.6', rspm: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}

steps:
- uses: actions/checkout@v2

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

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

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
shell: Rscript {0}

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

- name: Install system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran(c('rcmdcheck', 'devtools', 'roxygen2', 'testthat', 'markdown', 'knitr', 'rmarkdown', 'pkgdown'))
remotes::install_cran(c('gifski', 'gganimate', 'cvxclustr', 'cvxbiclustr'))
shell: Rscript {0}

- name: Add auto-generated files
run: |
file.create("NAMESPACE")
cat("# Generated by roxygen2: do not edit by hand", file = "NAMESPACE")
cat("\n\nuseDynLib(clustRviz)", file = "NAMESPACE", append = TRUE)
Rcpp::compileAttributes(verbose = TRUE)
roxygen2::roxygenize()
## Avoid time-out
cat("WRITING TEST STUBS -------- \n\n")
skeleton <- readLines(file.path("tests", "test_stub.R"))
for(f in list.files(file.path("tests", "testthat"), pattern="test_")){
stub <- gsub("test_(.*)\\.R", "\\1", f)
writeLines(gsub("PATTERN", stub, skeleton),
file.path("tests", paste0("test_", stub, ".R")))
}
unlink(file.path("tests", "test_stub.R"))
## GitHash for debugging purposes
cat("ADDING GIT HASH -------- \n\n")
if(!dir.exists("inst")){
dir.create("inst")
}
writeLines(system("git rev-parse HEAD", intern=TRUE), "inst/GIT.HASH")
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: Upload check results
if: failure()
uses: actions/upload-artifact@master
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check

- name: Run coverage
if: success() && matrix.config.os == 'macOS-latest' && matrix.config.r == '3.6'
run: |
remotes::install_cran('covr')
library(covr)
flags <- getOption("covr.flags")
flags[] <- gsub("-O0 ", "", flags)
options(covr.flags=flags)
codecov(quiet=FALSE)
shell: Rscript {0}

- name: Clean up build artifacts and render pkgdown site
if: success() && matrix.config.os == 'ubuntu-16.04'
run: |
devtools::install()
rmarkdown::render('README.Rmd')
pkgdown::build_site()
unlink('src/*o', force = TRUE)
unlink('*Rcheck', force = TRUE, recursive = TRUE)
unlink('*tar.gz', force = TRUE)
file.rename('.github/.gitignore.deploy', '.gitignore')
## Copy GIF to a place where pkgdown site will find it
dir.create("docs/inst", recursive = TRUE)
file.copy("inst/path_dyn.gif", "docs/inst/path_dyn.gif")
shell: Rscript {0}

- name: Deploy build package
if: success() && matrix.config.os == 'ubuntu-16.04' && github.ref == 'refs/heads/develop'
run: |
git checkout master || git checkout -b master
git add man/* || echo "No doc changes to commit"
git add R/* || echo "No R code changes to commit"
git add src/* || echo "No C++ code changes to commit"
git add README.md || echo "No README changes to commit"
git add NAMESPACE || echo "No NAMESPACE changes to commit"
git add vignettes/*html || echo "No vignette HTML changes to commit"
git add docs/* || echo "No pkgdown changes to commit"
git add .gitignore || echo "No .gitignore changes to commit"
git config user.email "michael.weylandt@gmail.com"
git config user.name "${{github.actor}} (Auto-Deploy via GitHub Actions)"
git commit -m "Add build artifacts" || echo "No changes to commit"
git push -f -u https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git master || echo "No changes to commit"
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

23 changes: 12 additions & 11 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ Authors@R: c(
person("Warnes", "Gregory", role = "cph", comment = "R/util_myheatmap2.R"),
person("Lewis", "Brian W.", role = "cph", comment = "R/util_hcs.R"),
person("R Core Team", role = "cph", comment = "R/util_myrecthclust.R"))
Description: ClustRViz provides fast computation and interactive for the
convex clustering and bi-clustering problems. The CARP and
CBASS algorithms use an algorithmic regularization scheme to
obtain high-quality global approximations of the exact regularization
paths in a fraction of the time required for exact solutions. The
CARP-VIZ and CBASS-VIZ variants include a back-tracking scheme to
ensure exact dendrogram recovery. For more details, see "Dynamic Visualization
and Fast Computation for Convex Clustering and Bi-Clustering" by M. Weylandt,
J. Nagorski, and G.I. Allen, ArXiv 1901.01477 <https://arxiv.org/abs/1901.01477>.
Description: Fast computation and interactive for the convex clustering and
bi-clustering problems. The CARP and CBASS algorithms use an
algorithmic regularization scheme to obtain high-quality global
approximations of the exact regularization paths in a fraction of
the time required for exact solutions. The CARP-VIZ and CBASS-VIZ
variants include a back-tracking scheme to ensure exact dendrogram
recovery. For more details, see "Dynamic Visualization and Fast Computation
for Convex Clustering and Bi-Clustering" by M. Weylandt, J. Nagorski, and G.I. Allen,
ArXiv 1901.01477 <arXiv:1901.01477>.
License: GPL-3
Encoding: UTF-8
LazyData: true
Expand All @@ -42,13 +42,14 @@ Imports:
RColorBrewer,
heatmaply,
gganimate
RoxygenNote: 6.1.0
LinkingTo: Rcpp, RcppEigen
Suggests: testthat,
knitr,
rmarkdown,
MASS,
covr
covr,
cvxclustr,
cvxbiclustr
VignetteBuilder: knitr
BugReports: https://github.com/DataSlingers/clustRviz/issues
URL: https://github.io/DataSlingers/clustRviz, https://github.com/DataSlingers/clustRviz
2 changes: 1 addition & 1 deletion R/cbass.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ CBASS <- function(X,
crv_error("All elements of ", sQuote("X"), " must be finite.")
}

if (!is.logical(X.center.global) || is.na(X.center.global) || (length(X.center.global) != 1L)) {
if (!is.logical(X.center.global) || anyNA(X.center.global) || (length(X.center.global) != 1L)) {
crv_error(sQuote("X.center.global"), "must be either ", sQuote("TRUE"), " or ", sQuote("FALSE."))
}

Expand Down
10 changes: 5 additions & 5 deletions R/util_myheatmap2.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ my.heatmap.2 <- function(x, Rowv = TRUE,
"Please consider using only one or the other."
)
}
if (is.null(Rowv) || is.na(Rowv)) {
if (is.null(Rowv) || anyNA(Rowv)) {
Rowv <- FALSE
}
if (is.null(Colv) || is.na(Colv)) {
if (is.null(Colv) || anyNA(Colv)) {
Colv <- FALSE
} else if (Colv == "Rowv" && !isTRUE(Rowv)) {
} else if (identical(Colv, "Rowv") && !isTRUE(Rowv)) {
Colv <- FALSE
}
if (length(di <- dim(x)) != 2 || !is.numeric(x)) {
Expand Down Expand Up @@ -236,7 +236,7 @@ my.heatmap.2 <- function(x, Rowv = TRUE,
}
nbr <- length(breaks)
ncol <- length(breaks) - 1
if (class(col) == "function") {
if (inherits(col, "function")) {
col <- col(ncol)
}
min.breaks <- min(breaks)
Expand Down Expand Up @@ -316,7 +316,7 @@ my.heatmap.2 <- function(x, Rowv = TRUE,
}
retval$breaks <- breaks
retval$col <- col
if (!gtools::invalid(na.color) & any(is.na(x))) {
if (!gtools::invalid(na.color) & anyNA(x)) {
mmat <- ifelse(is.na(x), 1, NA)
graphics::image(1:nc, 1:nr, mmat,
axes = FALSE, xlab = "", ylab = "",
Expand Down
7 changes: 4 additions & 3 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ISP <- function(sp.path, v.path, u.path, gamma.path, cardE) {
NewU <- NULL
U <- NULL

colnames(sp.path) <- paste0("V", seq_len(NCOL(sp.path)))
as_tibble(sp.path) %>%
dplyr::mutate(Iter = 1:n()) %>%
tidyr::gather(ColLab, SpValue, -Iter) %>%
Expand Down Expand Up @@ -121,7 +122,7 @@ ISP <- function(sp.path, v.path, u.path, gamma.path, cardE) {
})
) %>%
dplyr::select(-data) %>%
tidyr::unnest() %>%
tidyr::unnest(cols = .data$tst) %>%
dplyr::ungroup() %>%
dplyr::arrange(Iter, Rank) %>%
dplyr::select(-Rank),
Expand Down Expand Up @@ -192,7 +193,7 @@ ISP <- function(sp.path, v.path, u.path, gamma.path, cardE) {
})
) %>%
dplyr::select(-data) %>%
tidyr::unnest() %>%
tidyr::unnest(cols = .data$NewGamma) %>%
dplyr::arrange(Iter),
by = c("Iter")
) %>%
Expand Down Expand Up @@ -250,7 +251,7 @@ ISP <- function(sp.path, v.path, u.path, gamma.path, cardE) {
})
) %>%
dplyr::select(-data) %>%
tidyr::unnest(),
tidyr::unnest(cols = .data$NewU),
by = c("Iter")
) %>%
dplyr::mutate(
Expand Down
2 changes: 1 addition & 1 deletion R/weights.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ dense_rbf_kernel_weights <- function(phi = "auto",
sQuote("stats::dist"), " for supported distances.")
})

if ((p <= 0) || !is_numeric_scalar(p)) {
if (!is_numeric_scalar(p) || (p <= 0)) {
crv_error(sQuote("p"),
" must be a positive scalar; see the ", sQuote("p"),
" argument of ", sQuote("stats::dist"), " for details.")
Expand Down
9 changes: 3 additions & 6 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ knitr::opts_chunk$set(
fig.path = "man/figures/README-"
)
```

[![TravisCI Build Status](https://travis-ci.com/DataSlingers/clustRviz.svg?branch=develop)](https://travis-ci.com/DataSlingers/clustRviz) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/DataSlingers/clustRviz?branch=develop&svg=true)](https://ci.appveyor.com/project/michaelweylandt/clustRviz) [![codecov Coverage
Status](https://codecov.io/gh/DataSlingers/clustRviz/branch/develop/graph/badge.svg)](https://codecov.io/gh/DataSlingers/clustRviz/branch/develop)
[![GitHub Actions Build Status](https://github.com/DataSlingers/clustRviz/workflows/R-CMD-check and Deploy/badge.svg)](https://github.com/DataSlingers/clustRviz/actions?query=workflow%3A%22R-CMD-check+and+Deploy%22)
[![codecov Coverage Status](https://codecov.io/gh/DataSlingers/clustRviz/branch/develop/graph/badge.svg)](https://codecov.io/gh/DataSlingers/clustRviz/branch/develop)
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/clustRviz)](https://cran.r-project.org/package=clustRviz)
[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)

# clustRviz

Expand Down
Loading

0 comments on commit 3e6f5d7

Please sign in to comment.