new branch #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: R Package Checks | |
on: | |
push: | |
branches: [main, master, develop, dev] | |
pull_request: | |
branches: [main, master, develop, dev] | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: ubuntu-latest, r: 'release'} | |
- {os: macOS-latest, r: 'release'} | |
- {os: windows-latest, r: 'release'} | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
R_KEEP_PKG_SOURCE: yes | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::testthat, any::devtools, any::rcmdcheck | |
needs: check | |
- name: Check package structure | |
run: | | |
pwd | |
ls -R | |
shell: bash | |
- name: Enable core dumps (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /v DumpFolder /t REG_EXPAND_SZ /d "%LOCALAPPDATA%\CrashDumps" /f | |
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /v DumpCount /t REG_DWORD /d 10 /f | |
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /v DumpType /t REG_DWORD /d 2 /f | |
shell: cmd | |
- name: Load and check package | |
run: | | |
options(crayon.enabled = TRUE) | |
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") | |
shell: Rscript {0} | |
- name: Run tests | |
run: | | |
options(crayon.enabled = TRUE) | |
library(testthat) | |
library(devtools) | |
devtools::load_all() | |
test_results <- testthat::test_dir("tests/testthat", reporter = "summary") | |
saveRDS(test_results, file = "test_results.rds") | |
shell: Rscript {0} | |
- name: Upload check results | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ runner.os }}-r${{ matrix.config.r }}-results | |
path: check | |
- name: Upload test results | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: test-results-${{ matrix.config.os }} | |
path: | | |
test_results.rds | |
tests/testthat/ | |
- name: Upload crash dumps (Windows) | |
if: failure() && runner.os == 'Windows' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: crash-dumps-windows | |
path: ${{ env.LOCALAPPDATA }}\CrashDumps\ |