Skip to content

Commit fdd9cfd

Browse files
committed
updated workflow file
1 parent 83008ae commit fdd9cfd

File tree

1 file changed

+33
-58
lines changed

1 file changed

+33
-58
lines changed

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

Lines changed: 33 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,59 @@
1-
# Triggers the workflow on push or pull request events
2-
on: [push, pull_request]
3-
41
name: R-CMD-check
52

3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
concurrency:
11+
group: r-cmd-check-${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
614
jobs:
715
R-CMD-check:
816
runs-on: ${{ matrix.config.os }}
9-
10-
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
17+
name: ${{ matrix.config.os }} (R ${{ matrix.config.r }})
1118

1219
strategy:
1320
fail-fast: false
1421
matrix:
1522
config:
16-
- {os: windows-latest, r: 'release'}
17-
- {os: macOS-latest, r: 'release'}
18-
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
19-
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
23+
- { os: windows-latest, r: 'release' }
24+
- { os: macos-latest, r: 'release' }
25+
- { os: ubuntu-latest, r: 'release' }
26+
- { os: ubuntu-latest, r: 'devel' }
2027

2128
env:
2229
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
23-
RSPM: ${{ matrix.config.rspm }}
2430

2531
steps:
26-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v4
33+
34+
- uses: r-lib/actions/setup-pandoc@v2
2735

28-
- uses: r-lib/actions/setup-r@master
36+
- uses: r-lib/actions/setup-r@v2
2937
with:
3038
r-version: ${{ matrix.config.r }}
39+
use-public-rspm: true
3140

32-
- uses: r-lib/actions/setup-pandoc@master
33-
34-
- name: Query dependencies
35-
run: |
36-
install.packages('remotes')
37-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
38-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
39-
shell: Rscript {0}
40-
41-
- name: Cache R packages
42-
if: runner.os != 'Windows'
43-
uses: actions/cache@v2
41+
# Installs deps + caches them; also handles many Linux system deps automatically.
42+
- uses: r-lib/actions/setup-r-dependencies@v2
4443
with:
45-
path: ${{ env.R_LIBS_USER }}
46-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
47-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
48-
49-
- name: Install system dependencies
50-
if: runner.os == 'Linux'
51-
run: |
52-
while read -r cmd
53-
do
54-
eval sudo $cmd
55-
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
56-
57-
- name: Install curl
58-
if: runner.os == 'Linux'
59-
run: |
60-
sudo apt-get install curl libcurl4-openssl-dev
61-
62-
- name: Install dependencies
63-
run: |
64-
remotes::install_deps(dependencies = TRUE)
65-
remotes::install_cran("rcmdcheck")
66-
remotes::install_cran("covr")
67-
shell: Rscript {0}
68-
69-
- name: Check
70-
env:
71-
_R_CHECK_CRAN_INCOMING_REMOTE_: false
72-
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
73-
shell: Rscript {0}
44+
extra-packages: |
45+
any::rcmdcheck
46+
any::covr
47+
needs: check
7448

75-
- name: Upload check results
76-
if: failure()
77-
uses: actions/upload-artifact@main
49+
- uses: r-lib/actions/check-r-package@v2
7850
with:
79-
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
80-
path: check
51+
args: 'c("--no-manual", "--as-cran")'
52+
error-on: '"warning"'
53+
upload-snapshots: true
8154

55+
# Run coverage once to avoid duplicated uploads from matrix builds
8256
- name: Test coverage
57+
if: runner.os == 'Linux' && matrix.config.r == 'release'
8358
run: covr::codecov()
8459
shell: Rscript {0}

0 commit comments

Comments
 (0)