Skip to content

qgis_cache_dir(): avoid warning when dir non-existing #464

qgis_cache_dir(): avoid warning when dir non-existing

qgis_cache_dir(): avoid warning when dir non-existing #464

Workflow file for this run

# 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:
branches:
- master
- main
pull_request:
schedule:
- cron: '0 3 * * 4'
name: R-CMD-check
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }}${{ matrix.config.dep }}, ${{ matrix.config.qgis }})
strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, qgis: 'none', r: 'release', dep: '', r-pkg-cache: 'v0'}
- {os: macOS-latest, qgis: 'macos-brew', r: 'release', dep: '', r-pkg-cache: 'v0'}
- {os: windows-latest, qgis: 'windows-chocolatey', r: 'release', dep: '', r-pkg-cache: 'v0'}
- {os: windows-latest, qgis: 'windows-chocolatey', r: 'devel', dep: '', r-pkg-cache: 'v2'}
- {os: ubuntu-22.04, qgis: 'ubuntu-nightly', r: 'release', dep: '', r-pkg-cache: 'v0'}
- {os: ubuntu-22.04, qgis: 'ubuntu-nightly', r: 'devel', dep: '', r-pkg-cache: 'v2'}
- {os: ubuntu-22.04, qgis: 'ubuntugis', r: 'release', dep: '', r-pkg-cache: 'v1'}
- {os: ubuntu-22.04, qgis: 'ubuntu', r: 'release', dep: '', r-pkg-cache: 'v0'}
- {os: ubuntu-22.04, qgis: 'ubuntu', r: 'release', dep: ' [hard-deps]', r-pkg-cache: 'v3'}
- {os: ubuntu-22.04, qgis: 'ubuntu-ltr', r: 'release', dep: '', r-pkg-cache: 'v0'}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
SAGANGV: 0.0.7
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-pandoc@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
extra-repositories: https://geocompr.r-universe.dev
- name: Prepare Ubuntu for installing QGIS (common code)
if: runner.os == 'Linux'
run: |
# Prepare Ubuntu for installing QGIS (common code)
echo "::group::Dynamically set QGIS_PLUGINPATH environment var (available to next steps)"
mkdir ../extra_plugins
echo "QGIS_PLUGINPATH=$(pwd)/../extra_plugins" >> $GITHUB_ENV
echo "::endgroup::"
echo "::group::Install the QGIS Signing Key"
sudo wget -qO /etc/apt/keyrings/qgis-archive-keyring.gpg https://download.qgis.org/downloads/qgis-archive-keyring.gpg
echo "::endgroup::"
- name: Add repo to install QGIS development version for Ubuntu
if: matrix.config.qgis == 'ubuntu-nightly'
run: |
# Add repo to install QGIS development version for Ubuntu (using an often outdated GRASS release from Ubuntu repo)
sudo sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/qgis-archive-keyring.gpg] https://qgis.org/ubuntu-nightly `lsb_release -c -s` main" > /etc/apt/sources.list.d/qgis.list'
- name: Add repos to install upcoming QGIS point release for Ubuntugis (becoming latest release in < 1 month)
if: matrix.config.qgis == 'ubuntugis'
run: |
# Add repos to install upcoming QGIS point release (becoming latest release in < 1 month) for Ubuntugis (ubuntugis-unstable PPA, with current GRASS release)
sudo mkdir -p /root/.gnupg
sudo chmod 700 /root/.gnupg
sudo gpg --no-default-keyring --keyring /etc/apt/keyrings/ubuntugis-unstable-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 6B827C12C2D425E227EDCA75089EBE08314DF160
sudo sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/ubuntugis-unstable-archive-keyring.gpg] http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu `lsb_release -c -s` main" > /etc/apt/sources.list.d/ubuntugis-unstable.list'
sudo sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/qgis-archive-keyring.gpg] https://qgis.org/ubuntugis-nightly-release `lsb_release -c -s` main" > /etc/apt/sources.list.d/qgis.list'
- name: Add repo to install latest QGIS release for Ubuntu
if: matrix.config.qgis == 'ubuntu'
run: |
# Add repo to install latest QGIS release for Ubuntu (using an often outdated GRASS release from Ubuntu repo)
sudo sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/qgis-archive-keyring.gpg] https://qgis.org/ubuntu `lsb_release -c -s` main" > /etc/apt/sources.list.d/qgis.list'
- name: Add repo to install QGIS LTR (long-term release) for Ubuntu
if: matrix.config.qgis == 'ubuntu-ltr'
run: |
# Add repo to install QGIS LTR (long-term release) for Ubuntu (using an often outdated GRASS release from Ubuntu repo)
sudo sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/qgis-archive-keyring.gpg] https://qgis.org/ubuntu-ltr `lsb_release -c -s` main" > /etc/apt/sources.list.d/qgis.list'
- name: Install QGIS, GRASS, SAGA and the SAGA NextGen plugin (Ubuntu) from preset repos
if: runner.os == 'Linux'
run: |
# Install QGIS, GRASS, SAGA and the SAGA NextGen plugin (Ubuntu) from preset repos
sudo apt-get update
sudo apt-get install -y qgis qgis-plugin-grass saga
wget -qO ../sagang_plugin.zip https://plugins.qgis.org/plugins/processing_saga_nextgen/version/$SAGANGV/download/
unzip -q ../sagang_plugin.zip -d ../extra_plugins
- name: Install QGIS (MacOS homebrew)
if: matrix.config.qgis == 'macos-brew'
run: |
brew install --cask qgis
# installs last nightly build of QGIS
# works locally, hangs on GHA after download
# leaving this out until can figure out how to run reliably
- name: Install QGIS (MacOS nightly)
if: matrix.config.qgis == 'macos-nightly'
run: |
# Setup QGIS from MacOS nightly
curl https://qgis.org/downloads/macos/qgis-macos-nightly.dmg --output qgis-macos-nightly.dmg
yes | hdiutil attach -nobrowse -noverify -mountpoint qgis qgis-macos-nightly.dmg > /dev/null
sudo cp -R qgis/QGIS.app /Applications
- name: Install QGIS (Windows chocolatey)
if: matrix.config.qgis == 'windows-chocolatey'
uses: crazy-max/ghaction-chocolatey@v2
with:
args: install qgis
- name: Query R dependencies and report available versions
id: query
if: matrix.config.dep == ''
run: |
# Query R dependencies and report available versions
cat("::group::Install pak\n")
install.packages("pak", repos = "https://r-lib.github.io/p/pak/stable/")
cat("::endgroup::\n")
cat("::group::Create minimal data frame with pkg deps and store them\n")
depends <- pak::pkg_deps(c("deps::.", "any::sessioninfo", "any::rcmdcheck", "any::covr", "any::commonmark", "any::xml2"), dependencies = c("Config/Needs/check", "all"))[, c("ref", "version")]
depends <- depends[depends$ref != "deps::.", ]
saveRDS(depends, ".github/depends.Rds")
cat("::endgroup::\n")
cat("::group::Store R-version\n")
cat("r-version=", sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
cat("::endgroup::\n")
cat("::group::Print results\n")
cat("R version:", sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), "\n")
print(as.data.frame(depends), row.names = FALSE)
cat("::endgroup::\n")
shell: Rscript {0}
- name: Restore (or define new) R package cache
if: matrix.config.dep == ''
uses: actions/cache@v3
with:
path: |
${{ env.R_LIBS_USER }}/*
!${{ env.R_LIBS_USER }}/pak
key: ${{ matrix.config.os }}-${{ steps.query.outputs.r-version }}-${{ matrix.config.r-pkg-cache }}-${{ hashFiles('.github/depends.Rds') }}
- name: Install missing package dependencies
if: matrix.config.dep == ''
run: |
# Install missing package dependencies
cat("::group::Install\n")
pak::pkg_install(c("deps::.", "any::sessioninfo", "any::rcmdcheck", "any::covr", "any::commonmark", "any::xml2"), upgrade = FALSE, dependencies = c("Config/Needs/check", "all"))
# This is based on the minimum needed version, not the hash of what is available at RSPM
cat("::endgroup::\n")
cat("::group::Session info\n")
sessioninfo::session_info(pkgs = "installed", include_base = TRUE)
cat("::endgroup::\n")
shell: Rscript {0}
# raster, sf, terra and lwgeom from RSPM use older sysdeps than ubuntugis
- name: In the ubuntugis job, reinstall some pkgs from source if needed
if: matrix.config.qgis == 'ubuntugis'
run: |
# Rebuild and install sf, terra etc. if the RSPM binaries (or cached pkgs) don't load
cat("::group::sf\n")
if (!requireNamespace("sf", quietly = TRUE)) {
install.packages("sf", repos = "https://cloud.r-project.org")
}
cat("::endgroup::\n")
cat("::group::terra\n")
if (!requireNamespace("terra", quietly = TRUE)) {
install.packages("terra", repos = "https://cloud.r-project.org")
}
cat("::endgroup::\n")
cat("::group::raster\n")
if (!requireNamespace("raster", quietly = TRUE)) {
install.packages("raster", repos = "https://cloud.r-project.org")
}
cat("::endgroup::\n")
cat("::group::lwgeom (needed by stars)\n")
if (!requireNamespace("lwgeom", quietly = TRUE)) { # needed for stars
install.packages("lwgeom", repos = "https://cloud.r-project.org")
}
cat("::endgroup::\n")
cat("::group::Session info\n")
sessioninfo::session_info(pkgs = "installed", include_base = TRUE)
cat("::endgroup::\n")
shell: Rscript {0}
- name: Install hard R pkg dependencies only
if: matrix.config.dep == ' [hard-deps]'
uses: r-lib/actions/setup-r-dependencies@v2
with:
dependencies: '"hard"'
cache: false
extra-packages: |
any::rcmdcheck
any::testthat
any::knitr
any::rmarkdown
needs: check
- uses: r-lib/actions/check-r-package@v2
# run with CMD check because installing QGIS is expensive
- name: Test Coverage
if: matrix.config.qgis == 'ubuntu' && matrix.config.dep == ''
run: |
# Setup code coverage with Codecov
covr::codecov(quiet = FALSE)
shell: Rscript {0}
- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
- name: Show platform-info output
if: always()
run: find check -name 'platform-info.Rout*' -exec cat '{}' \; || true
shell: bash
- name: Upload check results
if: failure()
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.os }}_r-${{ matrix.config.r }}_qgis-${{ matrix.config.qgis }}_results
path: check