Skip to content

Commit 24f2db9

Browse files
committed
Add GitHub Actions to test the package on different OSes.
1 parent 267552d commit 24f2db9

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
branches:
7+
- master
8+
9+
name: R-CMD-check
10+
11+
jobs:
12+
R-CMD-check:
13+
runs-on: ${{ matrix.config.os }}
14+
15+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
config:
21+
- {os: macOS-latest, r: 'devel'}
22+
- {os: macOS-latest, r: 'release'}
23+
- {os: windows-latest, r: 'release'}
24+
- {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
25+
26+
env:
27+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
28+
RSPM: ${{ matrix.config.rspm }}
29+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
30+
ORCID_TOKEN: ${{ secrets.ORCID_TOKEN }}
31+
32+
steps:
33+
- uses: actions/checkout@v2
34+
35+
- uses: r-lib/actions/setup-r@master
36+
with:
37+
r-version: ${{ matrix.config.r }}
38+
39+
- uses: r-lib/actions/setup-pandoc@master
40+
41+
- name: Query dependencies
42+
run: |
43+
install.packages('remotes')
44+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
45+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
46+
shell: Rscript {0}
47+
48+
- name: Cache R packages
49+
if: runner.os != 'Windows'
50+
uses: actions/cache@v1
51+
with:
52+
path: ${{ env.R_LIBS_USER }}
53+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
54+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
55+
56+
- name: Install system dependencies
57+
if: runner.os == 'Linux'
58+
env:
59+
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
60+
run: |
61+
Rscript -e "remotes::install_github('r-hub/sysreqs')"
62+
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
63+
sudo -s eval "$sysreqs"
64+
- name: Install dependencies
65+
run: |
66+
remotes::install_deps(dependencies = TRUE)
67+
remotes::install_cran("rcmdcheck")
68+
shell: Rscript {0}
69+
70+
- name: Session info
71+
run: |
72+
options(width = 100)
73+
pkgs <- installed.packages()[, "Package"]
74+
sessioninfo::session_info(pkgs, include_base = TRUE)
75+
shell: Rscript {0}
76+
77+
- name: Check
78+
env:
79+
_R_CHECK_CRAN_INCOMING_: false
80+
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
81+
shell: Rscript {0}
82+
83+
- name: Show testthat output
84+
if: always()
85+
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
86+
shell: bash
87+
88+
- name: Upload check results
89+
if: failure()
90+
uses: actions/upload-artifact@master
91+
with:
92+
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
93+
path: check

0 commit comments

Comments
 (0)