From 40e8e79501b7caf16f684ec0f386a6299b241d07 Mon Sep 17 00:00:00 2001 From: Jeff Hanson Date: Fri, 5 Aug 2022 09:00:21 +1000 Subject: [PATCH] update github ci * update github ci --- .github/workflows/R-CMD-check-macos.yaml | 54 +++++---------- .github/workflows/R-CMD-check-ubuntu.yaml | 79 +++++++--------------- .github/workflows/R-CMD-check-windows.yaml | 51 +++++++------- .github/workflows/documentation.yaml | 56 ++++++--------- 4 files changed, 87 insertions(+), 153 deletions(-) diff --git a/.github/workflows/R-CMD-check-macos.yaml b/.github/workflows/R-CMD-check-macos.yaml index f458df3..1cb8688 100644 --- a/.github/workflows/R-CMD-check-macos.yaml +++ b/.github/workflows/R-CMD-check-macos.yaml @@ -37,42 +37,28 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-r@v1 - with: - r-version: ${{ matrix.config.r }} - - - uses: r-lib/actions/setup-pandoc@v1 - - - name: Query dependencies - 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} + - uses: r-lib/actions/setup-pandoc@v2 - - name: Cache R packages - if: runner.os != 'Windows' - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + r-version: ${{ matrix.config.r }} + use-public-rspm: true - name: Install system dependencies run: | brew install gmp brew install mpfr + brew install automake brew install gdal - brew upgrade --cask chromedriver - - name: Install dependencies - run: | - options("install.packages.compile.from.source" = "never") - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - remotes::install_cran("covr") - remotes::install_cran("curl", pkgType = "source") - shell: Rscript {0} + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + cache-version: 4 + extra-packages: | + any::rcmdcheck + any::XML + needs: | + check - name: Session information run: | @@ -81,19 +67,11 @@ jobs: sessioninfo::session_info(pkgs, include_base = TRUE) shell: Rscript {0} - - name: Check - run: | - rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--no-build-vignettes"), error_on = "warning", check_dir = "check") - shell: Rscript {0} + - 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: Upload check results - if: failure() - uses: actions/upload-artifact@main - with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check diff --git a/.github/workflows/R-CMD-check-ubuntu.yaml b/.github/workflows/R-CMD-check-ubuntu.yaml index 5f75b7d..a7b6089 100644 --- a/.github/workflows/R-CMD-check-ubuntu.yaml +++ b/.github/workflows/R-CMD-check-ubuntu.yaml @@ -18,14 +18,14 @@ jobs: R-CMD-check: runs-on: ${{ matrix.config.os }} - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) (${{ matrix.config.pkgs }} packages) + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) strategy: fail-fast: false matrix: config: - - {os: ubuntu-20.04, r: 'release', pkgs: 'all'} - - {os: ubuntu-20.04, r: 'devel', pkgs: 'all'} + - {os: ubuntu-20.04, r: 'release'} + - {os: ubuntu-20.04, r: 'devel'} - {os: ubuntu-20.04, r: 'devel', pkgs: 'depends only'} env: @@ -39,42 +39,28 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} + use-public-rspm: true - - uses: r-lib/actions/setup-pandoc@v1 - - - name: Query dependencies - 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 - if: runner.os != 'Windows' - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install system dependencies - if: runner.os == 'Linux' - run: | - sudo apt-get -y install libcurl4-openssl-dev libmpfr-dev libgmp3-dev libudunits2-dev libgdal-dev libgeos-dev libproj-dev - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - - name: Install dependencies + cache-version: 4 + extra-packages: | + any::covr + any::rcmdcheck + any::XML + prepr=?ignore + needs: | + check + coverage + + - name: Install spatial R packages run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - remotes::install_cran("covr") - remotes::install_cran("urlchecker") + pak::pkg_install("dickoa/prepr") shell: Rscript {0} - name: Session information @@ -84,22 +70,15 @@ jobs: sessioninfo::session_info(pkgs, include_base = TRUE) shell: Rscript {0} - - name: Set environmental variables for package checks + - name: Environmental variables if: matrix.config.pkgs == 'depends only' run: | echo "_R_CHECK_DEPENDS_ONLY_=true" >> $GITHUB_ENV - - name: Check - run: | - rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--no-build-vignettes"), error_on = "warning", check_dir = "check") - shell: Rscript {0} - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main + - uses: r-lib/actions/check-r-package@v2 with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check + args: 'c("--no-manual", "--as-cran", "--no-build-vignettes")' + upload-snapshots: true - name: Show testthat output if: always() @@ -110,13 +89,3 @@ jobs: if: runner.os == 'Linux' && matrix.config.r == 'release' run: covr::codecov() shell: Rscript {0} - - - name: Check URLs - if: runner.os == 'Linux' && matrix.config.r == 'release' - run: | - result <- urlchecker::url_check() - if (nrow(result) > 0) { - print(result) - stop("Invalid URLs detected") - } - shell: Rscript {0} diff --git a/.github/workflows/R-CMD-check-windows.yaml b/.github/workflows/R-CMD-check-windows.yaml index be4da68..c83b58a 100644 --- a/.github/workflows/R-CMD-check-windows.yaml +++ b/.github/workflows/R-CMD-check-windows.yaml @@ -35,27 +35,36 @@ jobs: CI: true steps: + # configure git to prevent it from automatically converting line-endings + # this is important to avoid WARNINGS during CRAN checks + # that are false-positives, see: + # https://msmith.de/2020/03/12/r-cmd-check-github-actions.html + - name: Configure git + run: git config --global core.autocrlf false + - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} + use-public-rspm: true - - uses: r-lib/actions/setup-pandoc@v1 - - - name: Query dependencies - 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} + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + cache-version: 4 + extra-packages: | + any::rcmdcheck + any::XML + prepr=?ignore + needs: | + check - - name: Install dependencies + - name: Install spatial R packages run: | - options("install.packages.compile.from.source" = "never", pkgType = "binary") - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - remotes::install_cran("covr") + install.packages("remotes") + remotes::install_github("dickoa/prepr") shell: Rscript {0} - name: Session information @@ -65,19 +74,11 @@ jobs: sessioninfo::session_info(pkgs, include_base = TRUE) shell: Rscript {0} - - name: Check - run: | - rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--no-build-vignettes"), error_on = "warning", check_dir = "check") - shell: Rscript {0} + - 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: Upload check results - if: failure() - uses: actions/upload-artifact@main - with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml index c998061..099b9b3 100644 --- a/.github/workflows/documentation.yaml +++ b/.github/workflows/documentation.yaml @@ -37,44 +37,35 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} + use-public-rspm: true - - uses: r-lib/actions/setup-pandoc@v1 - - - name: Query dependencies + - name: Install system dependencies 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} + sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable + sudo apt update + sudo apt-get install \ + libgdal-dev libgeos-dev libproj-dev \ + libgmp3-dev libmpfr-dev libudunits2-dev - - name: Cache R packages - if: runner.os != 'Windows' - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + cache-version: 4 + extra-packages: | + any::rcmdcheck + any::XML + any::urlchecker + prepr=?ignore + needs: | + check - - name: Install system dependencies + - name: Install spatial R packages run: | - sudo apt-get -y install \ - libcurl4-openssl-dev coinor-libsymphony-dev coinor-libcbc-dev coinor-libclp-dev \ - libudunits2-dev libgdal-dev libgeos-dev libproj-dev libglpk-dev - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - remotes::install_cran("covr") - remotes::install_bioc("lpsymphony") - remotes::install_cran("urlchecker") + pak::pkg_install("dickoa/prepr") shell: Rscript {0} - name: Session information @@ -84,11 +75,6 @@ jobs: sessioninfo::session_info(pkgs, include_base = TRUE) shell: Rscript {0} - - name: Set environmental variables for package checks - if: matrix.config.pkgs == 'depends only' - run: | - echo "_R_CHECK_DEPENDS_ONLY_=true" >> $GITHUB_ENV - - name: Check URLs if: runner.os == 'Linux' && matrix.config.r == 'release' run: |