Start testing for GH stuff #65
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
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | |
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
workflow_dispatch: | |
inputs: | |
ssh_debug: | |
description: Launch shell for interactive debugging? | |
type: boolean | |
required: true | |
default: false | |
name: R-CMD-check | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
R-CMD-check-base: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
R_KEEP_PKG_SOURCE: yes | |
GIT_CRYPT_KEY64: ${{ secrets.GIT_CRYPT_KEY64 }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Do a pre-emptive apt-update | |
run: sudo apt-get update -qq | |
if: ${{ !env.ACT }} | |
- name: Decrypt repository using symmetric key | |
if: ${{ env.GIT_CRYPT_KEY64 }} | |
run: | | |
apt-get install -y --no-install-recommends git-crypt | |
echo $GIT_CRYPT_KEY64 > git_crypt_key.key64 && base64 -di git_crypt_key.key64 > git_crypt_key.key && git-crypt unlock git_crypt_key.key | |
rm git_crypt_key.key git_crypt_key.key64 | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: release | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::sessioninfo, any::rcmdcheck, any::pkgdepends, any::covr, any::riskmetric, github::ropensci-review-tools/pkgcheck, | |
needs: check | |
- name: Run just package tests and record test coverage | |
run: | | |
cat("LOGNAME=", Sys.info()[["user"]], "\n", sep = "", file = Sys.getenv("GITHUB_ENV"), append = TRUE) | |
cat("check-dir-path=", file.path(getwd(), ("check")), "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE) | |
coverage <- covr::package_coverage(code = "saveRDS(testthat::capture_output(testthat::test_package('relic', reporter = 'Progress')), file.path('check', 'test_results.rds'))", install_path = "check", clean=FALSE) | |
saveRDS(coverage, file.path("check", "coverage.rds")) | |
cat(readRDS(file.path('check', 'test_results.rds'))) | |
shell: Rscript {0} | |
- name: Run R-CMD-check without tests | |
run: | | |
options(crayon.enabled = TRUE) | |
cat("LOGNAME=", Sys.info()[["user"]], "\n", sep = "", file = Sys.getenv("GITHUB_ENV"), append = TRUE) | |
if (Sys.getenv("_R_CHECK_FORCE_SUGGESTS_", "") == "") Sys.setenv("_R_CHECK_FORCE_SUGGESTS_" = "false") | |
if (Sys.getenv("_R_CHECK_CRAN_INCOMING_", "") == "") Sys.setenv("_R_CHECK_CRAN_INCOMING_" = "false") | |
cat("check-dir-path=", file.path(getwd(), ("check")), "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE) | |
rcmdcheck::rcmdcheck(args = c("--no-tests", "--no-manual"), error_on = "warning", check_dir = ("check")) | |
shell: Rscript {0} | |
- name: Print and upload coverage | |
run: | | |
library(covr) | |
coverage <- readRDS(file.path("check", "coverage.rds")) | |
coverage | |
covr::codecov(coverage = coverage) | |
shell: Rscript {0} | |
continue-on-error: true | |
- name: Additional diagnostics | |
run: | | |
pkc <- pkgcheck::pkgcheck(goodpractice = FALSE) | |
gp <- goodpractice::goodpractice(checks = goodpractice::all_checks()[grep("(rcmdcheck|covr)", goodpractice::all_checks(), invert = TRUE)]) | |
pkc | |
gp | |
shell: Rscript {0} | |
continue-on-error: true | |
- name: Launch a temporary interactive debugging session | |
uses: mxschmitt/[email protected] | |
if: always() && inputs.ssh_debug | |
with: | |
detached: true | |
# - uses: r-lib/actions/check-r-package@v2 | |
# with: | |
# upload-snapshots: true | |
R-CMD-check-grid: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
needs: R-CMD-check-base | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: macos-latest, r: 'release'} | |
- {os: windows-latest, r: 'release'} | |
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} | |
#- {os: ubuntu-latest, r: 'release'} | |
- {os: ubuntu-latest, r: 'oldrel-1'} | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
R_KEEP_PKG_SOURCE: yes | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install libgit2 on macOS | |
run: | | |
if [ "$RUNNER_OS" == "macOS" ]; then | |
brew install libgit2 | |
fi | |
shell: bash | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
http-user-agent: ${{ matrix.config.http-user-agent }} | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::sessioninfo, any::rcmdcheck, any::pkgdepends | |
needs: check | |
- uses: r-lib/actions/check-r-package@v2 | |
with: | |
upload-snapshots: true | |
- name: Launch a temporary interactive debugging session | |
uses: mxschmitt/[email protected] | |
if: always() && inputs.ssh_debug | |
with: | |
detached: true |