Skip to content

Commit 92ff26e

Browse files
committed
use_tidy_github_actions()
1 parent 53f9984 commit 92ff26e

File tree

7 files changed

+166
-63
lines changed

7 files changed

+166
-63
lines changed

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

+56-29
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
# NOTE: This workflow is overkill for most R packages
2+
# check-standard.yaml is likely a better choice
3+
# usethis::use_github_action("check-standard") will install it.
4+
#
5+
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
6+
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
17
on:
28
push:
39
branches:
10+
- main
411
- master
512
pull_request:
613
branches:
14+
- main
715
- master
816

917
name: R-CMD-check
@@ -18,62 +26,81 @@ jobs:
1826
fail-fast: false
1927
matrix:
2028
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+
- {os: macOS-latest, r: 'release'}
30+
- {os: windows-latest, r: 'release'}
31+
- {os: windows-latest, r: '3.6'}
32+
- {os: ubuntu-16.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest", http-user-agent: "R/4.0.0 (ubuntu-16.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
33+
- {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
34+
- {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
35+
- {os: ubuntu-16.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
36+
- {os: ubuntu-16.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
37+
- {os: ubuntu-16.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
2938

3039
env:
3140
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
32-
CRAN: ${{ matrix.config.cran }}
41+
RSPM: ${{ matrix.config.rspm }}
42+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3343

3444
steps:
35-
- uses: actions/checkout@v1
45+
- uses: actions/checkout@v2
3646

37-
- uses: r-lib/actions/setup-r@master
47+
- uses: r-lib/actions/setup-r@v1
3848
with:
3949
r-version: ${{ matrix.config.r }}
50+
http-user-agent: ${{ matrix.config.http-user-agent }}
4051

41-
- uses: r-lib/actions/setup-pandoc@master
52+
- uses: r-lib/actions/setup-pandoc@v1
4253

4354
- name: Query dependencies
44-
run: Rscript -e "install.packages('remotes')" -e "saveRDS(remotes::dev_package_deps(dependencies = TRUE), 'depends.Rds', version = 2)"
55+
run: |
56+
install.packages('remotes')
57+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
58+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
59+
shell: Rscript {0}
4560

4661
- name: Cache R packages
4762
if: runner.os != 'Windows'
48-
uses: actions/cache@v1
63+
uses: actions/cache@v2
4964
with:
5065
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 }}-
66+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
67+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
5368

5469
- name: Install system dependencies
5570
if: runner.os == 'Linux'
56-
env:
57-
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
5871
run: |
59-
Rscript -e "remotes::install_github('r-hub/sysreqs')"
60-
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
61-
sudo -s eval "$sysreqs"
72+
while read -r cmd
73+
do
74+
eval sudo $cmd
75+
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "16.04"))')
6276
6377
- name: Install dependencies
64-
run: Rscript -e "library(remotes)" -e "update(readRDS('depends.Rds'))" -e "remotes::install_cran('rcmdcheck')"
78+
run: |
79+
remotes::install_deps(dependencies = TRUE)
80+
remotes::install_cran("rcmdcheck")
81+
shell: Rscript {0}
82+
83+
- name: Session info
84+
run: |
85+
options(width = 100)
86+
pkgs <- installed.packages()[, "Package"]
87+
sessioninfo::session_info(pkgs, include_base = TRUE)
88+
shell: Rscript {0}
6589

6690
- name: Check
67-
run: Rscript -e "rcmdcheck::rcmdcheck(args = '--no-manual', error_on = 'warning', check_dir = 'check')"
91+
env:
92+
_R_CHECK_CRAN_INCOMING_: false
93+
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
94+
shell: Rscript {0}
95+
96+
- name: Show testthat output
97+
if: always()
98+
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
99+
shell: bash
68100

69101
- name: Upload check results
70102
if: failure()
71-
uses: actions/upload-artifact@master
103+
uses: actions/upload-artifact@main
72104
with:
73105
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
74106
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

+32-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,49 @@
11
on:
22
push:
3-
branches: master
3+
branches:
4+
- main
5+
- master
46

5-
name: Pkgdown
7+
name: pkgdown
68

79
jobs:
810
pkgdown:
911
runs-on: macOS-latest
12+
env:
13+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1014
steps:
1115
- uses: actions/checkout@v2
12-
- uses: r-lib/actions/setup-r@master
13-
- uses: r-lib/actions/setup-pandoc@master
16+
17+
- uses: r-lib/actions/setup-r@v1
18+
19+
- uses: r-lib/actions/setup-pandoc@v1
20+
21+
- name: Query dependencies
22+
run: |
23+
install.packages('remotes')
24+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
25+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
26+
shell: Rscript {0}
27+
28+
- name: Cache R packages
29+
uses: actions/cache@v2
30+
with:
31+
path: ${{ env.R_LIBS_USER }}
32+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
33+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
34+
1435
- name: Install dependencies
1536
run: |
16-
install.packages("remotes")
1737
remotes::install_deps(dependencies = TRUE)
18-
remotes::install_dev("pkgdown")
1938
remotes::install_github("tidyverse/tidytemplate")
39+
install.packages("pkgdown", type = "binary")
2040
shell: Rscript {0}
41+
2142
- name: Install package
2243
run: R CMD INSTALL .
44+
2345
- name: Deploy package
24-
run: pkgdown::deploy_to_branch(new_process = FALSE)
25-
shell: Rscript {0}
46+
run: |
47+
git config --local user.email "actions@github.com"
48+
git config --local user.name "GitHub Actions"
49+
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'

.github/workflows/pr-commands.yaml

+19-16
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,49 @@ jobs:
77
if: startsWith(github.event.comment.body, '/document')
88
name: document
99
runs-on: macOS-latest
10+
env:
11+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1012
steps:
11-
- uses: actions/checkout@v1
12-
- uses: r-lib/actions/pr-fetch@master
13+
- uses: actions/checkout@v2
14+
- uses: r-lib/actions/pr-fetch@v1
1315
with:
1416
repo-token: ${{ secrets.GITHUB_TOKEN }}
15-
- uses: r-lib/actions/setup-r@master
17+
- uses: r-lib/actions/setup-r@v1
1618
- name: Install dependencies
1719
run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)'
1820
- name: Document
1921
run: Rscript -e 'roxygen2::roxygenise()'
2022
- name: commit
2123
run: |
24+
git config --local user.email "actions@github.com"
25+
git config --local user.name "GitHub Actions"
2226
git add man/\* NAMESPACE
2327
git commit -m 'Document'
24-
- uses: r-lib/actions/pr-push@master
28+
- uses: r-lib/actions/pr-push@v1
2529
with:
2630
repo-token: ${{ secrets.GITHUB_TOKEN }}
2731
style:
2832
if: startsWith(github.event.comment.body, '/style')
29-
name: document
33+
name: style
3034
runs-on: macOS-latest
35+
env:
36+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3137
steps:
32-
- uses: actions/checkout@master
33-
- uses: r-lib/actions/pr-fetch@master
38+
- uses: actions/checkout@v2
39+
- uses: r-lib/actions/pr-fetch@v1
3440
with:
3541
repo-token: ${{ secrets.GITHUB_TOKEN }}
36-
- uses: r-lib/actions/setup-r@master
42+
- uses: r-lib/actions/setup-r@v1
3743
- name: Install dependencies
3844
run: Rscript -e 'install.packages("styler")'
39-
- name: style
45+
- name: Style
4046
run: Rscript -e 'styler::style_pkg()'
4147
- name: commit
4248
run: |
49+
git config --local user.email "actions@github.com"
50+
git config --local user.name "GitHub Actions"
4351
git add \*.R
44-
git commit -m 'style'
45-
- uses: r-lib/actions/pr-push@master
52+
git commit -m 'Style'
53+
- uses: r-lib/actions/pr-push@v1
4654
with:
4755
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

.github/workflows/test-coverage.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
- master
6+
pull_request:
7+
branches:
8+
- main
9+
- master
10+
11+
name: test-coverage
12+
13+
jobs:
14+
test-coverage:
15+
runs-on: macOS-latest
16+
env:
17+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: r-lib/actions/setup-r@v1
22+
23+
- uses: r-lib/actions/setup-pandoc@v1
24+
25+
- name: Query dependencies
26+
run: |
27+
install.packages('remotes')
28+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
29+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
30+
shell: Rscript {0}
31+
32+
- name: Cache R packages
33+
uses: actions/cache@v2
34+
with:
35+
path: ${{ env.R_LIBS_USER }}
36+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
37+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
38+
39+
- name: Install dependencies
40+
run: |
41+
install.packages(c("remotes"))
42+
remotes::install_deps(dependencies = TRUE)
43+
remotes::install_cran("covr")
44+
shell: Rscript {0}
45+
46+
- name: Test coverage
47+
run: covr::codecov()
48+
shell: Rscript {0}

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-
[![R build status](https://github.com/tidyverse/forcats/workflows/R-CMD-check/badge.svg)](https://github.com/tidyverse/forcats)
19+
[![R-CMD-check](https://github.com/tidyverse/forcats/workflows/R-CMD-check/badge.svg)](https://github.com/tidyverse/forcats/actions)
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

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

88
[![CRAN
99
status](https://www.r-pkg.org/badges/version/forcats)](https://cran.r-project.org/package=forcats)
10-
[![R build
11-
status](https://github.com/tidyverse/forcats/workflows/R-CMD-check/badge.svg)](https://github.com/tidyverse/forcats)
10+
[![R-CMD-check](https://github.com/tidyverse/forcats/workflows/R-CMD-check/badge.svg)](https://github.com/tidyverse/forcats/actions)
1211
[![Codecov test
1312
coverage](https://codecov.io/gh/tidyverse/forcats/branch/master/graph/badge.svg)](https://codecov.io/gh/tidyverse/forcats?branch=master)
1413
<!-- badges: end -->
@@ -22,10 +21,10 @@ reordering character vectors to improve display. The goal of the
2221
problems with factors, including changing the order of levels or the
2322
values. Some examples include:
2423

25-
- `fct_reorder()`: Reordering a factor by another variable.
26-
- `fct_infreq()`: Reordering a factor by the frequency of values.
27-
- `fct_relevel()`: Changing the order of a factor by hand.
28-
- `fct_lump()`: Collapsing the least/most frequent values of a factor
24+
- `fct_reorder()`: Reordering a factor by another variable.
25+
- `fct_infreq()`: Reordering a factor by the frequency of values.
26+
- `fct_relevel()`: Changing the order of a factor by hand.
27+
- `fct_lump()`: Collapsing the least/most frequent values of a factor
2928
into “other”.
3029

3130
You can learn more about each of these in `vignette("forcats")`. If
@@ -36,10 +35,10 @@ factors](http://r4ds.had.co.nz/factors.html) in R for Data Science.
3635

3736
# The easiest way to get forcats is to install the whole tidyverse:
3837
install.packages("tidyverse")
39-
38+
4039
# Alternatively, install just forcats:
4140
install.packages("forcats")
42-
41+
4342
# Or the the development version from GitHub:
4443
# install.packages("devtools")
4544
devtools::install_github("tidyverse/forcats")
@@ -117,7 +116,7 @@ For a history of factors, I recommend [*stringsAsFactors: An
117116
unauthorized
118117
biography*](http://simplystatistics.org/2015/07/24/stringsasfactors-an-unauthorized-biography/)
119118
by Roger Peng and [*stringsAsFactors =
120-
\<sigh\>*](http://notstatschat.tumblr.com/post/124987394001/stringsasfactors-sigh)
119+
&lt;sigh&gt;*](http://notstatschat.tumblr.com/post/124987394001/stringsasfactors-sigh)
121120
by Thomas Lumley. If you want to learn more about other approaches to
122121
working with factors and categorical data, I recommend [*Wrangling
123122
categorical data in R*](https://peerj.com/preprints/3163/), by Amelia

codecov.yml

+2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ coverage:
66
default:
77
target: auto
88
threshold: 1%
9+
informational: true
910
patch:
1011
default:
1112
target: auto
1213
threshold: 1%
14+
informational: true

0 commit comments

Comments
 (0)