-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (81 loc) · 2.86 KB
/
Copy pathr-check.yml
File metadata and controls
97 lines (81 loc) · 2.86 KB
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
# Checks for the R package in `r/`.
#
# Derived from https://github.com/r-lib/actions/tree/v2/examples. Every action
# that touches the package is pointed at the `r/` subdirectory through its
# `working-directory` input, because the repository root holds the Python
# package rather than an R package.
#
# Live terminology server access: the unit suite answers every request from
# canned fixtures, so it needs no network. The one exception is
# `r/tests/testthat/test-integration.R`, which runs the README example against
# the CSIRO public Ontoserver. It skips here for two independent reasons:
#
# 1. `skip_on_cran()` skips unless `NOT_CRAN` is set. Neither `R CMD check` nor
# covr sets it, so both jobs below skip the test on that ground alone.
# 2. It also skips whenever `CI` is set, which GitHub Actions always sets. This
# covers anyone who later adds a job running `devtools::test()` or
# `testthat::test_local()`, both of which do set `NOT_CRAN`.
#
# A terminology server outage or a content change on the server therefore
# cannot fail this workflow. The live check runs locally, where `CI` is unset
# and `devtools::test()` sets `NOT_CRAN`.
name: R check
on:
push:
branches: [main]
pull_request:
permissions: read-all
jobs:
check:
runs-on: ${{ matrix.os }}
name: R CMD check (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
r-version: release
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
working-directory: r
extra-packages: any::rcmdcheck
needs: check
- uses: r-lib/actions/check-r-package@v2
with:
working-directory: r
upload-snapshots: true
coverage:
runs-on: ubuntu-latest
name: Coverage
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
working-directory: r
extra-packages: any::covr
needs: coverage
# Results are printed to the job log. There is no external coverage
# service; read the per-file table in the step output.
- name: Report coverage
run: |
coverage <- covr::package_coverage("r", quiet = FALSE)
print(coverage)
uncovered <- covr::zero_coverage(coverage)
if (nrow(uncovered) > 0) {
print(uncovered)
stop(sprintf("%d uncovered line(s)", nrow(uncovered)))
}
message("All lines covered.")
shell: Rscript {0}