Skip to content

Commit c8c41cb

Browse files
Enable Github Action (#3862)
1 parent ea68755 commit c8c41cb

File tree

11 files changed

+212
-20
lines changed

11 files changed

+212
-20
lines changed

.github/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.html

.github/workflows/R-CMD-check.yaml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
branches:
7+
- master
8+
9+
name: R-CMD-check
10+
11+
jobs:
12+
R-CMD-check:
13+
runs-on: ${{ matrix.config.os }}
14+
15+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
config:
21+
- {os: windows-latest, r: '3.6', vdiffr: true}
22+
- {os: macOS-latest, r: '3.6', vdiffr: true}
23+
- {os: macOS-latest, r: 'devel', vdiffr: false}
24+
- {os: ubuntu-16.04, r: '3.2', vdiffr: false, cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
25+
- {os: ubuntu-16.04, r: '3.3', vdiffr: false, cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
26+
- {os: ubuntu-16.04, r: '3.4', vdiffr: false, cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
27+
- {os: ubuntu-16.04, r: '3.5', vdiffr: false, cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
28+
- {os: ubuntu-16.04, r: '3.6', vdiffr: true, cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
29+
30+
env:
31+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
32+
CRAN: ${{ matrix.config.cran }}
33+
# don't treat missing suggested packages as error
34+
_R_CHECK_FORCE_SUGGESTS_: false
35+
# Runs vdiffr test only on the latest version of R
36+
VDIFFR_RUN_TESTS: ${{ matrix.config.vdiffr }}
37+
VDIFFR_LOG_PATH: "../vdiffr.Rout.fail"
38+
39+
steps:
40+
- uses: actions/checkout@v2
41+
42+
- uses: r-lib/actions/setup-r@master
43+
with:
44+
r-version: ${{ matrix.config.r }}
45+
46+
- uses: r-lib/actions/setup-pandoc@master
47+
48+
- name: Install XQuartz on macOS
49+
if: runner.os == 'macOS'
50+
run: brew cask install xquartz
51+
52+
# To install vdiffr, these three libraries/tools are needed:
53+
# - freetype (already installed, needed by systemfonts)
54+
# - cairo (not installed, needed by gdtools)
55+
# - pkg-config (not installed, needed to set proper build settings)
56+
- name: Install pkg-config and cairo on devel macOS
57+
if: runner.os == 'macOS' && matrix.config.r == 'devel'
58+
run: brew install pkg-config cairo
59+
60+
- name: Query dependencies
61+
run: |
62+
install.packages('remotes')
63+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), "depends.Rds", version = 2)
64+
shell: Rscript {0}
65+
66+
- name: Cache R packages
67+
if: runner.os != 'Windows'
68+
uses: actions/cache@v1
69+
with:
70+
path: ${{ env.R_LIBS_USER }}
71+
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
72+
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-
73+
74+
- name: Install system dependencies
75+
if: runner.os == 'Linux'
76+
env:
77+
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
78+
run: |
79+
Rscript -e "remotes::install_github('r-hub/sysreqs')"
80+
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
81+
sudo -s eval "$sysreqs"
82+
83+
- name: Install dependencies
84+
run: |
85+
remotes::install_deps(dependencies = TRUE)
86+
remotes::install_cran("rcmdcheck")
87+
shell: Rscript {0}
88+
89+
- name: Check
90+
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "warning", check_dir = "check")
91+
shell: Rscript {0}
92+
93+
- name: Upload check results
94+
if: failure()
95+
uses: actions/upload-artifact@master
96+
with:
97+
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
98+
path: check
99+
100+
- name: Test coverage
101+
if: matrix.config.os == 'macOS-latest' && matrix.config.r == '3.6'
102+
run: covr::codecov()
103+
shell: Rscript {0}

.github/workflows/pkgdown.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
release:
6+
types: [published]
7+
8+
name: pkgdown
9+
10+
jobs:
11+
pkgdown:
12+
runs-on: macOS-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: r-lib/actions/setup-r@master
16+
- uses: r-lib/actions/setup-pandoc@master
17+
- name: Install dependencies
18+
run: |
19+
install.packages("remotes")
20+
remotes::install_deps(dependencies = TRUE)
21+
remotes::install_github("tidyverse/tidytemplate")
22+
remotes::install_dev("pkgdown")
23+
shell: Rscript {0}
24+
- name: Install package
25+
run: R CMD INSTALL .
26+
- name: Deploy package
27+
run: pkgdown::deploy_to_branch(new_process = FALSE)
28+
shell: Rscript {0}

.github/workflows/pr-commands.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
on:
2+
issue_comment:
3+
types: [created]
4+
name: Commands
5+
jobs:
6+
document:
7+
if: startsWith(github.event.comment.body, '/document')
8+
name: document
9+
runs-on: macOS-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: r-lib/actions/pr-fetch@master
13+
with:
14+
repo-token: ${{ secrets.GITHUB_TOKEN }}
15+
- uses: r-lib/actions/setup-r@master
16+
- name: Install dependencies
17+
run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)'
18+
- name: Document
19+
run: Rscript -e 'roxygen2::roxygenise()'
20+
- name: commit
21+
run: |
22+
git add man/\* NAMESPACE
23+
git commit -m 'Document'
24+
- uses: r-lib/actions/pr-push@master
25+
with:
26+
repo-token: ${{ secrets.GITHUB_TOKEN }}
27+
style:
28+
if: startsWith(github.event.comment.body, '/style')
29+
name: style
30+
runs-on: macOS-latest
31+
steps:
32+
- uses: actions/checkout@v2
33+
- uses: r-lib/actions/pr-fetch@master
34+
with:
35+
repo-token: ${{ secrets.GITHUB_TOKEN }}
36+
- uses: r-lib/actions/setup-r@master
37+
- name: Install dependencies
38+
run: Rscript -e 'install.packages("styler")'
39+
- name: Style
40+
run: Rscript -e 'styler::style_pkg()'
41+
- name: commit
42+
run: |
43+
git add \*.R
44+
git commit -m 'Style'
45+
- uses: r-lib/actions/pr-push@master
46+
with:
47+
repo-token: ${{ secrets.GITHUB_TOKEN }}
48+
# A mock job just to ensure we have a successful build status
49+
finish:
50+
runs-on: ubuntu-latest
51+
steps:
52+
- run: true

.travis.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ matrix:
1010
- r: release
1111
env: VDIFFR_RUN_TESTS=true
1212
env: VDIFFR_LOG_PATH="../vdiffr.Rout.fail"
13-
before_cache:
14-
- Rscript -e 'remotes::install_cran("pkgdown")'
15-
- Rscript -e 'remotes::install_github("tidyverse/tidytemplate")'
16-
deploy:
17-
provider: script
18-
script: Rscript -e 'pkgdown::deploy_site_github(verbose = TRUE)'
19-
skip_cleanup: true
2013
- r: 3.5
2114
- r: 3.4
2215
- r: 3.3

README.Rmd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ knitr::opts_chunk$set(
1414

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

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

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33

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

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

codecov.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
11
comment: false
2+
3+
coverage:
4+
status:
5+
project:
6+
default:
7+
target: auto
8+
threshold: 1%
9+
patch:
10+
default:
11+
target: auto
12+
threshold: 1%

man/figures/README-example-1.png

172 Bytes
Loading

tests/testthat/test-conditions.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ get_n_warning <- function(f) {
1010
sum(d$token == "SYMBOL_FUNCTION_CALL" & d$text == "warning")
1111
}
1212

13+
# Pattern is needed filter out files such as ggplot2.rdb, which is created when running covr::package_coverage()
14+
R_files <- list.files("../../R", pattern = ".*\\.(R|r)$", full.names = TRUE)
15+
1316
test_that("do not use stop()", {
14-
stops <- vapply(list.files("../../R", full.names = TRUE), get_n_stop, integer(1))
17+
stops <- vapply(R_files, get_n_stop, integer(1))
1518
expect_equal(sum(stops), 0)
1619
})
1720

1821
test_that("do not use warning()", {
19-
warnings <- vapply(list.files("../../R", full.names = TRUE), get_n_warning, integer(1))
22+
warnings <- vapply(R_files, get_n_warning, integer(1))
2023
expect_equal(sum(warnings), 0)
2124
})

tests/testthat/test-geom-quantile.R

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,40 @@ test_that("geom_quantile matches quantile regression", {
1717
tau = quants,
1818
data = df
1919
),
20-
tibble::tibble(
20+
data_frame(
2121
x = seq(min(x), max(x), length.out = 100)
2222
)
2323
)
2424

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

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

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

33-
expect_equal(
36+
# Use expect_equivalent() to ignore rownames
37+
expect_equivalent(
3438
ggplot_data[ggplot_data$quantile == 0.25, c("x", "y")],
3539
pred_rq_test_25
3640
)
3741

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

41-
expect_equal(
45+
expect_equivalent(
4246
ggplot_data[ggplot_data$quantile == 0.5, c("x", "y")],
4347
pred_rq_test_50
4448
)
4549

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

49-
expect_equal(
53+
expect_equivalent(
5054
ggplot_data[ggplot_data$quantile == 0.75, c("x", "y")],
5155
pred_rq_test_75
5256
)

0 commit comments

Comments
 (0)