Skip to content

Enable Github Action #3862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
103 changes: 103 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
on:
push:
branches:
- master
pull_request:
branches:
- 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: windows-latest, r: '3.6', vdiffr: true}
- {os: macOS-latest, r: '3.6', vdiffr: true}
- {os: macOS-latest, r: 'devel', vdiffr: false}
- {os: ubuntu-16.04, r: '3.2', vdiffr: false, cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.3', vdiffr: false, cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.4', vdiffr: false, cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.5', vdiffr: false, cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.6', vdiffr: true, cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
CRAN: ${{ matrix.config.cran }}
# don't treat missing suggested packages as error
_R_CHECK_FORCE_SUGGESTS_: false
# Runs vdiffr test only on the latest version of R
VDIFFR_RUN_TESTS: ${{ matrix.config.vdiffr }}
VDIFFR_LOG_PATH: "../vdiffr.Rout.fail"

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: Install XQuartz on macOS
if: runner.os == 'macOS'
run: brew cask install xquartz

# To install vdiffr, these three libraries/tools are needed:
# - freetype (already installed, needed by systemfonts)
# - cairo (not installed, needed by gdtools)
# - pkg-config (not installed, needed to set proper build settings)
- name: Install pkg-config and cairo on devel macOS
if: runner.os == 'macOS' && matrix.config.r == 'devel'
run: brew install pkg-config cairo

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), "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('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("rcmdcheck")
shell: Rscript {0}

- name: Check
run: rcmdcheck::rcmdcheck(args = "--no-manual", 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: Test coverage
if: matrix.config.os == 'macOS-latest' && matrix.config.r == '3.6'
run: covr::codecov()
shell: Rscript {0}
28 changes: 28 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
push:
branches:
- master
release:
types: [published]

name: pkgdown

jobs:
pkgdown:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@master
- uses: r-lib/actions/setup-pandoc@master
- name: Install dependencies
run: |
install.packages("remotes")
remotes::install_deps(dependencies = TRUE)
remotes::install_github("tidyverse/tidytemplate")
remotes::install_dev("pkgdown")
shell: Rscript {0}
- name: Install package
run: R CMD INSTALL .
- name: Deploy package
run: pkgdown::deploy_to_branch(new_process = FALSE)
shell: Rscript {0}
52 changes: 52 additions & 0 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
on:
issue_comment:
types: [created]
name: Commands
jobs:
document:
if: startsWith(github.event.comment.body, '/document')
name: document
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/pr-fetch@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: r-lib/actions/setup-r@master
- name: Install dependencies
run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)'
- name: Document
run: Rscript -e 'roxygen2::roxygenise()'
- name: commit
run: |
git add man/\* NAMESPACE
git commit -m 'Document'
- uses: r-lib/actions/pr-push@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
style:
if: startsWith(github.event.comment.body, '/style')
name: style
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/pr-fetch@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: r-lib/actions/setup-r@master
- name: Install dependencies
run: Rscript -e 'install.packages("styler")'
- name: Style
run: Rscript -e 'styler::style_pkg()'
- name: commit
run: |
git add \*.R
git commit -m 'Style'
- uses: r-lib/actions/pr-push@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# A mock job just to ensure we have a successful build status
finish:
runs-on: ubuntu-latest
steps:
- run: true
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ matrix:
- r: release
env: VDIFFR_RUN_TESTS=true
env: VDIFFR_LOG_PATH="../vdiffr.Rout.fail"
before_cache:
- Rscript -e 'remotes::install_cran("pkgdown")'
- Rscript -e 'remotes::install_github("tidyverse/tidytemplate")'
deploy:
provider: script
script: Rscript -e 'pkgdown::deploy_site_github(verbose = TRUE)'
skip_cleanup: true
- r: 3.5
- r: 3.4
- r: 3.3
Expand Down
3 changes: 1 addition & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ knitr::opts_chunk$set(

# ggplot2 <img src="man/figures/logo.png" align="right" width="120" />

[![Travis Build Status](https://travis-ci.org/tidyverse/ggplot2.svg?branch=master)](https://travis-ci.org/tidyverse/ggplot2)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/tidyverse/ggplot2?branch=master&svg=true)](https://ci.appveyor.com/project/tidyverse/ggplot2)
[![R build status](https://github.com/tidyverse/ggplot2/workflows/R-CMD-check/badge.svg)](https://github.com/tidyverse/ggplot2/actions)
[![Coverage Status](https://img.shields.io/codecov/c/github/tidyverse/ggplot2/master.svg)](https://codecov.io/github/tidyverse/ggplot2?branch=master)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/ggplot2)](https://cran.r-project.org/package=ggplot2)

Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

# ggplot2 <img src="man/figures/logo.png" align="right" width="120" />

[![Travis Build
Status](https://travis-ci.org/tidyverse/ggplot2.svg?branch=master)](https://travis-ci.org/tidyverse/ggplot2)
[![AppVeyor Build
Status](https://ci.appveyor.com/api/projects/status/github/tidyverse/ggplot2?branch=master&svg=true)](https://ci.appveyor.com/project/tidyverse/ggplot2)
[![R build
status](https://github.com/tidyverse/ggplot2/workflows/R-CMD-check/badge.svg)](https://github.com/tidyverse/ggplot2/actions)
[![Coverage
Status](https://img.shields.io/codecov/c/github/tidyverse/ggplot2/master.svg)](https://codecov.io/github/tidyverse/ggplot2?branch=master)
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/ggplot2)](https://cran.r-project.org/package=ggplot2)
Expand Down
11 changes: 11 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
comment: false

coverage:
status:
project:
default:
target: auto
threshold: 1%
patch:
default:
target: auto
threshold: 1%
Binary file modified man/figures/README-example-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions tests/testthat/test-conditions.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ get_n_warning <- function(f) {
sum(d$token == "SYMBOL_FUNCTION_CALL" & d$text == "warning")
}

# Pattern is needed filter out files such as ggplot2.rdb, which is created when running covr::package_coverage()
R_files <- list.files("../../R", pattern = ".*\\.(R|r)$", full.names = TRUE)

test_that("do not use stop()", {
stops <- vapply(list.files("../../R", full.names = TRUE), get_n_stop, integer(1))
stops <- vapply(R_files, get_n_stop, integer(1))
expect_equal(sum(stops), 0)
})

test_that("do not use warning()", {
warnings <- vapply(list.files("../../R", full.names = TRUE), get_n_warning, integer(1))
warnings <- vapply(R_files, get_n_warning, integer(1))
expect_equal(sum(warnings), 0)
})
14 changes: 9 additions & 5 deletions tests/testthat/test-geom-quantile.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,40 @@ test_that("geom_quantile matches quantile regression", {
tau = quants,
data = df
),
tibble::tibble(
data_frame(
x = seq(min(x), max(x), length.out = 100)
)
)

pred_rq <- cbind(seq(min(x), max(x), length.out = 100), pred_rq)
colnames(pred_rq) <- c("x", paste("Q", quants * 100, sep = "_"))

ggplot_data <- tibble::as_tibble(layer_data(ps))
# pred_rq is a matrix; convert it to data.frame so that it can be compared
pred_rq <- as.data.frame(pred_rq)

ggplot_data <- layer_data(ps)

pred_rq_test_25 <- pred_rq[, c("x", "Q_25")]
colnames(pred_rq_test_25) <- c("x", "y")

expect_equal(
# Use expect_equivalent() to ignore rownames
expect_equivalent(
ggplot_data[ggplot_data$quantile == 0.25, c("x", "y")],
pred_rq_test_25
)

pred_rq_test_50 <- pred_rq[, c("x", "Q_50")]
colnames(pred_rq_test_50) <- c("x", "y")

expect_equal(
expect_equivalent(
ggplot_data[ggplot_data$quantile == 0.5, c("x", "y")],
pred_rq_test_50
)

pred_rq_test_75 <- pred_rq[, c("x", "Q_75")]
colnames(pred_rq_test_75) <- c("x", "y")

expect_equal(
expect_equivalent(
ggplot_data[ggplot_data$quantile == 0.75, c("x", "y")],
pred_rq_test_75
)
Expand Down