Skip to content

Commit 79be511

Browse files
[CI] Switch to pak (#4425)
1 parent b46d960 commit 79be511

File tree

4 files changed

+61
-50
lines changed

4 files changed

+61
-50
lines changed

.github/workflows/pkgdown.yaml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,45 @@ name: pkgdown
99

1010
jobs:
1111
pkgdown:
12-
runs-on: macOS-latest
12+
runs-on: ubuntu-18.04
1313
env:
14+
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
1415
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16+
1517
steps:
1618
- uses: actions/checkout@v2
1719

18-
- uses: r-lib/actions/setup-r@master
20+
- uses: r-lib/actions/setup-r@v1
21+
id: install-r
1922

20-
- uses: r-lib/actions/setup-pandoc@master
23+
- uses: r-lib/actions/setup-pandoc@v1
2124

22-
- name: Query dependencies
25+
- name: Install pak and query dependencies
2326
run: |
24-
install.packages('remotes')
25-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
26-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
27+
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
28+
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
2729
shell: Rscript {0}
2830

29-
- name: Cache R packages
30-
uses: actions/cache@v1
31+
- name: Restore R package cache
32+
uses: actions/cache@v2
3133
with:
32-
path: ${{ env.R_LIBS_USER }}
33-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
34-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
34+
path: |
35+
${{ env.R_LIBS_USER }}/*
36+
!${{ env.R_LIBS_USER }}/pak
37+
key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
38+
restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-
39+
40+
- name: Install system dependencies
41+
if: runner.os == 'Linux'
42+
run: |
43+
pak::local_system_requirements(execute = TRUE)
44+
pak::pkg_system_requirements("pkgdown", execute = TRUE)
45+
shell: Rscript {0}
3546

3647
- name: Install dependencies
3748
run: |
38-
remotes::install_deps(dependencies = TRUE, type = "binary")
39-
remotes::install_github("tidyverse/tidytemplate", type = "binary")
40-
remotes::install_dev("pkgdown", type = "binary")
49+
pak::local_install_dev_deps(upgrade = TRUE, dependencies = c("all", "Config/Needs/website"))
50+
pak::pkg_install("pkgdown")
4151
shell: Rscript {0}
4252

4353
- name: Install package

.github/workflows/pr-commands.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ jobs:
1111
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1212
steps:
1313
- uses: actions/checkout@v2
14-
- uses: r-lib/actions/pr-fetch@master
14+
- uses: r-lib/actions/pr-fetch@v1
1515
with:
1616
repo-token: ${{ secrets.GITHUB_TOKEN }}
17-
- uses: r-lib/actions/setup-r@master
17+
- uses: r-lib/actions/setup-r@v1
1818
- name: Install dependencies
19-
run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE, type = "binary")'
19+
run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)'
2020
- name: Document
2121
run: Rscript -e 'roxygen2::roxygenise()'
2222
- name: commit
@@ -25,7 +25,7 @@ jobs:
2525
git config --local user.name "GitHub Actions"
2626
git add man/\* NAMESPACE
2727
git commit -m 'Document'
28-
- uses: r-lib/actions/pr-push@master
28+
- uses: r-lib/actions/pr-push@v1
2929
with:
3030
repo-token: ${{ secrets.GITHUB_TOKEN }}
3131
style:
@@ -36,10 +36,10 @@ jobs:
3636
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3737
steps:
3838
- uses: actions/checkout@v2
39-
- uses: r-lib/actions/pr-fetch@master
39+
- uses: r-lib/actions/pr-fetch@v1
4040
with:
4141
repo-token: ${{ secrets.GITHUB_TOKEN }}
42-
- uses: r-lib/actions/setup-r@master
42+
- uses: r-lib/actions/setup-r@v1
4343
- name: Install dependencies
4444
run: Rscript -e 'install.packages("styler")'
4545
- name: Style
@@ -50,6 +50,6 @@ jobs:
5050
git config --local user.name "GitHub Actions"
5151
git add \*.R
5252
git commit -m 'Style'
53-
- uses: r-lib/actions/pr-push@master
53+
- uses: r-lib/actions/pr-push@v1
5454
with:
5555
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test-coverage.yaml

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,48 @@ name: test-coverage
1111
# Increment this version when we want to clear cache
1212
env:
1313
cache-version: v1
14-
r-version: 4.0
1514

1615
jobs:
1716
test-coverage:
18-
runs-on: macOS-latest
17+
runs-on: ubuntu-18.04
18+
env:
19+
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
20+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
21+
1922
steps:
2023
- uses: actions/checkout@v2
21-
with:
22-
r-version: ${{ env.r-version }}
23-
24-
- uses: r-lib/actions/setup-r@master
2524

26-
- uses: r-lib/actions/setup-pandoc@master
25+
- uses: r-lib/actions/setup-r@v1
26+
id: install-r
2727

28-
- name: Query dependencies
28+
- name: Install pak and query dependencies
2929
run: |
30-
install.packages('remotes')
31-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
30+
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
31+
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
3232
shell: Rscript {0}
3333

34-
- name: Cache R packages
35-
uses: actions/cache@v1
34+
- name: Restore R package cache
35+
uses: actions/cache@v2
3636
with:
37-
path: ${{ env.R_LIBS_USER }}
38-
key: ${{ env.cache-version }}-macOS-r-${{ env.r-version }}-${{ hashFiles('.github/depends.Rds') }}
39-
restore-keys: ${{ env.cache-version }}-macOS-r-${{ env.r-version }}-
40-
41-
- name: Install system dependencies on macOS
37+
path: |
38+
${{ env.R_LIBS_USER }}/*
39+
!${{ env.R_LIBS_USER }}/pak
40+
key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-${{ env.cache-version }}-${{ hashFiles('.github/r-depends.rds') }}
41+
restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-${{ env.cache-version }}-
42+
43+
- name: Install system dependencies
44+
if: runner.os == 'Linux'
4245
run: |
43-
# XQuartz is needed by vdiffr
44-
brew install xquartz
46+
pak::local_system_requirements(execute = TRUE)
47+
pak::pkg_system_requirements("covr", execute = TRUE)
48+
shell: Rscript {0}
4549

4650
- name: Install dependencies
4751
run: |
48-
install.packages(c("remotes"))
49-
remotes::install_deps(dependencies = TRUE, type = "binary")
50-
remotes::install_cran("covr")
52+
pak::local_install_dev_deps(upgrade = TRUE)
53+
pak::pkg_install("covr")
5154
shell: Rscript {0}
5255

53-
# TODO: Remove remotes::install_github() after covr > 3.5.0 is released
54-
# c.f. https://github.com/r-lib/covr/commit/cc710804aeff6f337777465bf902914197c0b713
5556
- name: Test coverage
56-
run: |
57-
remotes::install_github("r-lib/covr")
58-
covr::codecov()
57+
run: covr::codecov()
5958
shell: Rscript {0}

DESCRIPTION

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,4 +272,6 @@ Encoding: UTF-8
272272
Config/Needs/website:
273273
ggtext,
274274
tidyr,
275-
forcats
275+
forcats,
276+
tidyverse/tidytemplate
277+

0 commit comments

Comments
 (0)