-
Notifications
You must be signed in to change notification settings - Fork 218
/
action.yaml
66 lines (62 loc) · 2.76 KB
/
action.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
name: 'check-r-package'
description: 'Action to check R package with rcmdcheck. Assumes that rcmdcheck has already been installed.'
author: 'Jim Hester'
inputs:
args:
description: 'Arguments to pass to the `args` parameter of rcmdcheck. An R expression in single quotes.'
default: 'c("--no-manual", "--as-cran")'
build_args:
description: 'Arguments to pass to the `build_args` parameter of rcmdcheck. An R expression in single quotes.'
default: '"--no-manual"'
error-on:
description: 'What type of result should cause a build error? An R expression in single quotes.'
default: '"warning"'
check-dir:
description: 'Where should the check output go? An R expression in single quotes.'
default: '"check"'
working-directory:
description: 'Using the working-directory keyword, you can specify the working directory of where "rcmdcheck::rcmdcheck" is run.'
default: '.'
upload-snapshots:
description: 'Whether to upload all testthat snapshots as an artifact.'
default: false
upload-results:
description: 'Whether to upload check results for successful runs too.'
default: false
runs:
using: "composite"
steps:
- name: Check
id: rcmdcheck
env:
_R_CHECK_CRAN_INCOMING_: false
run: |
## --------------------------------------------------------------------
options(crayon.enabled = TRUE)
if (Sys.getenv("_R_CHECK_FORCE_SUGGESTS_", "") == "") Sys.setenv("_R_CHECK_FORCE_SUGGESTS_" = "false")
cat("##[set-output name=check-dir-path;]", (${{ inputs.check-dir }}), "\n", sep = "")
check_results <- rcmdcheck::rcmdcheck(args = (${{ inputs.args }}), build_args = (${{ inputs.build_args }}), error_on = (${{ inputs.error-on }}), check_dir = (${{ inputs.check-dir }}))
shell: Rscript {0}
working-directory: ${{ inputs.working-directory }}
- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
echo ::group::Show testthat output
find check -name 'testthat.Rout*' -exec cat '{}' \; || true
echo ::endgroup::
shell: bash
working-directory: ${{ inputs.working-directory }}
- name: Upload check results
if: failure() || inputs.upload-results != 'false'
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: ${{ steps.rcmdcheck.outputs.check-dir-path }}
- name: Upload snapshots
if: inputs.upload-snapshots != 'false'
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-testthat-snapshots
path: ${{ steps.rcmdcheck.outputs.check-dir-path }}/**/tests*/testthat/_snaps
if-no-files-found: ignore