Skip to content

R-CMD-check

R-CMD-check #1087

Workflow file for this run

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
schedule:
- cron: '0 0 * * 6' # At 00:00 on Saturday
workflow_dispatch:
name: R-CMD-check
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-22.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
- {os: ubuntu-22.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
- {os: ubuntu-20.04, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
env:
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Get branch name (push)
if: github.event_name != 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
- name: Configure git
if: runner.os == 'Windows' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
run: |
git config user.email "github-actions@github.com"
git config user.name "github-actions"
git pull --no-rebase origin ${{ env.BRANCH_NAME }}
echo ${{ env.BRANCH_NAME }}
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck, any::remotes, local::.
needs: check
- name: Install soilDBdata off GitHub
run: remotes::install_github("brownag/soilDBdata", dependencies = FALSE, build = FALSE)
shell: Rscript {0}
- name: Install aqp off GitHub (devel only)
if: matrix.config.r == 'devel'
run: |
remotes::install_github("ncss-tech/aqp", dependencies = TRUE, build = FALSE)
shell: Rscript {0}
- name: Install terra off r-universe (devel+Windows only)
if: matrix.config.r == 'devel' || runner.os == 'Windows'
run: install.packages('terra', repos = 'https://rspatial.r-universe.dev')
shell: Rscript {0}
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
- name: Render README
if: runner.os == 'Windows' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
run: |
install.packages(c("rmarkdown","devtools","pkgdown","aqp"))
remotes::install_github(c("ncss-tech/aqp"), dependencies = FALSE)
rmarkdown::render("README.Rmd")
shell: Rscript {0}
- name: Commit results
if: runner.os == 'Windows' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
continue-on-error: true
run: |
git add README.md
git commit -m 'Render README.Rmd' || echo "No changes to commit"
git add inst/\*
git commit -m 'Update inst' || echo "No changes to commit"
- name: Push results
if: runner.os == 'Windows' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
run: |
git push origin HEAD:${{ env.BRANCH_NAME }} || echo "No changes to commit"