Skip to content

Commit

Permalink
updated r actions and pkgdown config
Browse files Browse the repository at this point in the history
  • Loading branch information
dhersz committed Jan 21, 2025
1 parent 2ba39b7 commit fbb83ed
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 184 deletions.
55 changes: 11 additions & 44 deletions .github/workflows/R-CMD-check-CRAN.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# 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/**
- .github/workflows/R-CMD-check-CRAN.yaml
branches:
- master
- dev
pull_request:
paths:
- r-package/**
- .github/workflows/R-CMD-check-CRAN.yaml
branches:
- master
- dev

name: R-CMD-check-as-CRAN
name: R-CMD-check-CRAN

jobs:
R-CMD-check:
Expand All @@ -26,10 +26,9 @@ jobs:
fail-fast: false
matrix:
config:
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-22.04, r: 'release', 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 }}

Expand All @@ -42,47 +41,15 @@ jobs:

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

- 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

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
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_REMOTE_: false
NOT_CRAN: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
working-directory: r-package

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
69 changes: 11 additions & 58 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# 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/**
- .github/workflows/R-CMD-check.yaml
branches:
- main
- master
- dev
pull_request:
paths:
- r-package/**
- .github/workflows/R-CMD-check.yaml
branches:
- main
- master
- dev

Expand All @@ -29,15 +27,12 @@ jobs:
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: 'oldrel'}
- {os: macOS-latest, r: 'release'}
# - {os: macOS-latest, r: 'oldrel'}
- {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 }}

Expand All @@ -50,54 +45,12 @@ jobs:

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

- 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
- 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 (Linux)
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
working-directory: r-package

- name: Install system dependencies (MacOS)
if: runner.os == 'macOS'
run: |
brew install pkg-config gdal proj geos
working-directory: r-package

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}
working-directory: r-package

- 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}
working-directory: r-package
extra-packages: any::rcmdcheck
needs: check
working-directory: r-package

- 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
working-directory: r-package
57 changes: 19 additions & 38 deletions .github/workflows/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,40 @@
on:
push:
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: 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: Copy README.md to r-package/index.md
run: cp README.md r-package/index.md

- 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: Update r-package/index.md figures source
run: sed -i 's/\"r-package\//\"/g' r-package/index.md

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
install.packages("pkgdown")
shell: Rscript {0}
working-directory: r-package

- 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, examples = FALSE)'
git config --local user.email "actions@github.com"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
working-directory: r-package
61 changes: 25 additions & 36 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,50 @@ on:
- r-package/**
- .github/workflows/test-coverage.yaml
branches:
- main
- dev
- master
pull_request:
paths:
- r-package/**
- .github/workflows/test-coverage.yaml
branches:
- main
- dev
- master

name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-18.04
env:
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2

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

- 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: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-
extra-packages: any::covr, any::xml2
needs: coverage
working-directory: r-package

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
pak::local_system_requirements(execute = TRUE)
pak::pkg_system_requirements("covr", execute = TRUE)
shell: Rscript {0}
working-directory: r-package

- name: Install dependencies
- name: Test coverage
run: |
pak::local_install_dev_deps(upgrade = TRUE)
pak::pkg_install("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(quiet = FALSE)
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
13 changes: 5 additions & 8 deletions r-package/pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
destination: ./docs
url: https://ipeagit.github.io/geobr/

template:
bootstrap: 5
light-switch: true

development:
mode: auto


repo:
url:
home: https://github.com/ipeaGIT/geobr/
source: https://github.com/ipeaGIT/geobr/tree/master/


reference:
- title: "Political administrative"
- contents:
Expand Down

0 comments on commit fbb83ed

Please sign in to comment.