-
Notifications
You must be signed in to change notification settings - Fork 133
161 lines (135 loc) · 5.83 KB
/
R-CMD-check.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# NOTE: This workflow is overkill for most R packages
# check-standard.yaml is likely a better choice
# usethis::use_github_action("check-standard") will install it.
#
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
push:
branches:
- main
- devel
pull_request:
branches:
- main
- devel
name: R-CMD-check
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", http-user-agent: "R/4.1.0 (ubuntu-20.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
env:
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v2
id: install-r
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-tinytex@v2
- run: tlmgr --version
- run: tlmgr install apa6 threeparttable caption fancyhdr endfloat was multirow threeparttablex environ trimspaces lineno csquotes babel-english grfext
- name: Install Ghostscript on Linux
if: runner.os == 'Linux'
run: sudo DEBIAN_FRONTEND=noninteractive apt-get install --yes ghostscript
- name: Install Ghostscript on macOS
if: runner.os == 'macOS'
run: brew install ghostscript
- name: Install Ghostscript on Windows
if: runner.os == 'Windows'
run: choco install ghostscript --no-progress
- name: Install pak and query dependencies
run: |
cat("::group::Install pak\n")
options(pak.no_extra_messages = TRUE)
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
deps <- pak::pkg_deps(
"local::."
, dependencies = list(
direct = c("Depends", "Imports", "LinkingTo", "Suggests")
, indirect = c("Depends", "Imports", "LinkingTo")
)
)
saveRDS(deps, ".github/r-depends.rds")
shell: Rscript {0}
- name: Get R and OS version
id: get-version
run: |
cat("::set-output name=os-version::", sessionInfo()$running, "\n", sep = "")
cat("::set-output name=r-version::", R.Version()$version.string, "\n", sep = "")
cat("::endgroup::\n")
shell: Rscript {0}
- name: Restore R package cache
uses: actions/cache@v2
with:
path: |
${{ env.R_LIBS_USER }}/*
!${{ env.R_LIBS_USER }}/pak
key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{inputs.cache-version }}-${{ hashFiles('.github/r-depends.rds') }}
restore-keys: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{inputs.cache-version }}-
- name: Install dependencies
run: |
cat("::group::Install dependencies\n")
options(pak.no_extra_messages = TRUE)
local_deps <- pak::local_dev_deps(dependencies = TRUE)[["ref"]]
needs <- sprintf("Config/Needs/%s", strsplit("${{ inputs.needs }}", "[[:space:],]+")[[1]])
needs_deps <- pak::local_dev_deps(dependencies = needs)[["ref"]]
needs_only_deps <- setdiff(needs_deps, local_deps)
extra_deps <- c("rcmdcheck", "covr")
if (Sys.info()[["sysname"]] == "Linux") {
pak::local_system_requirements(execute = TRUE)
for (dep in c(needs_only_deps, extra_deps)) {
pak::pkg_system_requirements(dep, execute = TRUE)
}
}
pak::pkg_install(c(local_deps, needs_only_deps, extra_deps, "sessioninfo"))
cat("::endgroup::\n")
shell: Rscript {0}
- name: Session info
run: |
cat("::group::Session info\n")
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
cat("::endgroup::\n")
shell: Rscript {0}
- name: Don't use tar 1.30 from Rtools35 to store the cache
shell: bash
run: |
if command -v /c/Rtools/bin/tar && /c/Rtools/bin/tar --version | grep -q 'tar (GNU tar) 1.30'
then echo 'C:/Program Files/Git/usr/bin' >> $GITHUB_PATH
fi
- uses: r-lib/actions/check-r-package@v2
with:
build_args: '"--compact-vignettes=both"'
- name: Code Coverage
env:
_R_CHECK_CRAN_INCOMING_: false
run: covr::codecov()
shell: Rscript {0}
- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results
path: check
- name: Don't use tar from old Rtools to store the cache
if: ${{ runner.os == 'Windows' && startsWith(steps.install-r.outputs.installed-r-version, '3.6' ) }}
shell: bash
run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH