Skip to content

Commit 4069c0d

Browse files
authored
Update GitHub Actions (#2381)
1 parent 7806a28 commit 4069c0d

4 files changed

Lines changed: 75 additions & 149 deletions

File tree

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

Lines changed: 26 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
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.
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
43
#
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
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.
77
on:
88
push:
9-
branches:
10-
- main
11-
- master
9+
branches: [main, master]
1210
pull_request:
13-
branches:
14-
- main
15-
- master
11+
branches: [main, master]
1612

1713
name: R-CMD-check
1814

@@ -27,72 +23,39 @@ jobs:
2723
matrix:
2824
config:
2925
- {os: macOS-latest, r: 'release'}
26+
3027
- {os: windows-latest, r: 'release'}
31-
- {os: windows-latest, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/latest"}
32-
- {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
33-
- {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
34-
- {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
35-
- {os: ubuntu-18.04, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
36-
- {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
37-
- {os: ubuntu-18.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
28+
# Use 3.6 to trigger usage of RTools35
29+
- {os: windows-latest, r: '3.6'}
30+
31+
# Use older ubuntu to maximise backward compatibility
32+
- {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'}
33+
- {os: ubuntu-18.04, r: 'release'}
34+
- {os: ubuntu-18.04, r: 'oldrel-1'}
35+
- {os: ubuntu-18.04, r: 'oldrel-2'}
36+
- {os: ubuntu-18.04, r: 'oldrel-3'}
37+
- {os: ubuntu-18.04, r: 'oldrel-4'}
3838

3939
env:
40-
RSPM: ${{ matrix.config.rspm }}
4140
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
41+
R_KEEP_PKG_SOURCE: yes
4242

4343
steps:
4444
- uses: actions/checkout@v2
4545

46+
- uses: r-lib/actions/setup-pandoc@v1
47+
4648
- uses: r-lib/actions/setup-r@v1
47-
id: install-r
4849
with:
4950
r-version: ${{ matrix.config.r }}
5051
http-user-agent: ${{ matrix.config.http-user-agent }}
52+
use-public-rspm: true
5153

52-
- uses: r-lib/actions/setup-pandoc@v1
53-
54-
- name: Install pak and query dependencies
55-
run: |
56-
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
57-
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
58-
shell: Rscript {0}
59-
60-
- name: Restore R package cache
61-
uses: actions/cache@v2
54+
- uses: r-lib/actions/setup-r-dependencies@v1
6255
with:
63-
path: |
64-
${{ env.R_LIBS_USER }}/*
65-
!${{ env.R_LIBS_USER }}/pak
66-
key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
67-
restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
68-
69-
- name: Install system dependencies
70-
if: runner.os == 'Linux'
71-
run: |
72-
pak::local_system_requirements(execute = TRUE)
73-
pak::pkg_system_requirements("rcmdcheck", execute = TRUE)
74-
shell: Rscript {0}
75-
76-
- name: Install dependencies
77-
run: |
78-
pak::local_install_dev_deps(upgrade = TRUE)
79-
pak::pkg_install("rcmdcheck")
80-
shell: Rscript {0}
56+
extra-packages: rcmdcheck
8157

82-
- name: Session info
83-
run: |
84-
options(width = 100)
85-
pkgs <- installed.packages()[, "Package"]
86-
sessioninfo::session_info(pkgs, include_base = TRUE)
87-
shell: Rscript {0}
88-
89-
- name: Check
90-
env:
91-
_R_CHECK_CRAN_INCOMING_: false
92-
run: |
93-
options(crayon.enabled = TRUE)
94-
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
95-
shell: Rscript {0}
58+
- uses: r-lib/actions/check-r-package@v1
9659

9760
- name: Show testthat output
9861
if: always()
@@ -103,10 +66,5 @@ jobs:
10366
if: failure()
10467
uses: actions/upload-artifact@main
10568
with:
106-
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results
69+
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
10770
path: check
108-
109-
- name: Don't use tar from old Rtools to store the cache
110-
if: ${{ runner.os == 'Windows' && startsWith(steps.install-r.outputs.installed-r-version, '3.6' ) }}
111-
shell: bash
112-
run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH

.github/workflows/pkgdown.yaml

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,32 @@
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-
- main
5-
- master
5+
branches: [main, master]
6+
tags: ['*']
67

78
name: pkgdown
89

910
jobs:
1011
pkgdown:
11-
runs-on: ubuntu-18.04
12+
runs-on: ubuntu-latest
1213
env:
13-
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
1414
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
15-
1615
steps:
1716
- uses: actions/checkout@v2
1817

19-
- uses: r-lib/actions/setup-r@v1
20-
id: install-r
21-
2218
- uses: r-lib/actions/setup-pandoc@v1
2319

24-
- name: Install pak and query dependencies
25-
run: |
26-
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
27-
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
28-
shell: Rscript {0}
29-
30-
- name: Restore R package cache
31-
uses: actions/cache@v2
20+
- uses: r-lib/actions/setup-r@v1
3221
with:
33-
path: |
34-
${{ env.R_LIBS_USER }}/*
35-
!${{ env.R_LIBS_USER }}/pak
36-
key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
37-
restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-
22+
use-public-rspm: true
3823

39-
- name: Install system dependencies
40-
if: runner.os == 'Linux'
41-
run: |
42-
pak::local_system_requirements(execute = TRUE)
43-
pak::pkg_system_requirements("pkgdown", execute = TRUE)
44-
shell: Rscript {0}
45-
46-
- name: Install dependencies
47-
run: |
48-
pak::local_install_dev_deps(upgrade = TRUE, dependencies = c("all", "Config/Needs/website"))
49-
pak::pkg_install("pkgdown")
50-
shell: Rscript {0}
51-
52-
- name: Install package
53-
run: R CMD INSTALL .
24+
- uses: r-lib/actions/setup-r-dependencies@v1
25+
with:
26+
extra-packages: pkgdown
27+
needs: website
5428

55-
- name: Build and deploy pkgdown site
29+
- name: Deploy package
5630
run: |
5731
git config --local user.name "$GITHUB_ACTOR"
5832
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"

.github/workflows/pr-commands.yaml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +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
18+
1419
- uses: r-lib/actions/pr-fetch@v1
1520
with:
1621
repo-token: ${{ secrets.GITHUB_TOKEN }}
22+
1723
- uses: r-lib/actions/setup-r@v1
18-
- name: Install dependencies
19-
run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)'
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: |
24-
git config --local user.email "actions@github.com"
25-
git config --local user.name "GitHub Actions"
36+
git config --local user.name "$GITHUB_ACTOR"
37+
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
2638
git add man/\* NAMESPACE
2739
git commit -m 'Document'
40+
2841
- uses: r-lib/actions/pr-push@v1
2942
with:
3043
repo-token: ${{ secrets.GITHUB_TOKEN }}
44+
3145
style:
3246
if: startsWith(github.event.comment.body, '/style')
3347
name: style
34-
runs-on: macOS-latest
48+
runs-on: ubuntu-latest
3549
env:
3650
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3751
steps:
3852
- uses: actions/checkout@v2
53+
3954
- uses: r-lib/actions/pr-fetch@v1
4055
with:
4156
repo-token: ${{ secrets.GITHUB_TOKEN }}
57+
4258
- uses: r-lib/actions/setup-r@v1
59+
4360
- name: Install dependencies
4461
run: Rscript -e 'install.packages("styler")'
62+
4563
- name: Style
4664
run: Rscript -e 'styler::style_pkg()'
65+
4766
- name: commit
4867
run: |
49-
git config --local user.email "actions@github.com"
50-
git config --local user.name "GitHub Actions"
68+
git config --local user.name "$GITHUB_ACTOR"
69+
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
5170
git add \*.R
5271
git commit -m 'Style'
72+
5373
- uses: r-lib/actions/pr-push@v1
5474
with:
5575
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test-coverage.yaml

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +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-
- main
5-
- master
5+
branches: [main, master]
66
pull_request:
7-
branches:
8-
- main
9-
- master
7+
branches: [main, master]
108

119
name: test-coverage
1210

1311
jobs:
1412
test-coverage:
15-
runs-on: ubuntu-18.04
13+
runs-on: ubuntu-latest
1614
env:
17-
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
1815
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1916

2017
steps:
2118
- uses: actions/checkout@v2
2219

2320
- uses: r-lib/actions/setup-r@v1
24-
id: install-r
25-
26-
- name: Install pak and query dependencies
27-
run: |
28-
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
29-
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
30-
shell: Rscript {0}
31-
32-
- name: Restore R package cache
33-
uses: actions/cache@v2
3421
with:
35-
path: |
36-
${{ env.R_LIBS_USER }}/*
37-
!${{ env.R_LIBS_USER }}/pak
38-
key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
39-
restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-
22+
use-public-rspm: true
4023

41-
- name: Install system dependencies
42-
if: runner.os == 'Linux'
43-
run: |
44-
pak::local_system_requirements(execute = TRUE)
45-
pak::pkg_system_requirements("covr", execute = TRUE)
46-
shell: Rscript {0}
47-
48-
- name: Install dependencies
49-
run: |
50-
pak::local_install_dev_deps(upgrade = TRUE)
51-
pak::pkg_install("covr")
52-
shell: Rscript {0}
24+
- uses: r-lib/actions/setup-r-dependencies@v1
25+
with:
26+
extra-packages: covr
5327

5428
- name: Test coverage
5529
run: covr::codecov()

0 commit comments

Comments
 (0)