-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (67 loc) · 2.49 KB
/
Copy pathtest-coverage.yaml
File metadata and controls
77 lines (67 loc) · 2.49 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
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Test coverage via covr, uploaded to Codecov. Python is provided the same way
# R-CMD-check.yaml does -- through nat.python's own simple_python() engine -- so
# coverage exercises the exact provisioning path nat.python ships.
on:
push:
branches: [main, master]
pull_request:
workflow_dispatch:
name: test-coverage
permissions: read-all
jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_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:
extra-packages: any::covr, any::xml2
needs: coverage
- name: Install nat.python and provision Python via simple_python()
# Mirrors R-CMD-check.yaml's default leg, but provisions through
# nat.python's own simple_python(): miniconda + r-reticulate + pandas
# (via pip). pyarrow is added so the use_arrow = TRUE conversion path is
# exercised. RETICULATE_PYTHON is then pinned to that interpreter for the
# coverage run.
shell: Rscript {0}
run: |
pak::local_install()
library(nat.python)
simple_python("minimal", pkgs = "pyarrow")
print(py_module_info(c("numpy", "pandas", "pyarrow")))
cat(sprintf("RETICULATE_PYTHON=%s\n", reticulate::py_config()$python),
file = Sys.getenv("GITHUB_ENV"), append = TRUE)
- name: Test coverage
shell: Rscript {0}
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Show testthat output
if: always()
shell: bash
run: |
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package