From 7b072877d5947320301d2e603d8e3c8b68457958 Mon Sep 17 00:00:00 2001 From: Ian D Buller Date: Tue, 9 Jul 2024 16:30:17 -0400 Subject: [PATCH] :stethoscope: Update R CMD check in GitHub Actions * test solution for #8 (attempt 2) * suspect #8 is lack of 'sf' dependencies in earlier Ubuntu releases (i.e., GDAL) * now install 'sf' dependencies based on R CMD check in GitHub Actions of pfizer-opensource/deprivateR --- .github/workflows/R-CMD-check.yaml | 94 +++++++++++++++++++++++++----- 1 file changed, 78 insertions(+), 16 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index a3ac618..8a12fe0 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,10 +1,10 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [main, master] + branches: + - main pull_request: - branches: [main, master] + branches: + - main name: R-CMD-check @@ -18,32 +18,94 @@ jobs: fail-fast: false matrix: config: + - {os: macos-latest, r: 'devel'} - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - - {os: ubuntu-latest, r: 'release'} - - {os: ubuntu-latest, r: 'oldrel-1'} - + - {os: windows-latest, r: '3.6'} # Use 3.6 to trigger usage of RTools35 + - {os: windows-latest, r: '4.1'} # use 4.1 to check with rtools40's older compiler + - {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'} + - {os: ubuntu-latest, r: 'oldrel-4'} + - {os: ubuntu-latest, r: 'oldrel-5'} + env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes + R_REMOTES_NO_ERRORS_FROM_WARNINGS: true + RSPM: ${{ matrix.config.rspm }} steps: - - uses: actions/checkout@v3 - - - uses: r-lib/actions/setup-pandoc@v2 + - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-r@v2 + - uses: r-lib/actions/setup-r@v2.9.0 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true + + - 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 + + # - uses: r-lib/actions/setup-r-dependencies@v2.9.0 + # with: + # extra-packages: any::rcmdcheck + # needs: check - - uses: r-lib/actions/setup-r-dependencies@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@v1 with: - extra-packages: any::rcmdcheck - needs: check + 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- + + - name: Install macOS specific dependencies for sf + if: runner.os == 'macOS' + run: brew install udunits gdal proj + + - name: Install Linux specific dependencies for sf + if: runner.os == 'Linux' + run: sudo apt-get install libgdal-dev libproj-dev libgeos-dev libudunits2-dev - - uses: r-lib/actions/check-r-package@v2 + - name: Install language dependencies + run: | + remotes::install_deps(dependencies = TRUE, build = FALSE) + 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} + + - uses: r-lib/actions/check-r-package@v2.9.0 with: upload-snapshots: true + + - 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