Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated pkgdown GH action to run all examples #106

Merged
merged 2 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
GRASS_INSTALLATION: /usr/lib/grass83
GRASS_INSTALLATION: /usr/lib/grass78
permissions:
contents: write
steps:
Expand All @@ -35,7 +35,7 @@ jobs:
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y grass-dev libgdal-dev libudunits2-dev libharfbuzz-dev libfribidi-dev
sudo apt-get install -y grass libgdal-dev libudunits2-dev libharfbuzz-dev libfribidi-dev

- uses: r-lib/actions/setup-r-dependencies@v2
with:
Expand All @@ -48,12 +48,9 @@ jobs:
unzip /tmp/nc_basic_spm_grass7.zip -d /tmp/grassdb
rm /tmp/nc_basic_spm_grass7.zip

- name: Build site
- name: Build pkgdown site
run: |
gisBase <- system2("grass", "--config path", stdout = TRUE)
rgrass::initGRASS(gisBase = gisBase, gisDbase = "/tmp/grassdb", location = "nc_basic_spm_grass7", mapset = "PERMANENT")
pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE, run_dont_run = TRUE)
shell: Rscript {0}
grass /tmp/grassdb/nc_basic_spm_grass7/PERMANENT --exec sh -c "R -e 'pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE, run_dont_run = TRUE)'"

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
Expand Down
18 changes: 18 additions & 0 deletions R/initGRASS.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@
#' plot(r, col = terrain.colors(50))
#' }
#'
#' # Check for existing GRASS session running
#' if (run) {
#' loc_existing <- try(gmeta())
#' }
#'
#' if (run) {
#' # Initialize a temporary GRASS project using the example data
#' loc <- initGRASS(
Expand Down Expand Up @@ -142,6 +147,19 @@
#' u1 <- read_RAST(c("elev", "slope", "aspect"), return_format = "terra")
#' plot(u1[["elev"]], col = terrain.colors(50))
#' }
#'
#' # Restore the original GRASS session
#' if (run) {
#' if (!inherits(loc, "try-error")) {
#' loc <- initGRASS(
#' gisBase = GRASS_INSTALLATION,
#' gisDbase = loc_existing$GISDBASE,
#' location = loc_existing$LOCATION_NAME,
#' mapset = loc_existing$MAPSET,
#' override = TRUE
#' )
#' }
#' }
initGRASS <- function(
gisBase = NULL, home, SG, gisDbase, addon_base, location,
mapset, override = FALSE, use_g.dirseps.exe = TRUE, pid,
Expand Down
18 changes: 18 additions & 0 deletions man/initGRASS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading