Skip to content

Add devel image

Add devel image #505

Workflow file for this run

on:
workflow_dispatch:
workflow_call:
inputs:
error-on:
description: Input for the 'error_on' parameter in rcmdcheck::rcmdcheck()
required: false
default: note
type: string
push:
branches:
- main
- devel
pull_request:
branches:
- main
- devel
name: R CMD Check
concurrency:
group: r-cmd-check-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
R-CMD-check:
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{ matrix.config.r }}:latest"
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
if: >
!contains(github.event.commits[0].message, '[skip r-cmd-check]')
strategy:
fail-fast: false
matrix:
config:
- {r: '4.1', repos: 'https://packagemanager.posit.co/cran/2021-05-03/'}
- {r: '4.2', repos: 'https://packagemanager.posit.co/cran/2022-01-03/'}
- {r: '4.3', repos: 'https://packagemanager.posit.co/cran/__linux__/focal/latest'}
- {r: 'devel', repos: 'https://packagemanager.posit.co/cran/__linux__/focal/latest'} # not needed for devel ?
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: true
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
R_REPOS: ${{ matrix.config.repos }}
steps:
##################### BEGIN boilerplate steps #####################
- name: Get branch names
id: branch-name
uses: tj-actions/[email protected]
- name: Checkout repo (PR) 🛎
uses: actions/checkout@v3
if: github.event_name == 'pull_request'
with:
ref: ${{ steps.branch-name.outputs.head_ref_branch }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Checkout repository
uses: actions/checkout@v3
if: github.event_name != 'pull_request'
with:
ref: ${{ steps.branch-name.outputs.head_ref_branch }}
- name: Restore cache
uses: actions/cache@v3
with:
path: |
~/.staged.dependencies
key: staged-deps
- name: Run Staged dependencies
uses: insightsengineering/staged-dependencies-action@v1
with:
run-system-dependencies: false
renv-restore: false
enable-check: false
cran-repos: "CRAN=${{ matrix.config.repos }}"
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
#####################c#####################
- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
_R_CHECK_FORCE_SUGGESTS_: false
run: |
description_old <- readLines("DESCRIPTION")
description_dat <- description_old
for (i in seq_along(description_dat)) {
if (grepl("^Version:", description_dat[i])) {
current_version <- sub("^Version: ", "", description_dat[i])
version_parts <- strsplit(current_version, "\\.")[[1]]
# check if maintenance version - if yes, temp update the DESCRIPTION for rcmdchecks
if (length(version_parts) == 4) {
print("Maintenance version detected (format X.Y.Z.M with M >= 9000)")
version_parts <- version_parts[1:3]
}
new_version <- paste(version_parts, collapse = ".")
description_dat[i] <- paste("Version: ", new_version)
}
}
# Write the updated DESCRIPTION file back
#writeLines(description_dat, con = "DESCRIPTION")
if (!requireNamespace("rcmdcheck", quietly = TRUE)) install.packages("rcmdcheck")
options(crayon.enabled = TRUE)
check_error_on <- "${{ inputs.error-on }}"
if (check_error_on == "") {
check_error_on <- "note"
}
rcmdcheck::rcmdcheck(
args = c("--no-manual", "--as-cran"),
error_on = check_error_on,
check_dir = "check"
)
# Write back initial description file
writeLines(description_dat, con = "DESCRIPTION")
shell: Rscript {0}
- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: r${{ matrix.config.r }}-results
path: check