Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 693a2f3

Browse files
committed
update workflow
1 parent a1747f8 commit 693a2f3

File tree

1 file changed

+46
-36
lines changed

1 file changed

+46
-36
lines changed

.github/workflows/check-covr.yml

+46-36
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ on:
44
schedule:
55
- cron: "0 4 * * *"
66

7-
name: R-CMD-check / codecov
7+
name: R-CMD-check
88

99
jobs:
10-
check-covr:
10+
R-CMD-check:
1111
runs-on: ${{ matrix.config.os }}
1212

1313
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
@@ -17,79 +17,89 @@ jobs:
1717
matrix:
1818
config:
1919
- {os: windows-latest, r: 'release'}
20-
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
2120
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
22-
- {os: ubuntu-20.04, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
21+
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
22+
- {os: ubuntu-20.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
2323

2424
env:
2525
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
2626
RSPM: ${{ matrix.config.rspm }}
27+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
2728

2829
steps:
2930
- uses: actions/checkout@v2
3031

31-
- uses: r-lib/actions/setup-r@master
32+
- uses: r-lib/actions/setup-r@v1
33+
id: install-r
3234
with:
3335
r-version: ${{ matrix.config.r }}
36+
http-user-agent: ${{ matrix.config.http-user-agent }}
3437

35-
- uses: r-lib/actions/setup-pandoc@master
38+
- uses: r-lib/actions/setup-pandoc@v1
3639

37-
- name: Query dependencies
40+
- name: Install pak and query dependencies
3841
run: |
39-
install.packages('remotes')
40-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
41-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
42+
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
43+
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
4244
shell: Rscript {0}
4345

44-
- name: Cache R packages
45-
if: runner.os != 'Windows'
46-
uses: actions/cache@v1
46+
- name: Restore R package cache
47+
uses: actions/cache@v2
4748
with:
48-
path: ${{ env.R_LIBS_USER }}
49-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
50-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
49+
path: |
50+
${{ env.R_LIBS_USER }}/*
51+
!${{ env.R_LIBS_USER }}/pak
52+
key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
53+
restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
5154

5255
- name: Install system dependencies
5356
if: runner.os == 'Linux'
5457
run: |
55-
set -x
56-
while read -r cmd
57-
do
58-
eval sudo $cmd
59-
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20.04"), sep = "\n")')
58+
pak::local_system_requirements(execute = TRUE)
59+
pak::pkg_system_requirements("rcmdcheck", execute = TRUE)
60+
shell: Rscript {0}
6061

6162
- name: Install dependencies
6263
run: |
63-
install.packages("remotes")
64-
remotes::install_deps(dependencies = TRUE)
65-
remotes::install_cran("rcmdcheck")
64+
pak::local_install_dev_deps(upgrade = TRUE)
65+
pak::pkg_install("rcmdcheck")
6666
shell: Rscript {0}
6767

68-
- name: Install self
69-
if: runner.os == 'Windows'
68+
- name: Session info
7069
run: |
71-
install.packages(".", repos = NULL, type = "source")
70+
options(width = 100)
71+
pkgs <- installed.packages()[, "Package"]
72+
sessioninfo::session_info(pkgs, include_base = TRUE)
7273
shell: Rscript {0}
7374

7475
- name: Check
7576
env:
76-
_R_CHECK_CRAN_INCOMING_REMOTE_: false
77-
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
77+
_R_CHECK_CRAN_INCOMING_: false
78+
run: |
79+
options(crayon.enabled = TRUE)
80+
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
7881
shell: Rscript {0}
7982

83+
- name: Show testthat output
84+
if: always()
85+
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
86+
shell: bash
87+
8088
- name: Upload check results
8189
if: failure()
8290
uses: actions/upload-artifact@main
8391
with:
84-
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
92+
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results
8593
path: check
8694

87-
- name: Install covr
88-
if: ${{ github.event_name == 'pull_request' && runner.os == 'Linux' && matrix.config.r == 'release'}}
89-
run: install.packages('covr')
90-
shell: Rscript {0}
95+
- name: Don't use tar from old Rtools to store the cache
96+
if: ${{ runner.os == 'Windows' && startsWith(steps.install-r.outputs.installed-r-version, '3.6' ) }}
97+
shell: bash
98+
run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH
9199

92100
- name: Test coverage
93-
if: ${{ github.event_name == 'pull_request' && runner.os == 'Linux' && matrix.config.r == 'release'}}
94-
run: covr::codecov()
101+
if: ${{ runner.os == 'Linux' && matrix.config.r == 'release'}}
102+
run: |
103+
install.packages('covr')
104+
covr::codecov()
95105
shell: Rscript {0}

0 commit comments

Comments
 (0)