diff --git a/.github/workflows/R-CMD-check-CRAN.yaml b/.github/workflows/R-CMD-check-CRAN.yaml index f8b39f8a..fd14df13 100644 --- a/.github/workflows/R-CMD-check-CRAN.yaml +++ b/.github/workflows/R-CMD-check-CRAN.yaml @@ -1,19 +1,23 @@ +# 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: paths: - r-package/** branches: - master + - dev pull_request: paths: - r-package/** branches: - master + - dev -name: check_as_cran +name: R-CMD-check-CRAN jobs: - check_as_cran: + R-CMD-check: runs-on: ${{ matrix.config.os }} name: ${{ matrix.config.os }} (${{ matrix.config.r }}) @@ -32,70 +36,20 @@ jobs: - uses: actions/checkout@v2 - uses: r-lib/actions/setup-r@v2 - id: install-r with: r-version: ${{ matrix.config.r }} - http-user-agent: ${{ matrix.config.http-user-agent }} - uses: r-lib/actions/setup-pandoc@v2 - - name: Install pak and query dependencies - run: | - install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") - saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds") - shell: Rscript {0} - working-directory: r-package - - - name: Restore R package cache - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: | - ${{ env.R_LIBS_USER }}/* - !${{ env.R_LIBS_USER }}/pak - key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }} - restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1- - - - name: Install system dependencies (Linux) - if: runner.os == 'Linux' - run: | - pak::local_system_requirements(execute = TRUE) - pak::pkg_system_requirements("rcmdcheck", execute = TRUE) - shell: Rscript {0} - working-directory: r-package - - - name: Install dependencies - run: | - pak::local_install_dev_deps(upgrade = TRUE) - pak::pkg_install("rcmdcheck") - shell: Rscript {0} - working-directory: r-package - - - name: Session info - run: | - options(width = 100) - pkgs <- installed.packages()[, "Package"] - sessioninfo::session_info(pkgs, include_base = TRUE) - shell: Rscript {0} - working-directory: r-package + extra-packages: any::rcmdcheck + needs: check + working-directory: r-package - - name: Check + - uses: r-lib/actions/check-r-package@v2 + with: + working-directory: r-package env: - _R_CHECK_CRAN_INCOMING_: false + _R_CHECK_CRAN_INCOMING_REMOTE_: false NOT_CRAN: false - run: | - options(crayon.enabled = TRUE) - rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") - shell: Rscript {0} - working-directory: r-package - - - 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: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results - path: check diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index effcad2e..5b7c998f 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,5 +1,3 @@ -# 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: paths: @@ -27,69 +25,36 @@ jobs: matrix: config: - {os: windows-latest, r: 'release'} - - {os: windows-latest, r: 'oldrel'} - {os: macOS-latest, r: 'release'} - - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - {os: ubuntu-20.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-22.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"} + - {os: ubuntu-22.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"} + - {os: ubuntu-22.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"} env: - 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-pandoc@v2 + - uses: actions/checkout@v2 - uses: r-lib/actions/setup-r@v2 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 - name: Java setup - uses: actions/setup-java@v2 + uses: actions/setup-java@v1 with: - distribution: 'temurin' java-version: '21' - - - 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} - working-directory: r-package - - - name: Cache R packages - if: runner.os != 'Windows' - uses: actions/cache@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 (Linux) - if: runner.os == 'Linux' - run: brew install gdal proj - working-directory: r-package - - - name: Install macOS system dependencies - if: runner.os == 'macos' - run: brew install gdal proj - working-directory: r-package - + java-package: jdk - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: any::rcmdcheck needs: check - working-directory: r-package + working-directory: r-package - uses: r-lib/actions/check-r-package@v2 with: - upload-snapshots: true - + working-directory: r-package diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index eb47f58d..6ebf809a 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -3,7 +3,6 @@ on: paths: - r-package/** - README.md - - .github/workflows/pkgdown.yaml branches: - master @@ -11,9 +10,8 @@ name: pkgdown jobs: pkgdown: - runs-on: ubuntu-20.04 - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + runs-on: ubuntu-22.04 + steps: - uses: actions/checkout@v2 @@ -21,55 +19,21 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 - - name: Java setup - uses: actions/setup-java@v1 - with: - java-version: '21' - java-package: jdk - - - 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} - working-directory: r-package - - - name: Cache R packages - uses: actions/cache@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 - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - sudo apt install libharfbuzz-dev libfribidi-dev - working-directory: r-package - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - install.packages("pkgdown") - shell: Rscript {0} - working-directory: r-package - - name: Copy README.md to r-package/index.md run: cp README.md r-package/index.md - name: Update r-package/index.md figures source run: sed -i 's/\"r-package\//\"/g' r-package/index.md - - name: Install package - run: R CMD INSTALL . - working-directory: r-package + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + working-directory: r-package - - name: Deploy package + - name: Build and deploy pkgdown site run: | - git config --local user.email "actions@github.com" git config --local user.name "GitHub Actions" - Rscript -e 'pkgdown::deploy_to_branch(pkg = "./r-package", new_process = FALSE)' + git config --local user.email "actions@github.com" + Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' + working-directory: r-package diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 7c192010..aa325894 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -4,68 +4,54 @@ on: - r-package/** branches: - dev - - main - master pull_request: paths: - r-package/** branches: - dev - - main - master name: test-coverage jobs: test-coverage: - runs-on: ubuntu-20.04 - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + runs-on: ubuntu-22.04 + steps: - uses: actions/checkout@v2 - uses: r-lib/actions/setup-r@v2 - - uses: r-lib/actions/setup-pandoc@v1 - - name: Java setup uses: actions/setup-java@v1 with: java-version: '21' java-package: jdk - - 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} - working-directory: r-package - - - name: Cache R packages - 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 - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - working-directory: r-package + extra-packages: any::covr, any::xml2 + needs: coverage + working-directory: r-package - - name: Install dependencies + - name: Test coverage run: | - install.packages(c("remotes")) - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("covr") + cov <- covr::package_coverage( + quiet = FALSE, + clean = FALSE, + install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") + ) + covr::to_cobertura(cov) shell: Rscript {0} working-directory: r-package - - name: Test coverage - run: covr::codecov() - shell: Rscript {0} - working-directory: r-package + - uses: codecov/codecov-action@v4 + with: + # Fail if error if not on PR, or if on PR and token is given + fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }} + file: ./cobertura.xml + plugin: noop + disable_search: true + token: ${{ secrets.CODECOV_TOKEN }} + working-directory: r-package diff --git a/r-package/pkgdown/_pkgdown.yml b/r-package/pkgdown/_pkgdown.yml index c337fe49..7eed703b 100644 --- a/r-package/pkgdown/_pkgdown.yml +++ b/r-package/pkgdown/_pkgdown.yml @@ -1,4 +1,8 @@ -destination: ../docs +url: https://ipeagit.github.io/r5r/ + +template: + bootstrap: 5 + light-switch: true development: mode: auto @@ -40,4 +44,3 @@ reference: - r5r_cache - download_r5 - stop_r5 -