Skip to content

Commit

Permalink
wip migrate to gha
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Jun 21, 2021
1 parent 9ca8892 commit ca5a4c9
Show file tree
Hide file tree
Showing 14 changed files with 266 additions and 193 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ revdep/
README.Rmd
abbvie.R
^\.httr-oauth$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
141 changes: 141 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# NOTE: This workflow is overkill for most R packages
# check-standard.yaml is likely a better choice
# usethis::use_github_action("check-standard") will install it.
#
# 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

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

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

strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/latest"}
- {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.1.0 (ubuntu-18.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
# vdiffr & shinytest only runs on linux r-release since the results aren't cross-platform
- {os: ubuntu-18.04, r: 'release', vdiffr: true, shinytest: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}

env:
RSPM: ${{ matrix.config.rspm }}
VDIFFR: ${{ matrix.config.vdiffr }}
SHINYTEST: ${{ matrix.config.shinytest }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
id: install-r
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}

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

- name: Install pak and query dependencies
run: |
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
shell: Rscript {0}

- name: Restore R package cache
uses: actions/cache@v2
with:
path: |
${{ env.R_LIBS_USER }}/*
!${{ env.R_LIBS_USER }}/pak
key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
pak::local_system_requirements(execute = TRUE)
pak::pkg_system_requirements("rcmdcheck", execute = TRUE)
shell: Rscript {0}

#- name: Install google chrome
# if: matrix.config.vdiffr == true
# shell: bash
# run: |
# wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
# sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
# apt-get update -y
# apt-get install -y google-chrome-stable

# TODO: maybe this should install via conda or npm instead?
- name: Install orca
if: matrix.config.vdiffr == true
shell: bash
run: |
sudo apt-get -y update
sudo apt-get install -y libgtk2.0-0 libgconf-2-4 xvfb xauth libxtst6 libxss1 libnss3 libasound2 desktop-file-utils
mkdir -p /opt/orca
cd /opt/orca
wget https://github.com/plotly/orca/releases/download/v1.3.1/orca-1.3.1.AppImage
sudo chmod +x orca-1.3.1.AppImage
sudo ./orca-1.3.1.AppImage --appimage-extract
sudo rm orca-1.3.1.AppImage
sudo printf '#!/bin/bash \nargs=("$@") \nif [[ ! " ${args[@]} " =~ "--no-sandbox" ]]; then \n args+=("--no-sandbox") \nfi \nxvfb-run --auto-servernum --server-args "-screen 0 640x480x24" /opt/orca/squashfs-root/orca "${args[@]}"' > /usr/bin/orca \
sudo chmod +x /usr/bin/orca
sudo orca graph '{ "data": [{"y": [1,2,1]}] }' -o fig.png
- name: Install dependencies
run: |
pak::local_install_dev_deps(upgrade = TRUE)
pak::pkg_install("rcmdcheck")
shell: Rscript {0}

- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_: false
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results
path: check

- name: Don't use tar from old Rtools to store the cache
if: ${{ runner.os == 'Windows' && startsWith(steps.install-r.outputs.installed-r-version, '3.6' ) }}
shell: bash
run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ Suggests:
processx,
plotlyGeoAssets,
forcats,
palmerpenguins
palmerpenguins,
rversions
LazyData: true
RoxygenNote: 7.1.1
Encoding: UTF-8
Expand Down
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# 4.9.4.9000

## Changes to plotly.js

* This version of the R package upgrades the version of the underlying plotly.js library from v1.57.1 to v2.0.0. This includes many breaking changes, bug fixes, and improvements to the underlying JavaScript library. The [plotly.js release page](https://github.com/plotly/plotly.js/releases) has the full list of changes.

## Breaking changes

* `ggplotly()` now uses the `layout.legend.title` (instead of `layout.annotations`) plotly.js API to convert guides for discrete scales. (#1961)

# 4.9.4.1

## BUG FIXES
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

<img src="man/figures/plotly.png" width="200" />

[![Build
Status](https://travis-ci.org/ropensci/plotly.png?branch=master)](https://travis-ci.org/ropensci/plotly)
<!-- badges: start -->
[![R-CMD-check](https://github.com/ropensci/plotly/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/plotly/actions)
[![CRAN
Status](https://www.r-pkg.org/badges/version/plotly)](https://cran.r-project.org/package=plotly)
[![CRAN
Downloads](https://cranlogs.r-pkg.org/badges/grand-total/plotly)](https://www.rpackages.io/package/plotly)
[![monthly](https://cranlogs.r-pkg.org/badges/plotly)](https://www.rpackages.io/package/plotly)
<!-- badges: end -->

An R package for creating interactive web graphics via the open source
JavaScript graphing library
Expand All @@ -23,10 +24,10 @@ Install from CRAN:
install.packages("plotly")
```

Or install the latest development version (on GitHub) via devtools:
Or install the latest development version (on GitHub) via `{remotes}`:

``` r
devtools::install_github("ropensci/plotly")
remotes::install_github("ropensci/plotly")
```

## Getting started
Expand Down
95 changes: 0 additions & 95 deletions inst/docker/Dockerfile.vtest

This file was deleted.

Empty file removed inst/docker/README.md
Empty file.
32 changes: 22 additions & 10 deletions tests/testthat/helper-skip.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
# Some tests make plot.ly HTTP requests and require a valid user account
# (see test-plotly-filename.R). For security reasons, these tests should be
# skipped on pull requests (the .travis.yml file uses encrypted credentials
# & encrypted environment vars cannot be accessed on pull request builds)
skip_if_not_master <- function() {
r_version <- paste(R.version$major, R.version$minor, sep = ".")
r_release <- rversions::r_release()$version
is_release <- isTRUE(r_release == r_version)
is_win <- .Platform$OS.type == "windows"

skip_cloud_tests <- function() {
skip_on_cran()
if (is.na(Sys.getenv("plotly_username", NA))) {
return(skip("Testing plot.ly API calls requires a plotly account"))
skip("Cloud testing requires a plotly account (plotly_username)")
}
if (is.na(Sys.getenv("plotly_api_key", NA))) {
skip("Cloud testing requires a plotly account (plotly_api_key)")
}
if (!is_release || !is_win) {
skip("Cloud testing is only run on Windows with the current release of R")
}
}

skip_shinytest_tests <- function() {
skip_on_cran()
skip_if_not_installed("shinytest")
if (!grepl("true", Sys.getenv("SHINYTEST"), fixed = TRUE)) {
skip("shinytest testing requires the SHINYTEST environment variable to be true")
}
is_pr <- grepl("^[0-9]+$", Sys.getenv("TRAVIS_PULL_REQUEST"))
is_r_release <- Sys.getenv("TRAVIS_R_VERSION_STRING", "release") == "release"
if (!is_pr && is_r_release) return(invisible(TRUE))
skip("plot.ly API calls are only tested on the master build on r-release")
}
5 changes: 1 addition & 4 deletions tests/testthat/helper-vdiffr.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# If VDIFFR is TRUE, enable visual testing
enable_vdiffr <- as.logical(Sys.getenv("VDIFFR", FALSE))
enable_vdiffr <- grepl("true", Sys.getenv("VDIFFR"), fixed = TRUE)

message("Visual testing is ", if (!enable_vdiffr) "not ", "enabled.")

Expand Down Expand Up @@ -46,9 +46,6 @@ if (enable_vdiffr) {
writeLines(svg_txt, file)
}

# force the vdiffr shiny app to open in a real browser
# (some svg files seem to not render properly in RStudio)
options(shiny.launch.browser = interactive())
}

expect_doppelganger <- function(p, name, ...) {
Expand Down
Loading

0 comments on commit ca5a4c9

Please sign in to comment.