Fix remaining devtools::check() issues - achieve 0 errors, 0 warnings #2
This file contains hidden or 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 Check | |
on: | |
push: | |
branches: [ main, master ] | |
pull_request: | |
branches: [ main, master ] | |
workflow_dispatch: | |
jobs: | |
R-CMD-check: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: ubuntu-latest, r: 'release'} | |
- {os: ubuntu-latest, r: 'devel'} | |
- {os: windows-latest, r: 'release'} | |
- {os: macOS-latest, r: 'release'} | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
R_KEEP_PKG_SOURCE: yes | |
NOT_CRAN: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
use-public-rspm: true | |
- name: Install system dependencies (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
libcurl4-openssl-dev \ | |
libssl-dev \ | |
libxml2-dev \ | |
libharfbuzz-dev \ | |
libfribidi-dev \ | |
libgit2-dev \ | |
libgsl-dev | |
- name: Install system dependencies (macOS) | |
if: runner.os == 'macOS' | |
run: | | |
brew install gsl | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::rcmdcheck, any::devtools | |
needs: check | |
- name: Check package | |
uses: r-lib/actions/check-r-package@v2 | |
with: | |
upload-snapshots: true | |
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' | |
- name: Show testthat output | |
if: always() | |
run: | | |
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true | |
shell: bash | |
- name: Upload check results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ runner.os }}-r${{ matrix.config.r }}-results | |
path: check | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::lintr, local::. | |
needs: lint | |
- name: Lint | |
run: | | |
# Only lint if lintr is available (it's in Suggests) | |
if (requireNamespace("lintr", quietly = TRUE)) { | |
lintr::lint_package() | |
} else { | |
cat("lintr not available, skipping lint check\n") | |
} | |
shell: Rscript {0} | |
test-coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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, local::. | |
needs: coverage | |
- name: Test coverage | |
run: | | |
if (requireNamespace("covr", quietly = TRUE)) { | |
covr::codecov( | |
quiet = FALSE, | |
clean = FALSE, | |
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package") | |
) | |
} else { | |
cat("covr not available, skipping coverage\n") | |
} | |
shell: Rscript {0} |