Skip to content

chore: New GHA checks for the case of missing suggested packages #27

chore: New GHA checks for the case of missing suggested packages

chore: New GHA checks for the case of missing suggested packages #27

# This workflow calls the GitHub API very frequently.
# Can't be run as part of commits
on:
schedule:
- cron: "5 0 * * *" # 05:00 UTC every day only run on main branch
pull_request:
push:
branches:
- "cran-*"
tags:
- "v*"
name: rcc without suggested
jobs:
matrix:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
name: Collect deps
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/workflows/rate-limit
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: r-lib/actions/setup-r@v2
with:
install-r: false
use-public-rspm: true
- id: set-matrix
uses: ./.github/workflows/dep-matrix-suggests
check-matrix:
runs-on: ubuntu-22.04
needs: matrix
name: Check deps
if: ${{ needs.matrix.outputs.matrix != '' }}
steps:
- name: Install json2yaml
run: |
sudo npm install -g json2yaml
- name: Check matrix definition
run: |
matrix='${{ needs.matrix.outputs.matrix }}'
echo $matrix
echo $matrix | jq .
echo $matrix | json2yaml
R-CMD-check-suggests:
env:
_R_CHECK_FORCE_SUGGESTS_: false
needs:
- matrix
runs-on: ubuntu-22.04
name: ${{ matrix.package }}
if: ${{ needs.matrix.outputs.matrix != '' }}
# Begin custom: services
# End custom: services
strategy:
fail-fast: false
matrix: ${{fromJson(needs.matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/custom/before-install
if: hashFiles('.github/workflows/custom/before-install/action.yml') != ''
- uses: ./.github/workflows/install
with:
install-r: false
cache-version: rcc-dev-${{ matrix.package }}-1
needs: check
extra-packages: "any::rcmdcheck any::remotes ."
token: ${{ secrets.GITHUB_TOKEN }}
- name: Remove ${{ matrix.package }} and all strong dependencies
run: |
pkg <- "${{ matrix.package }}"
pkgs <- tools::package_dependencies(pkg, reverse = TRUE)[[1]]
installed <- rownames(utils::installed.packages())
to_remove <- c(pkg, intersect(pkgs, installed))
print(to_remove)
remove.packages(to_remove)
shell: Rscript {0}
- name: Session info
run: |
options(width = 100)
if (!requireNamespace("sessioninfo", quietly = TRUE)) install.packages("sessioninfo")
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
- uses: ./.github/workflows/custom/after-install
if: hashFiles('.github/workflows/custom/after-install/action.yml') != ''
- name: Define _R_CHECK_FORCE_SUGGESTS_
run: |
cat('_R_CHECK_FORCE_SUGGESTS_=false\n', file = Sys.getenv("GITHUB_ENV"), append = TRUE)
shell: Rscript {0}
- name: Must allow NOTEs, even with _R_CHECK_FORCE_SUGGESTS_
run: |
if (Sys.getenv("RCMDCHECK_ERROR_ON") %in% c("", "note")) {
cat('RCMDCHECK_ERROR_ON="warning"\n', file = Sys.getenv("GITHUB_ENV"), append = TRUE)
}
shell: Rscript {0}
- name: Check env vars
run: |
print(Sys.getenv('_R_CHECK_FORCE_SUGGESTS_'))
print(Sys.getenv('RCMDCHECK_ERROR_ON'))
shell: Rscript {0}
- uses: ./.github/workflows/check
with:
results: ${{ matrix.package }}