8
8
workflow_dispatch :
9
9
10
10
jobs :
11
+ determine_check_type :
12
+ runs-on : ubuntu-latest
13
+ outputs :
14
+ run_type : ${{ steps.check_run_type.outputs.run_type }}
15
+ steps :
16
+ - uses : actions/checkout@v4
17
+ - id : check_run_type
18
+ run : |
19
+ if [[ "${{ github.event.head_commit.message }}" == *"[long-run]"* ]]; then
20
+ echo "run_type=comprehensive" >> $GITHUB_OUTPUT
21
+ else
22
+ echo "run_type=quick" >> $GITHUB_OUTPUT
23
+ fi
24
+
11
25
test :
26
+ needs : determine_check_type
12
27
runs-on : ${{ matrix.config.os }}
13
28
name : ${{ matrix.config.os }} (${{ matrix.config.r }})
14
29
strategy :
@@ -33,27 +48,48 @@ jobs:
33
48
34
49
- uses : r-lib/actions/setup-r-dependencies@v2
35
50
with :
36
- extra-packages : any::rcmdcheck
51
+ extra-packages : any::testthat, any::devtools, any:: rcmdcheck
37
52
needs : check
38
53
39
- - name : Check package
54
+ - name : Run quick check
55
+ if : needs.determine_check_type.outputs.run_type == 'quick'
56
+ run : |
57
+ options(crayon.enabled = TRUE)
58
+ devtools::load_all()
59
+ testthat::test_dir("tests/testthat", reporter = "summary")
60
+ shell : Rscript {0}
61
+
62
+ - name : Run comprehensive check
63
+ if : needs.determine_check_type.outputs.run_type == 'comprehensive'
40
64
env :
41
65
_R_CHECK_CRAN_INCOMING_ : false
42
66
run : |
43
67
options(crayon.enabled = TRUE)
44
68
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
45
69
shell : Rscript {0}
46
70
71
+ - name : Run tests (comprehensive)
72
+ if : needs.determine_check_type.outputs.run_type == 'comprehensive'
73
+ run : |
74
+ options(crayon.enabled = TRUE)
75
+ devtools::load_all()
76
+ test_results <- testthat::test_dir("tests/testthat", reporter = "summary")
77
+ saveRDS(test_results, file = "test_results.rds")
78
+ print(test_results)
79
+ shell : Rscript {0}
80
+
47
81
- name : Upload check results
48
- if : failure()
82
+ if : failure() && needs.determine_check_type.outputs.run_type == 'comprehensive'
49
83
uses : actions/upload-artifact@v3
50
84
with :
51
85
name : ${{ runner.os }}-r${{ matrix.config.r }}-results
52
86
path : check
53
87
54
- - name : Test coverage
55
- if : runner.os == 'Linux'
56
- run : |
57
- pak::pkg_install("covr")
58
- covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")
59
- shell : Rscript {0}
88
+ - name : Upload test results
89
+ uses : actions/upload-artifact@v3
90
+ if : needs.determine_check_type.outputs.run_type == 'comprehensive'
91
+ with :
92
+ name : test-results-${{ matrix.config.os }}
93
+ path : |
94
+ test_results.rds
95
+ tests/testthat/
0 commit comments