Skip to content

Commit d27511c

Browse files
authored
Update GitHub Actions workflows (#644)
1 parent eb5e8c9 commit d27511c

File tree

6 files changed

+90
-125
lines changed

6 files changed

+90
-125
lines changed

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

Lines changed: 27 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
#
4+
# NOTE: This workflow is overkill for most R packages and
5+
# check-standard.yaml is likely a better choice.
6+
# usethis::use_github_action("check-standard") will install it.
17
on:
28
push:
3-
branches:
4-
- master
9+
branches: [main, master]
510
pull_request:
6-
branches:
7-
- master
11+
branches: [main, master]
812

913
name: R-CMD-check
1014

@@ -18,71 +22,38 @@ jobs:
1822
fail-fast: false
1923
matrix:
2024
config:
21-
- {os: macOS-latest, r: 'devel'}
2225
- {os: macOS-latest, r: 'release'}
26+
2327
- {os: windows-latest, r: 'release'}
24-
- {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
25-
- {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
26-
- {os: ubuntu-16.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
27-
- {os: ubuntu-16.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
28-
- {os: ubuntu-16.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
28+
29+
# Use older ubuntu to maximise backward compatibility
30+
- {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'}
31+
- {os: ubuntu-18.04, r: 'release'}
32+
- {os: ubuntu-18.04, r: 'oldrel-1'}
33+
- {os: ubuntu-18.04, r: 'oldrel-2'}
34+
- {os: ubuntu-18.04, r: 'oldrel-3'}
35+
- {os: ubuntu-18.04, r: 'oldrel-4'}
2936

3037
env:
31-
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
32-
RSPM: ${{ matrix.config.rspm }}
3338
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
39+
R_KEEP_PKG_SOURCE: yes
3440

3541
steps:
3642
- uses: actions/checkout@v2
3743

38-
- uses: r-lib/actions/setup-r@master
44+
- uses: r-lib/actions/setup-pandoc@v1
45+
46+
- uses: r-lib/actions/setup-r@v1
3947
with:
4048
r-version: ${{ matrix.config.r }}
49+
http-user-agent: ${{ matrix.config.http-user-agent }}
50+
use-public-rspm: true
4151

42-
- uses: r-lib/actions/setup-pandoc@master
43-
44-
- name: Query dependencies
45-
run: |
46-
install.packages('remotes')
47-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
48-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
49-
shell: Rscript {0}
50-
51-
- name: Cache R packages
52-
if: runner.os != 'Windows'
53-
uses: actions/cache@v1
52+
- uses: r-lib/actions/setup-r-dependencies@v1
5453
with:
55-
path: ${{ env.R_LIBS_USER }}
56-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
57-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
58-
59-
- name: Install system dependencies
60-
if: runner.os == 'Linux'
61-
env:
62-
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
63-
run: |
64-
Rscript -e "remotes::install_github('r-hub/sysreqs')"
65-
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
66-
sudo -s eval "$sysreqs"
67-
68-
- name: Install dependencies
69-
run: |
70-
remotes::install_deps(dependencies = TRUE)
71-
remotes::install_cran("rcmdcheck")
72-
shell: Rscript {0}
73-
74-
- name: Session info
75-
run: |
76-
options(width = 100)
77-
pkgs <- installed.packages()[, "Package"]
78-
sessioninfo::session_info(pkgs, include_base = TRUE)
79-
shell: Rscript {0}
54+
extra-packages: rcmdcheck
8055

81-
- name: Check
82-
env:
83-
_R_CHECK_CRAN_INCOMING_: false
84-
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
85-
shell: Rscript {0}
56+
- uses: r-lib/actions/check-r-package@v1
8657

8758
- name: Show testthat output
8859
if: always()
@@ -91,7 +62,7 @@ jobs:
9162

9263
- name: Upload check results
9364
if: failure()
94-
uses: actions/upload-artifact@master
65+
uses: actions/upload-artifact@main
9566
with:
9667
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
9768
path: check

.github/workflows/pkgdown.yaml

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,33 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
13
on:
24
push:
3-
branches: master
5+
branches: [main, master]
6+
tags: ['*']
47

58
name: pkgdown
69

710
jobs:
811
pkgdown:
9-
runs-on: macOS-latest
12+
runs-on: ubuntu-latest
1013
env:
1114
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1215
steps:
1316
- uses: actions/checkout@v2
1417

15-
- uses: r-lib/actions/setup-r@master
18+
- uses: r-lib/actions/setup-pandoc@v1
1619

17-
- uses: r-lib/actions/setup-pandoc@master
18-
19-
- name: Query dependencies
20-
run: |
21-
install.packages('remotes')
22-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
23-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
24-
shell: Rscript {0}
25-
26-
- name: Cache R packages
27-
uses: actions/cache@v1
20+
- uses: r-lib/actions/setup-r@v1
2821
with:
29-
path: ${{ env.R_LIBS_USER }}
30-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
31-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
22+
use-public-rspm: true
3223

33-
- name: Install dependencies
34-
run: |
35-
install.packages("remotes")
36-
remotes::install_deps(dependencies = TRUE)
37-
remotes::install_github("tidyverse/tidytemplate")
38-
remotes::install_dev("pkgdown")
39-
shell: Rscript {0}
40-
41-
- name: Install package
42-
run: R CMD INSTALL .
24+
- uses: r-lib/actions/setup-r-dependencies@v1
25+
with:
26+
extra-packages: pkgdown
27+
needs: website
4328

4429
- name: Deploy package
45-
run: pkgdown::deploy_to_branch(new_process = FALSE)
46-
shell: Rscript {0}
30+
run: |
31+
git config --local user.name "$GITHUB_ACTOR"
32+
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
33+
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'

.github/workflows/pr-commands.yaml

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,75 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
13
on:
24
issue_comment:
35
types: [created]
6+
47
name: Commands
8+
59
jobs:
610
document:
711
if: startsWith(github.event.comment.body, '/document')
812
name: document
9-
runs-on: macOS-latest
13+
runs-on: ubuntu-latest
1014
env:
1115
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1216
steps:
1317
- uses: actions/checkout@v2
14-
- uses: r-lib/actions/pr-fetch@master
18+
19+
- uses: r-lib/actions/pr-fetch@v1
1520
with:
1621
repo-token: ${{ secrets.GITHUB_TOKEN }}
17-
- uses: r-lib/actions/setup-r@master
18-
- name: Install dependencies
19-
run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)'
22+
23+
- uses: r-lib/actions/setup-r@v1
24+
with:
25+
use-public-rspm: true
26+
27+
- uses: r-lib/actions/setup-r-dependencies@v1
28+
with:
29+
extra-packages: roxygen2
30+
2031
- name: Document
2132
run: Rscript -e 'roxygen2::roxygenise()'
33+
2234
- name: commit
2335
run: |
36+
git config --local user.name "$GITHUB_ACTOR"
37+
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
2438
git add man/\* NAMESPACE
2539
git commit -m 'Document'
26-
- uses: r-lib/actions/pr-push@master
40+
41+
- uses: r-lib/actions/pr-push@v1
2742
with:
2843
repo-token: ${{ secrets.GITHUB_TOKEN }}
44+
2945
style:
3046
if: startsWith(github.event.comment.body, '/style')
3147
name: style
32-
runs-on: macOS-latest
48+
runs-on: ubuntu-latest
3349
env:
3450
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3551
steps:
3652
- uses: actions/checkout@v2
37-
- uses: r-lib/actions/pr-fetch@master
53+
54+
- uses: r-lib/actions/pr-fetch@v1
3855
with:
3956
repo-token: ${{ secrets.GITHUB_TOKEN }}
40-
- uses: r-lib/actions/setup-r@master
57+
58+
- uses: r-lib/actions/setup-r@v1
59+
4160
- name: Install dependencies
4261
run: Rscript -e 'install.packages("styler")'
62+
4363
- name: Style
4464
run: Rscript -e 'styler::style_pkg()'
65+
4566
- name: commit
4667
run: |
68+
git config --local user.name "$GITHUB_ACTOR"
69+
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
4770
git add \*.R
4871
git commit -m 'Style'
49-
- uses: r-lib/actions/pr-push@master
72+
73+
- uses: r-lib/actions/pr-push@v1
5074
with:
5175
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test-coverage.yaml

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,29 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
13
on:
24
push:
3-
branches:
4-
- master
5+
branches: [main, master]
56
pull_request:
6-
branches:
7-
- master
7+
branches: [main, master]
88

99
name: test-coverage
1010

1111
jobs:
1212
test-coverage:
13-
runs-on: macOS-latest
13+
runs-on: ubuntu-latest
1414
env:
1515
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16+
1617
steps:
1718
- uses: actions/checkout@v2
1819

19-
- uses: r-lib/actions/setup-r@master
20-
21-
- uses: r-lib/actions/setup-pandoc@master
22-
23-
- name: Query dependencies
24-
run: |
25-
install.packages('remotes')
26-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
27-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
28-
shell: Rscript {0}
29-
30-
- name: Cache R packages
31-
uses: actions/cache@v1
20+
- uses: r-lib/actions/setup-r@v1
3221
with:
33-
path: ${{ env.R_LIBS_USER }}
34-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
35-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
22+
use-public-rspm: true
3623

37-
- name: Install dependencies
38-
run: |
39-
install.packages(c("remotes"))
40-
remotes::install_deps(dependencies = TRUE)
41-
remotes::install_cran("covr")
42-
shell: Rscript {0}
24+
- uses: r-lib/actions/setup-r-dependencies@v1
25+
with:
26+
extra-packages: covr
4327

4428
- name: Test coverage
4529
run: covr::codecov()

README.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ knitr::opts_chunk$set(
1717

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

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

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

0 commit comments

Comments
 (0)