Skip to content

Commit bb37b68

Browse files
Continuous integration with GitHub Actions (#246)
Resolves #235
1 parent b4b8670 commit bb37b68

File tree

7 files changed

+162
-25
lines changed

7 files changed

+162
-25
lines changed

.Rbuildignore

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
^revdep$
1717
^\.github$
1818
^LICENSE\.md$
19+
^\.github/workflows/R-CMD-check\.yaml$
20+
^\.github/workflows/pr-commands\.yaml$
21+
^\.github/workflows/pkgdown\.yaml$

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

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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'}
22+
- { os: macOS-latest, r: '3.6'}
23+
- { os: macOS-latest, r: 'devel'}
24+
- { os: ubuntu-16.04, r: '3.2', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
25+
- { os: ubuntu-16.04, r: '3.3', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
26+
- { os: ubuntu-16.04, r: '3.4', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
27+
- { os: ubuntu-16.04, r: '3.5', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
28+
- { os: ubuntu-16.04, r: '3.6', 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+
34+
steps:
35+
- uses: actions/checkout@v1
36+
37+
- uses: r-lib/actions/setup-r@master
38+
with:
39+
r-version: ${{ matrix.config.r }}
40+
41+
- uses: r-lib/actions/setup-pandoc@master
42+
43+
- name: Query dependencies
44+
run: Rscript -e "install.packages('remotes')" -e "saveRDS(remotes::dev_package_deps(dependencies = TRUE), 'depends.Rds', version = 2)"
45+
46+
- name: Cache R packages
47+
if: runner.os != 'Windows'
48+
uses: actions/cache@v1
49+
with:
50+
path: ${{ env.R_LIBS_USER }}
51+
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
52+
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-
53+
54+
- name: Install system dependencies
55+
if: runner.os == 'Linux'
56+
env:
57+
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
58+
run: |
59+
Rscript -e "remotes::install_github('r-hub/sysreqs')"
60+
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
61+
sudo -s eval "$sysreqs"
62+
63+
- name: Install dependencies
64+
run: Rscript -e "library(remotes)" -e "update(readRDS('depends.Rds'))" -e "remotes::install_cran('rcmdcheck')"
65+
66+
- name: Check
67+
run: Rscript -e "rcmdcheck::rcmdcheck(args = '--no-manual', error_on = 'warning', check_dir = 'check')"
68+
69+
- name: Upload check results
70+
if: failure()
71+
uses: actions/upload-artifact@master
72+
with:
73+
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
74+
path: check
75+
76+
- name: Test coverage
77+
if: matrix.config.os == 'macOS-latest' && matrix.config.r == '3.6'
78+
run: |
79+
Rscript -e 'covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")'

.github/workflows/pkgdown.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
on:
2+
push:
3+
branches: master
4+
5+
name: Pkgdown
6+
7+
jobs:
8+
pkgdown:
9+
runs-on: macOS-latest
10+
steps:
11+
- uses: actions/checkout@master
12+
- uses: r-lib/actions/setup-r@master
13+
- uses: r-lib/actions/setup-pandoc@master
14+
- name: Install dependencies
15+
run: |
16+
Rscript -e 'install.packages("remotes")' \
17+
-e 'remotes::install_deps(dependencies = TRUE)' \
18+
-e 'remotes::install_github("tidyverse/tidytemplate")' \
19+
-e 'remotes::install_github("jimhester/pkgdown@github-actions-deploy")'
20+
- name: Install package
21+
run: R CMD INSTALL .
22+
- name: Deploy package
23+
run: |
24+
pkgdown:::deploy_local(new_process = FALSE, remote_url = 'https://x-access-token:${{secrets.DEPLOY_PAT}}@github.com/${{github.repository}}.git')
25+
shell: Rscript {0}

.github/workflows/pr-commands.yaml

+52
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@v1
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: document
30+
runs-on: macOS-latest
31+
steps:
32+
- uses: actions/checkout@master
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

-22
This file was deleted.

README.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ knitr::opts_chunk$set(
1616

1717
<!-- badges: start -->
1818
[![CRAN status](https://www.r-pkg.org/badges/version/forcats)](https://cran.r-project.org/package=forcats)
19-
[![Travis build status](https://travis-ci.org/tidyverse/forcats.svg?branch=master)](https://travis-ci.org/tidyverse/forcats)
19+
[![R build status](https://github.com/tidyverse/forcats/workflows/R-CMD-check/badge.svg)](https://github.com/tidyverse/forcats)
2020
[![Codecov test coverage](https://codecov.io/gh/tidyverse/forcats/branch/master/graph/badge.svg)](https://codecov.io/gh/tidyverse/forcats?branch=master)
2121
<!-- badges: end -->
2222

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
[![CRAN
99
status](https://www.r-pkg.org/badges/version/forcats)](https://cran.r-project.org/package=forcats)
10-
[![Travis build
11-
status](https://travis-ci.org/tidyverse/forcats.svg?branch=master)](https://travis-ci.org/tidyverse/forcats)
10+
[![R build
11+
status](https://github.com/tidyverse/forcats/workflows/R-CMD-check/badge.svg)](https://github.com/tidyverse/forcats)
1212
[![Codecov test
1313
coverage](https://codecov.io/gh/tidyverse/forcats/branch/master/graph/badge.svg)](https://codecov.io/gh/tidyverse/forcats?branch=master)
1414
<!-- badges: end -->

0 commit comments

Comments
 (0)