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

Enable GH Actions CI/CD testing #99

Merged
merged 20 commits into from
Jan 1, 2025
Merged

Conversation

stevenpawley
Copy link
Member

Purpose

Create GH actions workflows for CI/CD testing of rgrass. This is initially based on Ubuntu only, but the idea is to expand later to include other platforms.

Summary

Three GH action workflows were created:

  • R-CMD-check runs the test suite using testthat on a matrix of Ubuntu LTS versions (currently 22.04 and 24.04) using the versions of GRASS GIS that are packaged by these distributions. This workflow can be expanded with conditions to include other platforms later.
  • test-coverage performs a test coverage assessment using covr on ubuntu-latest.
  • check-releasebranch runs the test suite against the official GRASS Docker images.

R package dependencies are installed from RSPM except terra, which is built from source due to conflict with GDAL coming from the ubuntugis PPA that is used in the docker images.

Completeness

Initial test suite has ~60% code coverage (with the aim to increase this later). However, with tests relating to sp disabled (see below), coverage is currently 50%.

Tests that read GRASS rasters as SpatialGridDataFrame using sp are currently disabled for CRAN and CI because sp does not interpret the WTK string in some cases. This occurs specifically in the getLocationProj function, which is also used by read_RAST at sp::CRS(gLP) where gLP is the WTK output from GRASS in the rgrass:::.read_rast_non_plugin_ng(...) function. There is no problem when using terra::crs(gLP). This may relate to edzer/sp#111.

Other changes

No changes were made to the R package itself (other than some minor formatting/spaces).

update test helper

add gisBase to initGRASS

Fix logic in skip_if_not

add skip_if_not to tests

fix tests due to base R levels

use grassdb at /tmp
Update CRAN badge and simplify test helper
Revert "use r-lib/actions/setup-r@v2 in releasebranch"

This reverts commit 8cb701b.

use RSPM but build terra from source due to conflict with version from ubuntugis PPA
unlink .gislock at end of test

test changing mapset
add test for legacyExecOption

restore defaults for test-options to avoid side effects

add test for useInternOption

add test for stop_on_no_flags_parasOption
@rsbivand rsbivand self-requested a review December 30, 2024 22:00
@rsbivand
Copy link
Collaborator

A couple of review questions:

  1. Does covr know that most of the code is exercised in the examples?
  2. Where in the CI setup does GRASS get started with the nc_basic_spm_grass7 location? If GRASS is not running in that location, none of the examples get run.
  3. Does the environment variable GRASS_INSTALLATION get set in CI to process the use vignette?
  4. Using terra::crs in place of sp::CRS is a good idea whereever possible. Most cases of WKT output not working are when there are multiple versions of proj.db on the system, I think.

Copy link
Collaborator

@rsbivand rsbivand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments in PR, I forgot I needed to re-load the browser page to generate the review link.

@stevenpawley
Copy link
Member Author

Thanks for the comments - some follow-up below:

  1. covr does not consider examples in terms of its coverage - it's based only on the tests in the tests folder.
  2. For the tests specifically, the nc_basic_spm_grass7 location is downloaded as part of the GitHub Actions workflow. However, I didn't alter any examples in this PR so that they actually run on R CMD check (i.e., they get past conditionals for the GRASS location). Ideally this should occur for at least some of them but see below.
  3. The current PR is just for the test suite. Although setting the GRASS_INSTALLATION environment variable in the CI would allow examples that use only a temporary location to run during R CMD check, the only example that would run is a single example in initGRASS. It probably should be another PR and will need to consider the options, i.e., alter the examples so they all use a temporary location (and make use of datasets in terra), or download nc_basic to tempdir (probably too slow)?
  4. This one caused me some confusion because I think that the tests passed when run on plain Ubuntu 22.04 and 24.04 images using the packaged GRASS versions but failed on the GRASS Docker images. It might relate to the GRASS Docker images using the ubuntugis-unstable PPA.

@stevenpawley stevenpawley merged commit 4b86ba8 into OSGeo:main Jan 1, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants