Skip to content

Bump peter-evans/create-pull-request from 6.0.4 to 6.1.0 #602

Bump peter-evans/create-pull-request from 6.0.4 to 6.1.0

Bump peter-evans/create-pull-request from 6.0.4 to 6.1.0 #602

on:
pull_request:
branches:
- '*'
name: Legacy hook tests
jobs:
hook-test:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'release', use-public-rspm: true}
env:
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
- name: checkout old hook scripts
run: |
git fetch origin refs/tags/v0.1.3:refs/tags/v0.1.3
git checkout v0.1.3 -- inst/bin
git checkout v0.1.3 -- tests/testthat/test-all.R
git checkout v0.1.3 -- R/testing.R
- name: Query dependencies
run: |
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- name: Cache R packages (macOs)
if: startsWith(runner.os, 'macOS')
uses: actions/cache@v4
with:
path: ~/Library/Application Support/renv
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('renv.lock') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
- name: Cache R packages (Linux)
if: startsWith(runner.os, 'Linux')
uses: actions/cache@v4
with:
path: ~/.local/share/renv
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('renv.lock') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
- name: Cache R packages (Windows)
if: startsWith(runner.os, 'Windows')
uses: actions/cache@v4
with:
path: ~\AppData\Local\renv
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('renv.lock') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
- uses: r-lib/actions/setup-r-dependencies@v2
- name: Perpare testing environment
run: |
# testing dependencies (incl. {precommit}) live in global R library,
# hook dependencies in renv, which is only activated when child R
# process is invoked, e.g. as in run_test()
if (!requireNamespace("renv", quietly = TRUE)) {
install.packages("renv", repos = c(CRAN = "https://cloud.r-project.org"))
}
# avoid build-time deps
options(install.packages.compile.from.source = "never")
renv::install(c('testthat', 'devtools', 'desc', 'git2r'))
renv::install(desc::desc_get_deps()$package) # install all deps
renv::install(getwd())
shell: Rscript {0}
- name: Session info (testing environment)
run: |
renv::install('sessioninfo', repos = 'cloud.r-project.org')
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
- name: Test
run: |
devtools::load_all()
testthat::test_file(
"tests/testthat/test-all.R",
reporter = testthat::MultiReporter$new(list(
testthat::CheckReporter$new(), testthat::FailReporter$new()
))
)
shell: Rscript {0}
- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check