Repository navigation
103 lines (91 loc) · 3.51 KB
/
Copy pathtest-coverage.yaml
File metadata and controls
103 lines (91 loc) · 3.51 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
98
99
100
101
102
103
name: test-coverage
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
_R_CHECK_FORCE_SUGGESTS_: false
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-pandoc@v2
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libhdf5-dev
# Build the standalone scconvert CLI binary and install it to inst/bin/
# so it ships with the package that covr installs. Without this step,
# sc_find_cli() returns NULL during covr and test-cli-integration.R
# is entirely skipped -- C code never contributes to coverage.
- name: Build CLI binary
run: |
cd src
make -f Makefile.cli
make -f Makefile.cli install-bin
# Install the scverse Python stack so test-python-validation.R runs
# in CI instead of skipping. micromamba is faster than full conda and
# supports activation via setup-micromamba's built-in shell hook.
- uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.10-0'
environment-file: tests/scverse-env.yml
environment-name: scverse
cache-environment: true
init-shell: bash
- name: Export RETICULATE_PYTHON and threading env
shell: bash
run: |
echo "RETICULATE_PYTHON=${MAMBA_ROOT_PREFIX}/envs/scverse/bin/python" >> "$GITHUB_ENV"
echo "NUMBA_THREADING_LAYER=tbb" >> "$GITHUB_ENV"
echo "OMP_NUM_THREADS=1" >> "$GITHUB_ENV"
echo "OPENBLAS_NUM_THREADS=1" >> "$GITHUB_ENV"
echo "MKL_NUM_THREADS=1" >> "$GITHUB_ENV"
- uses: r-lib/actions/setup-r@v2
with:
r-version: 'release'
use-public-rspm: true
- name: Pre-install BPCells from r-universe
shell: Rscript {0}
run: |
install.packages(
"BPCells",
repos = c(
bnprks = "https://bnprks.r-universe.dev",
CRAN = "https://cloud.r-project.org"
)
)
- uses: r-lib/actions/setup-r-dependencies@v2
with:
dependencies: 'c("Depends", "Imports", "LinkingTo", "Suggests")'
extra-packages: any::covr any::reticulate
cache-version: 1
# install_path must live outside the R session tempdir: R deletes its
# own Rtmp* directory when the process exits (clean = FALSE does not
# prevent that), which used to take testthat.Rout.fail with it.
- name: Run test coverage
shell: Rscript {0}
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "covr-install")
)
# covr runs the test suite via tools::testInstalledPackage, which writes
# test output only to testthat.Rout(.fail) inside its install library --
# the job log otherwise shows nothing but "running the tests failed",
# making CI failures undiagnosable. Surface the file on failure.
- name: Show testthat output on failure
if: failure()
shell: bash
run: |
found=0
while IFS= read -r f; do
found=1
echo "=== $f ==="
tail -n 500 "$f"
done < <(find "$RUNNER_TEMP/covr-install" /tmp -name 'testthat.Rout*' 2>/dev/null)
if [ "$found" -eq 0 ]; then
echo "No testthat.Rout* files found"
fi