From 0d8a26b80318df3f77e77c8c63dd0b40fcb4265e Mon Sep 17 00:00:00 2001 From: Ian D Buller Date: Tue, 9 Jul 2024 17:06:25 -0400 Subject: [PATCH] :stethoscope: Update R CMD check in GitHub Actions * test solution for #8 (attempt 4) --- .github/workflows/R-CMD-check.yaml | 60 +++++++++++++++++------------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 385aa1e..31486be 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,10 +1,12 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples - +# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. +# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions on: push: - branches: [main, master] + branches: + - main pull_request: - branches: [main, master] + branches: + - main name: R-CMD-check @@ -24,7 +26,6 @@ jobs: - {os: windows-latest, r: 'release'} - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} - - {os: ubuntu-latest, r: 'oldrel'} - {os: ubuntu-latest, r: 'oldrel-1'} - {os: ubuntu-latest, r: 'oldrel-2'} - {os: ubuntu-latest, r: 'oldrel-3'} @@ -32,15 +33,15 @@ jobs: - {os: ubuntu-latest, r: 'oldrel-5'} env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - R_KEEP_PKG_SOURCE: yes + R_KEEP_PKG_SOURCE: yes R_REMOTES_NO_ERRORS_FROM_WARNINGS: true RSPM: ${{ matrix.config.rspm }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-r@v2.9.0 + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} @@ -48,12 +49,12 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 - # For file snapshot that uses png - - name: Install xquartz - if: runner.os == 'macOS' - run: brew install --cask xquartz + # # For file snapshot that uses png + # - name: Install xquartz + # if: runner.os == 'macOS' + # run: brew install --cask xquartz - # - uses: r-lib/actions/setup-r-dependencies@v2.9.0 + # - uses: r-lib/actions/setup-r-dependencies@v # with: # extra-packages: any::rcmdcheck # needs: check @@ -62,6 +63,7 @@ jobs: run: | install.packages('remotes') saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) + writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") shell: Rscript {0} - name: Cache R packages @@ -70,7 +72,7 @@ jobs: with: path: ${{ env.R_LIBS_USER }} key: ${{ runner.os }}-r-${{ matrix.config.r }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-1- + restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - name: Install macOS specific dependencies for sf if: runner.os == 'macOS' @@ -80,31 +82,37 @@ jobs: if: runner.os == 'Linux' run: sudo apt-get install libgdal-dev libproj-dev libgeos-dev libudunits2-dev - - name: Install language dependencies + - name: Install dependencies run: | - remotes::install_deps(dependencies = TRUE, build = FALSE) + remotes::install_deps(dependencies = TRUE) remotes::install_cran("rcmdcheck") shell: Rscript {0} - name: Session info run: | options(width = 100) - pkgs <- installed.packages()[, 'Package'] + pkgs <- installed.packages()[, "Package"] sessioninfo::session_info(pkgs, include_base = TRUE) shell: Rscript {0} - - uses: r-lib/actions/check-r-package@v2.9.0 - with: - upload-snapshots: true + # - uses: r-lib/actions/check-r-package@v2 + # with: + # upload-snapshots: true - - name: Show testthat output - if: always() - run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true - shell: bash + # - name: Show testthat output + # if: always() + # run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true + # shell: bash + + - 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: Upload check results if: failure() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@main with: name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check + path: check