Skip to content

Commit

Permalink
Adds a new subflow which checks the package against specific cran sna…
Browse files Browse the repository at this point in the history
…pshot(s)
  • Loading branch information
Henrik Sparre Spiegelhauer (HSPU) committed Apr 16, 2024
1 parent cc21c2f commit 9e85fcf
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/Check-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ jobs:
name: RMD check 📦
uses: ./.github/workflows/R-CMD-check.yaml

# Runs R CMD check with specific version(s) of R and cran-snapshot
check-versions:
name: RMD check versions 📜
uses: ./.github/workflows/R-CMD-check-versions.yaml

# Runs unittests while capturing code:cov and uploads to Codecov io. See local subflow
test:
name: Test 🧪
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/R-CMD-check-versions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
# R-CMD check which allows you to lock the R version and date of the CRAN snapshot.
# This is particularly helpful for ensuring that the package works with internal systems.
on:
workflow_dispatch:
workflow_call:
permissions: read-all

name: R-CMD-check-versions

jobs:
R-CMD-check:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} (R ${{ matrix.config.r }}, ${{ matrix.config.date }})
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- windows-latest
- ubuntu-latest
config:
- date: 2023-10-25 # Lock the date of the CRAN snapshot
r: 4.3.1
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

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: false

- name: Install curl
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt install libcurl4-openssl-dev
- name: Install dependencies
run: >
options(
repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}")
)

install.packages(c("attachment", "rcmdcheck"), Ncpus = parallel::detectCores()-1)


attachment::att_from_description(field = c("Depends", "Imports", "Suggests")) |>
install.packages(Ncpus = parallel::detectCores()-1)

shell: Rscript {0}

- name: Session info
run: |
sessionInfo()
installed.packages()[,c("Package", "Version")]
shell: Rscript {0}

- uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--no-manual", "--as-cran")'
upload-snapshots: true
error-on: '"error"'
check-dir: '"check"'
upload-results: true

0 comments on commit 9e85fcf

Please sign in to comment.