Skip to content

Commit 66fb1d0

Browse files
jimhesterjennybc
andauthored
Use the pak based actions for tidy github actions (#1346)
* Use the pak based actions for tidy github actions * Update usethis workflows * Re-arrange username and user-email * Set the R-devel CI user agent to R 4.0 Because we want RSPM to serve the R 4.0 binaries for R-devel. * Whitespace Co-authored-by: Jenny Bryan <[email protected]>
1 parent d1aec93 commit 66fb1d0

File tree

4 files changed

+49
-41
lines changed

4 files changed

+49
-41
lines changed

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,16 @@ jobs:
2929
- {os: macOS-latest, r: 'release'}
3030
- {os: windows-latest, r: 'release'}
3131
- {os: windows-latest, r: '3.6'}
32-
- {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/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-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
3334
- {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
3435
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
3536
- {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
3637
- {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
3738
- {os: ubuntu-18.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
3839
- {os: ubuntu-18.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
39-
- {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
4040

4141
env:
42-
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
4342
RSPM: ${{ matrix.config.rspm }}
4443
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
4544

@@ -57,19 +56,22 @@ jobs:
5756
- name: Install pak and query dependencies
5857
run: |
5958
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
60-
saveRDS(pak::pkg_deps_tree("local::.", dependencies = TRUE), ".github/r-depends.rds")
59+
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
6160
shell: Rscript {0}
6261

6362
- name: Cache R packages
6463
uses: actions/cache@v2
6564
with:
6665
path: ${{ env.R_LIBS_USER }}
67-
key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-2-${{ hashFiles('.github/r-depends.rds') }}
68-
restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-2-
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-
6968

70-
- name: Install linux system dependencies
69+
- name: Install system dependencies
7170
if: runner.os == 'Linux'
72-
run: Rscript -e 'pak::local_system_requirements(execute = TRUE)'
71+
run: |
72+
pak::local_system_requirements(execute = TRUE)
73+
pak::pkg_system_requirements("rcmdcheck", execute = TRUE)
74+
shell: Rscript {0}
7375

7476
- name: Install macOS system dependencies
7577
if: runner.os == 'macOS'
@@ -99,7 +101,9 @@ jobs:
99101
env:
100102
_R_CHECK_CRAN_INCOMING_: false
101103
_R_CHECK_FORCE_SUGGESTS_: ${{ matrix.config.r != '3.3' }}
102-
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
104+
run: |
105+
options(crayon.enabled = TRUE)
106+
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
103107
shell: Rscript {0}
104108

105109
- name: Show testthat output

.github/workflows/pkgdown.yaml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,49 @@ name: pkgdown
88

99
jobs:
1010
pkgdown:
11-
runs-on: macOS-latest
11+
runs-on: ubuntu-18.04
1212
env:
13+
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
1314
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
15+
1416
steps:
1517
- uses: actions/checkout@v2
1618

1719
- uses: r-lib/actions/setup-r@v1
20+
id: install-r
1821

1922
- uses: r-lib/actions/setup-pandoc@v1
2023

21-
- name: Query dependencies
24+
- name: Install pak and query dependencies
2225
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+
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
27+
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
2628
shell: Rscript {0}
2729

2830
- name: Cache R packages
2931
uses: actions/cache@v2
3032
with:
3133
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+
key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
35+
restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-
3436

35-
- name: Install macOS system dependencies
36-
if: runner.os == 'macOS'
37+
- name: Install system dependencies
38+
if: runner.os == 'Linux'
3739
run: |
38-
brew install libgit2
39-
brew install imagemagick@6
40+
pak::local_system_requirements(execute = TRUE)
41+
pak::pkg_system_requirements("pkgdown", execute = TRUE)
42+
shell: Rscript {0}
4043

4144
- name: Install dependencies
4245
run: |
43-
remotes::install_deps(dependencies = TRUE)
44-
install.packages("pkgdown", type = "binary")
46+
pak::local_install_dev_deps(upgrade = TRUE)
47+
pak::pkg_install("pkgdown")
4548
shell: Rscript {0}
4649

4750
- name: Install package
4851
run: R CMD INSTALL .
4952

50-
- name: Deploy package
53+
- name: Build and deploy pkgdown site
5154
run: |
5255
git config --local user.name "$GITHUB_ACTOR"
5356
git config --local user.email "[email protected]"

.github/workflows/test-coverage.yaml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,41 @@ name: test-coverage
1212

1313
jobs:
1414
test-coverage:
15-
runs-on: macOS-latest
15+
runs-on: ubuntu-18.04
1616
env:
17+
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
1718
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
19+
1820
steps:
1921
- uses: actions/checkout@v2
2022

2123
- uses: r-lib/actions/setup-r@v1
24+
id: install-r
2225

23-
- uses: r-lib/actions/setup-pandoc@v1
24-
25-
- name: Query dependencies
26+
- name: Install pak and query dependencies
2627
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")
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")
3030
shell: Rscript {0}
3131

3232
- name: Cache R packages
3333
uses: actions/cache@v2
3434
with:
3535
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-
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-
3838

39-
- name: Install macOS system dependencies
40-
if: runner.os == 'macOS'
39+
- name: Install system dependencies
40+
if: runner.os == 'Linux'
4141
run: |
42-
brew install libgit2
43-
brew install imagemagick@6
42+
pak::local_system_requirements(execute = TRUE)
43+
pak::pkg_system_requirements("covr", execute = TRUE)
44+
shell: Rscript {0}
4445

4546
- name: Install dependencies
4647
run: |
47-
remotes::install_deps(dependencies = TRUE)
48-
remotes::install_cran("covr")
48+
pak::local_install_dev_deps(upgrade = TRUE)
49+
pak::pkg_install("covr")
4950
shell: Rscript {0}
5051

5152
- name: Configure Git user

R/github-actions.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ use_tidy_github_actions <- function() {
8787

8888
full_status <- use_github_action_check_full(repo_spec = repo_spec)
8989
pr_status <- use_github_action_pr_commands()
90-
pkgdown_status <- use_github_action("pkgdown")
91-
test_coverage_status <- use_github_action("test-coverage")
90+
pkgdown_status <- use_github_action("pkgdown-pak", save_as = "pkgdown.yaml")
91+
test_coverage_status <- use_github_action("test-coverage-pak", save_as = "test-coverage.yaml")
9292

9393
old_configs <- proj_path(c(".travis.yml", "appveyor.yml"))
9494
has_appveyor_travis <- file_exists(old_configs)
@@ -227,7 +227,7 @@ use_github_action_check_full <- function(save_as = "R-CMD-check.yaml",
227227
# this must have `repo_spec` as an argument because it is called as part of
228228
# use_tidy_github_actions()
229229
use_github_action(
230-
"check-full.yaml",
230+
"check-pak.yaml",
231231
save_as = save_as,
232232
ignore = ignore,
233233
open = open

0 commit comments

Comments
 (0)