-
Notifications
You must be signed in to change notification settings - Fork 5
84 lines (71 loc) · 2.4 KB
/
test-coverage.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
# 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
- 'dev/*'
pull_request:
branches:
- main
- 'dev/*'
workflow_dispatch:
name: test-coverage
jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
# Set the GitHub username and email for commits
- name: Set GitHub user
run: |
git config --global user.name "RPACT GitHub Action CovR"
git config --global user.email "info@rpact.com"
- name: Checkout this package repository
uses: actions/checkout@v4
- name: Checkout the private tests repository
uses: actions/checkout@v4
with:
repository: 'rpact-com/rpact.tests'
ref: main
token: ${{ secrets.RPACT_TESTS_ACCESS_TOKEN }}
path: 'private-tests'
sparse-checkout: |
tests
- 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: Add private tests
run: |
find ./private-tests/tests -maxdepth 1 -name \*.R -exec cp {} ./tests \;
find ./private-tests/tests/testthat -maxdepth 1 -name \*.R -exec cp {} ./tests/testthat \;
shell: bash
- name: Test coverage
run: |
Sys.setenv("RPACT_COMPLETE_UNIT_TEST_SET_ENABLED" = TRUE)
covr::codecov(
quiet = FALSE,
clean = FALSE,
token = Sys.getenv("CODECOV_TOKEN"),
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
shell: Rscript {0}
- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package