-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable GH Actions CI/CD testing (#99)
Merging to start use of tests during CD. No changes to `rgrass` itself were made. This PR squashes several individual commits: * Add initial testthat suite * Setup test helper for mac and linux * Add gisBase to initGRASS * Use grassdb at /tmp * Add read_VECT test * Expand initGRASS tests to include gmeta * Add test for getLocationProj * Use GISBASE for MacOS helper * Update CRAN badge * Use ignore.stderr = TRUE in vector related tests * Add test coverage * Use r-lib/actions/setup-r@v2 in releasebranch * Use RSPM but build terra from source due to conflict with version from ubuntugis PPA * Expand matrix of grass docker images used in tests * Separate read_VECT and write_VECT in tests * Use SpatRaster instead of SGDF to test initGRASS * Add basic tests for execGRASS * Expanded initGRASS tests for locking * Unlink .gislock at end of test * Add tests for gmeta options * Add test for legacyExecOption * Add test for useInternOption * Add test for stop_on_no_flags_parasOption * Disable sp related tests until issue resolved in terms of sp::CRS on the GRASS GIS Docker release branch
- Loading branch information
1 parent
0de0394
commit 4b86ba8
Showing
18 changed files
with
895 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ _pkgdown.yml | |
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
^\.github$ | ||
^codecov\.yml$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
|
||
name: R-CMD-check | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
R-CMD-check: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-22.04, ubuntu-24.04] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- name: Install common system dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y grass-dev libgdal-dev libudunits2-dev libharfbuzz-dev libfribidi-dev | ||
- name: Download test dataset | ||
run: | | ||
wget https://grass.osgeo.org/sampledata/north_carolina/nc_basic_spm_grass7.zip -O /tmp/nc_basic_spm_grass7.zip | ||
unzip /tmp/nc_basic_spm_grass7.zip -d /tmp/grassdb | ||
rm /tmp/nc_basic_spm_grass7.zip | ||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::rcmdcheck, any::terra | ||
needs: check | ||
|
||
- uses: r-lib/actions/check-r-package@v2 | ||
with: | ||
upload-snapshots: true | ||
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
|
||
name: releasebranch_8_4-ubuntu | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
R-CMD-check-releasebranch: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
container: [ | ||
"osgeo/grass-gis:releasebranch_8_4-ubuntu", | ||
"osgeo/grass-gis:main-ubuntu" | ||
] | ||
|
||
container: | ||
image: ${{ matrix.container }} | ||
options: --privileged | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install system deps | ||
run: | | ||
apt-get update | ||
apt-get install -y \ | ||
libudunits2-dev \ | ||
libharfbuzz-dev \ | ||
libfribidi-dev \ | ||
gdal-bin \ | ||
libmysqlclient-dev \ | ||
libfontconfig1-dev \ | ||
qpdf \ | ||
pandoc \ | ||
pandoc-citeproc | ||
- name: Install R | ||
run: | | ||
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc | ||
echo "deb https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/" | tee -a /etc/apt/sources.list | ||
apt-get update | ||
apt-get install -y r-base-dev | ||
- name: Configure RSPM in .Renviron | ||
run: | | ||
echo 'options(repos = c(CRAN = "https://packagemanager.posit.co/cran/__linux__/jammy/latest"))' >> ~/.Rprofile | ||
echo 'options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version["platform"], R.version["arch"], R.version["os"])))' >> ~/.Rprofile | ||
echo 'options(Ncpus=parallel::detectCores())' >> ~/.Rprofile | ||
- name: Install R dependencies | ||
run: | | ||
R -e "install.packages(c('remotes', 'rcmdcheck'))" | ||
R -e "remotes::install_deps(dependencies = TRUE)" | ||
R -e "install.packages('terra', repos = 'https://cloud.r-project.org/', type = 'source')" | ||
- name: Download test dataset | ||
run: | | ||
wget https://grass.osgeo.org/sampledata/north_carolina/nc_basic_spm_grass7.zip -O /tmp/nc_basic_spm_grass7.zip | ||
unzip /tmp/nc_basic_spm_grass7.zip -d /tmp/grassdb | ||
rm /tmp/nc_basic_spm_grass7.zip | ||
# - name: Run R CMD check | ||
# run: | | ||
# R -e "rcmdcheck::rcmdcheck(args = c('--no-manual', '--no-build-vignettes'), error_on = 'error', check_dir = 'check')" | ||
|
||
- uses: r-lib/actions/check-r-package@v2 | ||
with: | ||
upload-snapshots: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
|
||
name: test-coverage.yaml | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
test-coverage: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- name: Install common system dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y grass-dev libgdal-dev libudunits2-dev libharfbuzz-dev libfribidi-dev | ||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::covr, any::xml2, any::terra | ||
needs: coverage | ||
|
||
- name: Test coverage | ||
run: | | ||
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} | ||
|
||
- 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 }} | ||
|
||
- name: Show testthat output | ||
if: always() | ||
run: | | ||
## -------------------------------------------------------------------- | ||
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true | ||
shell: bash | ||
|
||
- name: Upload test results | ||
if: failure() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-test-failures | ||
path: ${{ runner.temp }}/package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
comment: false | ||
|
||
coverage: | ||
status: | ||
project: | ||
default: | ||
target: auto | ||
threshold: 1% | ||
informational: true | ||
patch: | ||
default: | ||
target: auto | ||
threshold: 1% | ||
informational: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file is part of the standard setup for testthat. | ||
# It is recommended that you do not modify it. | ||
# | ||
# Where should you do additional test configuration? | ||
# Learn more about the roles of various files in: | ||
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview | ||
# * https://testthat.r-lib.org/articles/special-files.html | ||
|
||
library(testthat) | ||
library(rgrass) | ||
|
||
test_check("rgrass") |
Oops, something went wrong.