main-03-R-CMD-check-mac #37
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
name: R-CMD-check on Mac | |
on: | |
workflow_dispatch: | |
inputs: | |
trigger_next: | |
description: 'Whether to run the subsequent workflows after triggering this one manually.' | |
required: false | |
default: false | |
repository_dispatch: | |
types: [main-03-R-CMD-check-mac] | |
jobs: | |
R-CMD-check-mac: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
strategy: | |
fail-fast: false | |
max-parallel: 1 | |
matrix: | |
config: | |
- {os: macOS-latest, r: 'release'} | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
RSPM: ${{ matrix.config.rspm }} | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
SALESFORCER_USERNAME: ${{ secrets.SALESFORCER_USERNAME }} | |
SALESFORCER_TOKEN_PATH: ${{ github.workspace }}/tests/testthat/ | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.client_payload.sha }} | |
- name: Decrypt OAuth Token | |
run: | | |
./.github/scripts/decrypt_secret.sh | |
env: | |
SALESFORCER_TOKEN_PASSPHRASE: ${{ secrets.SALESFORCER_TOKEN_PASSPHRASE }} | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
r-version: ${{ matrix.config.r }} | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: Query dependencies | |
run: | | |
install.packages("remotes") | |
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) | |
shell: Rscript {0} | |
- name: Cache R packages | |
if: runner.os != 'Windows' | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ runner.os }}-r-${{ matrix.config.r }}-3-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-3- | |
- name: Install system dependencies | |
if: runner.os == 'Linux' | |
env: | |
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc | |
run: | | |
Rscript -e "remotes::install_github('r-hub/sysreqs')" | |
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))") | |
sudo -s eval "$sysreqs" | |
- name: Install dependencies | |
run: | | |
remotes::install_deps(dependencies = TRUE) | |
remotes::install_cran("rcmdcheck") | |
shell: Rscript {0} | |
- name: Session info | |
run: | | |
options(width = 100) | |
pkgs <- installed.packages()[, "Package"] | |
sessioninfo::session_info(pkgs, include_base = TRUE) | |
shell: Rscript {0} | |
- name: Check | |
env: | |
_R_CHECK_CRAN_INCOMING_REMOTE_: false | |
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") | |
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@v4 | |
with: | |
name: ${{ runner.os }}-r-${{ matrix.config.r }}-results | |
path: check | |
- name: Trigger next workflow | |
if: ${{ (github.event_name != 'workflow_dispatch' && success()) || (github.event_name == 'workflow_dispatch' && github.event.inputs.trigger_next && success()) }} | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.REPO_GHA_PAT }} | |
repository: StevenMMortimer/salesforcer | |
event-type: main-04-R-CMD-check-windows | |
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' | |
- name: Set final R-CMD-check status | |
if: ${{ (github.event_name != 'workflow_dispatch' && failure()) }} | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.REPO_GHA_PAT }} | |
repository: StevenMMortimer/salesforcer | |
event-type: main-06-R-CMD-check-final | |
client-payload: '{"success": false}' |