-
Notifications
You must be signed in to change notification settings - Fork 1
140 lines (130 loc) · 5.5 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
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
inputs:
ssh_debug:
description: Launch shell for interactive debugging?
type: boolean
required: true
default: false
name: R-CMD-check
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
R-CMD-check-base:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
GIT_CRYPT_KEY64: ${{ secrets.GIT_CRYPT_KEY64 }}
steps:
- uses: actions/checkout@v3
- name: Do a pre-emptive apt-update
run: sudo apt-get update -qq
if: ${{ !env.ACT }}
- name: Decrypt repository using symmetric key
if: ${{ env.GIT_CRYPT_KEY64 }}
run: |
sudo apt-get install -y --no-install-recommends git-crypt
echo $GIT_CRYPT_KEY64 > git_crypt_key.key64 && base64 -di git_crypt_key.key64 > git_crypt_key.key && git-crypt unlock git_crypt_key.key
rm git_crypt_key.key git_crypt_key.key64
# Select all values in .env and print with "::add-mask::" to obfuscate
grep -v '^#' .env | sed -E 's/(.*)=(.*)/\2/' | xargs -I '{}' echo "::add-mask::{}"
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
r-version: release
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::sessioninfo, any::rcmdcheck, any::pkgdepends, any::covr, any::riskmetric, github::ropensci-review-tools/pkgcheck,
needs: check
- name: Run just package tests and record test coverage
run: |
cat("LOGNAME=", Sys.info()[["user"]], "\n", sep = "", file = Sys.getenv("GITHUB_ENV"), append = TRUE)
cat("check-dir-path=", file.path(getwd(), ("check")), "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
coverage <- covr::package_coverage(code = "saveRDS(testthat::capture_output(testthat::test_package('relic', reporter = 'Progress')), file.path('check', 'test_results.rds'))", install_path = "check", clean=FALSE)
saveRDS(coverage, file.path("check", "coverage.rds"))
cat(readRDS(file.path('check', 'test_results.rds')))
shell: Rscript {0}
- name: Run R-CMD-check without tests
run: |
options(crayon.enabled = TRUE)
cat("LOGNAME=", Sys.info()[["user"]], "\n", sep = "", file = Sys.getenv("GITHUB_ENV"), append = TRUE)
if (Sys.getenv("_R_CHECK_FORCE_SUGGESTS_", "") == "") Sys.setenv("_R_CHECK_FORCE_SUGGESTS_" = "false")
if (Sys.getenv("_R_CHECK_CRAN_INCOMING_", "") == "") Sys.setenv("_R_CHECK_CRAN_INCOMING_" = "false")
cat("check-dir-path=", file.path(getwd(), ("check")), "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-tests", "--no-manual"), error_on = "warning", check_dir = ("check"))
shell: Rscript {0}
- name: Print and upload coverage
run: |
library(covr)
coverage <- readRDS(file.path("check", "coverage.rds"))
coverage
covr::codecov(coverage = coverage)
shell: Rscript {0}
continue-on-error: true
- name: Additional diagnostics
run: |
pkc <- pkgcheck::pkgcheck(goodpractice = FALSE)
gp <- goodpractice::goodpractice(checks = goodpractice::all_checks()[grep("(rcmdcheck|covr)", goodpractice::all_checks(), invert = TRUE)])
pkc
gp
shell: Rscript {0}
continue-on-error: true
- name: Launch a temporary interactive debugging session
uses: mxschmitt/[email protected]
if: always() && inputs.ssh_debug
with:
detached: true
# - uses: r-lib/actions/check-r-package@v2
# with:
# upload-snapshots: true
R-CMD-check-grid:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
needs: R-CMD-check-base
strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
#- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v3
- name: Install libgit2 on macOS
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
brew install libgit2
fi
shell: bash
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::sessioninfo, any::rcmdcheck, any::pkgdepends
needs: check
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
- name: Launch a temporary interactive debugging session
uses: mxschmitt/[email protected]
if: always() && inputs.ssh_debug
with:
detached: true