@@ -18,62 +18,61 @@ jobs:
18
18
- {os: ubuntu-latest, r: 'release'}
19
19
- {os: macOS-latest, r: 'release'}
20
20
- {os: windows-latest, r: 'release'}
21
+
21
22
env :
22
23
GITHUB_PAT : ${{ secrets.GITHUB_TOKEN }}
23
24
R_KEEP_PKG_SOURCE : yes
25
+
24
26
steps :
25
27
- uses : actions/checkout@v4
28
+
26
29
- uses : r-lib/actions/setup-r@v2
27
30
with :
28
31
r-version : ${{ matrix.config.r }}
29
32
use-public-rspm : true
33
+
30
34
- uses : r-lib/actions/setup-r-dependencies@v2
31
35
with :
32
- extra-packages : any::testthat, any::devtools
36
+ extra-packages : any::testthat, any::devtools, any::rcmdcheck
33
37
needs : check
38
+
34
39
- name : Check package structure
35
40
run : |
36
41
pwd
37
42
ls -R
38
43
shell : bash
39
- - name : Load package
40
- run : |
41
- Rscript -e '
42
- message("Starting load_all")
43
- devtools::load_all(recompile = TRUE)
44
- message("load_all completed")
45
- '
46
- shell : bash
47
- - name : Enable core dumps (Windows)
44
+
45
+ - name : Enable core dumps (Windows)
48
46
if : runner.os == 'Windows'
49
47
run : |
50
48
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /v DumpFolder /t REG_EXPAND_SZ /d "%LOCALAPPDATA%\CrashDumps" /f
51
49
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /v DumpCount /t REG_DWORD /d 10 /f
52
50
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /v DumpType /t REG_DWORD /d 2 /f
53
51
shell : cmd
52
+
53
+ - name : Load and check package
54
+ run : |
55
+ options(crayon.enabled = TRUE)
56
+ rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
57
+ shell : Rscript {0}
58
+
54
59
- name : Run tests
55
60
run : |
56
- Rscript -e '
57
- message("Starting tests")
58
- options(warn = 2) # Treat warnings as errors
59
- test_results <- tryCatch({
60
- devtools::test()
61
- }, error = function(e) {
62
- message("Error occurred during testing: ", e$message)
63
- return(NULL)
64
- }, warning = function(w) {
65
- message("Warning occurred during testing: ", w$message)
66
- return(NULL)
67
- })
68
- message("Tests completed")
69
- if (!is.null(test_results)) {
70
- saveRDS(test_results, file = "test_results.rds")
71
- message("Test results saved")
72
- } else {
73
- message("No test results to save")
74
- }
75
- '
76
- shell : bash
61
+ options(crayon.enabled = TRUE)
62
+ library(testthat)
63
+ library(devtools)
64
+ devtools::load_all()
65
+ test_results <- testthat::test_dir("tests/testthat", reporter = "summary")
66
+ saveRDS(test_results, file = "test_results.rds")
67
+ shell : Rscript {0}
68
+
69
+ - name : Upload check results
70
+ if : failure()
71
+ uses : actions/upload-artifact@v3
72
+ with :
73
+ name : ${{ runner.os }}-r${{ matrix.config.r }}-results
74
+ path : check
75
+
77
76
- name : Upload test results
78
77
uses : actions/upload-artifact@v3
79
78
if : always()
82
81
path : |
83
82
test_results.rds
84
83
tests/testthat/
84
+
85
+ - name : Upload crash dumps (Windows)
86
+ if : failure() && runner.os == 'Windows'
87
+ uses : actions/upload-artifact@v3
88
+ with :
89
+ name : crash-dumps-windows
90
+ path : ${{ env.LOCALAPPDATA }}\CrashDumps\
0 commit comments