Skip to content

Commit 751f5b5

Browse files
committed
new branch
1 parent 1426f54 commit 751f5b5

File tree

1 file changed

+37
-31
lines changed

1 file changed

+37
-31
lines changed

.github/workflows/R-CMD-check.yaml

+37-31
Original file line numberDiff line numberDiff line change
@@ -18,62 +18,61 @@ jobs:
1818
- {os: ubuntu-latest, r: 'release'}
1919
- {os: macOS-latest, r: 'release'}
2020
- {os: windows-latest, r: 'release'}
21+
2122
env:
2223
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
2324
R_KEEP_PKG_SOURCE: yes
25+
2426
steps:
2527
- uses: actions/checkout@v4
28+
2629
- uses: r-lib/actions/setup-r@v2
2730
with:
2831
r-version: ${{ matrix.config.r }}
2932
use-public-rspm: true
33+
3034
- uses: r-lib/actions/setup-r-dependencies@v2
3135
with:
32-
extra-packages: any::testthat, any::devtools
36+
extra-packages: any::testthat, any::devtools, any::rcmdcheck
3337
needs: check
38+
3439
- name: Check package structure
3540
run: |
3641
pwd
3742
ls -R
3843
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)
4846
if: runner.os == 'Windows'
4947
run: |
5048
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /v DumpFolder /t REG_EXPAND_SZ /d "%LOCALAPPDATA%\CrashDumps" /f
5149
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /v DumpCount /t REG_DWORD /d 10 /f
5250
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /v DumpType /t REG_DWORD /d 2 /f
5351
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+
5459
- name: Run tests
5560
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+
7776
- name: Upload test results
7877
uses: actions/upload-artifact@v3
7978
if: always()
@@ -82,3 +81,10 @@ jobs:
8281
path: |
8382
test_results.rds
8483
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

Comments
 (0)