-
-
Notifications
You must be signed in to change notification settings - Fork 48
113 lines (100 loc) · 4.24 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
# 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
pull_request:
branches:
- main
name: R-CMD-check
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }}, ${{ matrix.config.installation_method }})
strategy:
fail-fast: false
matrix:
config:
# macOS
- {os: macOS-latest, r: 'release', installation_method: 'brew'}
- {os: macOS-latest, r: 'release', installation_method: 'conda'}
- {os: macOS-latest, r: 'release', installation_method: 'pip'}
# Windows
- {os: windows-latest, r: 'release', installation_method: 'pip'}
- {os: windows-latest, r: 'release', installation_method: 'conda'}
- {os: windows-latest, r: 'devel', installation_method: 'conda'}
# Linux
- {os: ubuntu-latest, r: 'release', installation_method: 'pip', use-public-rspm: true}
- {os: ubuntu-latest, r: 'release', installation_method: 'conda', use-public-rspm: true}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
PRECOMMIT_INSTALLATION_METHOD: ${{ matrix.config.installation_method }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
- uses: r-lib/actions/setup-pandoc@v2
- name: Install system dependencies (brew)
if: matrix.config.installation_method == 'brew'
run: brew install pre-commit
- name: Install system dependencies (pip, non-macOS)
if: matrix.config.installation_method == 'pip' && matrix.config.os != 'macOS-latest'
run: |
pip3 install pre-commit --user
- name: Install system dependencies (pip, macOS)
if: matrix.config.installation_method == 'pip' && matrix.config.os == 'macOS-latest'
run: |
pip3 install pre-commit --user --break-system-packages
- uses: r-lib/actions/setup-r-dependencies@v2
- name: Remove reticulate for other installation methods
run: |
# installation methods other than conda don't need reticulate
if (Sys.getenv("PRECOMMIT_INSTALLATION_METHOD") != 'conda') {
remove.packages('reticulate')
}
shell: Rscript {0}
- name: Install system dependencies (conda)
if: matrix.config.installation_method == 'conda'
run: |
reticulate::install_miniconda()
shell: Rscript {0}
- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
- name: Check
env:
_R_CHECK_CRAN_INCOMING_: false
run: |
options(crayon.enabled = TRUE)
if (Sys.getenv("PRECOMMIT_INSTALLATION_METHOD") != 'conda') {
Sys.setenv("_R_CHECK_FORCE_SUGGESTS_" = "False")
}
remotes::install_local() # circumvent https://github.com/r-lib/rcmdcheck/issues/136
install.packages("rcmdcheck")
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
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: ${{ runner.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