Skip to content

Commit

Permalink
updated actions and pkgdown config
Browse files Browse the repository at this point in the history
  • Loading branch information
dhersz committed Jan 17, 2025
1 parent 24df767 commit 3fa6639
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 189 deletions.
74 changes: 14 additions & 60 deletions .github/workflows/R-CMD-check-CRAN.yaml
Original file line number Diff line number Diff line change
@@ -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 }})
Expand All @@ -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
53 changes: 9 additions & 44 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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
58 changes: 11 additions & 47 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,37 @@ on:
paths:
- r-package/**
- README.md
- .github/workflows/pkgdown.yaml
branches:
- master

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

- uses: r-lib/actions/setup-r@v2

- 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 "[email protected]"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(pkg = "./r-package", new_process = FALSE)'
git config --local user.email "[email protected]"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
working-directory: r-package
58 changes: 22 additions & 36 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 5 additions & 2 deletions r-package/pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
destination: ../docs
url: https://ipeagit.github.io/r5r/

template:
bootstrap: 5
light-switch: true

development:
mode: auto
Expand Down Expand Up @@ -40,4 +44,3 @@ reference:
- r5r_cache
- download_r5
- stop_r5

0 comments on commit 3fa6639

Please sign in to comment.