Skip to content

Commit b495b0d

Browse files
authored
Clean up documentation, configuration, and CI following S2 version update (#263)
This PR: Cleans up the configure script to remove pathways that are no longer supported. Basically, pkg-config is required now (because resolving the linking order of the absl static libraries is absolutely insane without it). It also improves the error messages for various types of failures, although probably not all of them. Adds Docker images and a docker compose setup to ensure that the compile + test works based on the install instructions for various linux setups. Notably, it makes sure that it effectively uses system Abseil where available (e.g., debian testing, fedora >= 39, alpine), and that it does not use system Abseil of an insufficient version (e.g., all current Ubuntu, Fedora 36). Improves the CI jobs to effectively use system Abseil where possible (basically just MacOS). I added a bit of a "pre-check" job that, if it fails, will prevent the other long-running jobs from kicking off. This should give relatively rapid feedback for the feature development + test cycle (and not significantly delay changes related to the build). This PR does not fix R 4.0 and R 4.1 on Windows yet (battle for another day).
1 parent ece75d4 commit b495b0d

18 files changed

+305
-141
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
^tools/dist$
1717
^compile_commands\.json$
1818
^\.cache$
19+
^docker-compose\.yml$

.github/workflows/check-standard.yaml renamed to .github/workflows/R-CMD-check.yaml

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
22
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
33
on:
44
push:
@@ -8,19 +8,42 @@ on:
88

99
name: R-CMD-check
1010

11+
permissions: read-all
12+
1113
jobs:
14+
# Check MacOS first before embarking on the full check matrix
15+
test:
16+
runs-on: macos-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: r-lib/actions/setup-r@v2
20+
- name: Install Abseil (MacOS)
21+
run: brew install abseil
22+
- name: Install minimal dependencies
23+
run: |
24+
R -e 'install.packages(c("wk", "Rcpp", "bit64", "testthat"))'
25+
- name: Install
26+
run: |
27+
R CMD INSTALL .
28+
- name: Test
29+
run: |
30+
R -e 'testthat::test_local()'
31+
1232
R-CMD-check:
1333
runs-on: ${{ matrix.config.os }}
1434

1535
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
1636

37+
needs:
38+
- test
39+
1740
strategy:
1841
fail-fast: false
1942
matrix:
2043
config:
21-
- {os: macOS-latest, r: 'release'}
2244
# TODO: Solve Abseil linking issue on R 4.0 and R 4.1/Windows
2345
# - {os: windows-latest, r: '4.1'}
46+
- {os: macos-latest, r: 'release'}
2447
- {os: windows-latest, r: '4.2'}
2548
- {os: windows-latest, r: '4.3'}
2649
- {os: windows-latest, r: 'release'}
@@ -33,7 +56,7 @@ jobs:
3356
R_KEEP_PKG_SOURCE: yes
3457

3558
steps:
36-
- uses: actions/checkout@v2
59+
- uses: actions/checkout@v4
3760

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

@@ -43,25 +66,27 @@ jobs:
4366
http-user-agent: ${{ matrix.config.http-user-agent }}
4467
use-public-rspm: true
4568

69+
- name: Install Abseil (MacOS)
70+
if: matrix.config.os == 'macos-latest'
71+
run: |
72+
brew install abseil
73+
74+
- name: Set Makevars (Ubuntu)
75+
if: matrix.config.os == 'ubuntu-latest'
76+
run: |
77+
mkdir ~/.R && echo "MAKEFLAGS = -j$(nproc)" > ~/.R/Makevars
78+
4679
- uses: r-lib/actions/setup-r-dependencies@v2
4780
with:
48-
extra-packages: rcmdcheck
81+
extra-packages: any::rcmdcheck
82+
needs: check
4983

5084
- uses: r-lib/actions/check-r-package@v2
85+
with:
86+
upload-snapshots: true
87+
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
5188

5289
- name: Show install output
5390
if: always()
5491
run: find check -name '00install.out*' -exec cat '{}' \; || true
5592
shell: bash
56-
57-
- name: Show testthat output
58-
if: always()
59-
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
60-
shell: bash
61-
62-
- name: Upload check results
63-
if: failure()
64-
uses: actions/upload-artifact@main
65-
with:
66-
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
67-
path: check

.github/workflows/pkgdown.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111

1212
name: pkgdown
1313

14+
permissions: read-all
15+
1416
jobs:
1517
pkgdown:
1618
runs-on: ubuntu-latest
@@ -19,8 +21,10 @@ jobs:
1921
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
2022
env:
2123
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
24+
permissions:
25+
contents: write
2226
steps:
23-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v4
2428

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

@@ -39,7 +43,7 @@ jobs:
3943

4044
- name: Deploy to GitHub pages 🚀
4145
if: github.event_name != 'pull_request'
42-
uses: JamesIves/github-pages-deploy-action@4.1.4
46+
uses: JamesIves/github-pages-deploy-action@v4.5.0
4347
with:
4448
clean: false
4549
branch: gh-pages

.github/workflows/test-coverage.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
2-
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
31
on:
42
push:
53
branches: [main, master]
@@ -8,19 +6,25 @@ on:
86

97
name: test-coverage
108

9+
permissions: read-all
10+
1111
jobs:
1212
test-coverage:
1313
runs-on: ubuntu-latest
1414
env:
1515
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1616

1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v4
1919

2020
- uses: r-lib/actions/setup-r@v2
2121
with:
2222
use-public-rspm: true
2323

24+
- name: Install Abseil (Ubuntu)
25+
run: |
26+
sudo apt-get update && sudo apt-get install -y libabsl-dev
27+
2428
- uses: r-lib/actions/setup-r-dependencies@v2
2529
with:
2630
extra-packages: covr

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ License: Apache License (== 2.0)
2525
Encoding: UTF-8
2626
LazyData: true
2727
Roxygen: list(markdown = TRUE)
28-
RoxygenNote: 7.2.3
28+
RoxygenNote: 7.3.2
2929
SystemRequirements: OpenSSL >= 1.0.1, Abseil >= 20230802.0
3030
LinkingTo:
3131
Rcpp,

README.Rmd

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ knitr::opts_chunk$set(
1616
# s2
1717

1818
<!-- badges: start -->
19-
![R-CMD-check](https://github.com/r-spatial/s2/workflows/R-CMD-check/badge.svg)
20-
[![codecov](https://codecov.io/gh/r-spatial/s2/branch/master/graph/badge.svg)](https://app.codecov.io/gh/r-spatial/s2)
19+
[![R-CMD-check](https://github.com/r-spatial/s2/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-spatial/s2/actions/workflows/R-CMD-check.yaml)
20+
[![codecov](https://codecov.io/gh/r-spatial/s2/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-spatial/s2)
2121
[![CRAN](http://www.r-pkg.org/badges/version/s2)](https://cran.r-project.org/package=s2)
2222
[![Downloads](http://cranlogs.r-pkg.org/badges/s2?color=brightgreen)](https://www.r-pkg.org/pkg/s2)
2323
<!-- badges: end -->
2424

2525
The s2 R package provides bindings to Google's [S2Geometry](http://s2geometry.io) library. The package exposes an API similar to Google's [BigQuery Geography API](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions), whose functions also operate on spherical geometries. Package [sf](https://cran.r-project.org/package=sf) uses this package by default for nearly all its geometrical operations on objects with ellipsoidal (unprojected) coordinates; in cases where it doesn't, such as `st_relate()`, it emits a warning.
2626

27-
This package is a complete rewrite of an earlier CRAN package s2 with versions up
27+
This package is a complete rewrite of an earlier CRAN package s2 with versions up
2828
to 0.4-2, for which the sources are found [here](https://github.com/spatstat/s2/).
2929

3030
## Installation
@@ -42,6 +42,14 @@ And the development version from [GitHub](https://github.com/) with:
4242
remotes::install_github("r-spatial/s2")
4343
```
4444

45+
The S2 package requires [Abseil]() and OpenSSL. You can install these using a system package manager on most platforms:
46+
47+
- Windows: Both OpenSSL and Abseil are available from RTools since R 4.3
48+
- MacOS: `brew install openssl abseil`
49+
- Debian/Ubuntu: `apt-get install libssl-dev libabsl-dev`
50+
- Fedora: `dnf install openssl-devel abseil-cpp-devel`
51+
- Alpine: `apk add abseil-cpp`
52+
4553
## Example
4654

4755
The s2 package provides geometry transformers and predicates similar to those found in [GEOS](https://trac.osgeo.org/geos/), except instead of assuming a planar geometry, s2's functions work in latitude and longitude and assume a spherical geometry:
@@ -63,9 +71,9 @@ The [sf package](https://r-spatial.github.io/sf/) uses s2 for geographic coordin
6371
library(dplyr)
6472
library(sf)
6573
66-
nc_s2 <- read_sf(system.file("shape/nc.shp", package = "sf")) %>%
67-
mutate(geometry = as_s2_geography(geometry)) %>%
68-
as_tibble() %>%
74+
nc_s2 <- read_sf(system.file("shape/nc.shp", package = "sf")) %>%
75+
mutate(geometry = as_s2_geography(geometry)) %>%
76+
as_tibble() %>%
6977
select(NAME, geometry)
7078
7179
nc_s2
@@ -74,7 +82,7 @@ nc_s2
7482
Use accessors to extract information about geometries:
7583

7684
```{r}
77-
nc_s2 %>%
85+
nc_s2 %>%
7886
mutate(
7987
area = s2_area(geometry),
8088
perimeter = s2_perimeter(geometry)
@@ -84,29 +92,29 @@ nc_s2 %>%
8492
Use predicates to subset vectors:
8593

8694
```{r}
87-
nc_s2 %>%
95+
nc_s2 %>%
8896
filter(s2_contains(geometry, "POINT (-80.9313 35.6196)"))
8997
```
9098

9199
Use transformers to create new geometries:
92100

93101
```{r}
94-
nc_s2 %>%
102+
nc_s2 %>%
95103
mutate(geometry = s2_boundary(geometry))
96104
```
97105

98106
Finally, use the WKB or WKT exporters to export to sf or some other package:
99107

100108
```{r}
101-
nc_s2 %>%
102-
mutate(geometry = st_as_sfc(s2_as_binary(geometry))) %>%
109+
nc_s2 %>%
110+
mutate(geometry = st_as_sfc(s2_as_binary(geometry))) %>%
103111
st_as_sf()
104112
```
105113

106114
## Acknowledgment
107115

108-
This project gratefully acknowledges financial [support](https://www.r-consortium.org/projects) from the
116+
This project gratefully acknowledges financial [support](https://www.r-consortium.org/) from the
109117

110-
<a href="https://www.r-consortium.org/projects">
118+
<a href="https://www.r-consortium.org/">
111119
<img src="man/figures/rc300.png" width="300" />
112120
</a>

README.md

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
<!-- badges: start -->
77

8-
![R-CMD-check](https://github.com/r-spatial/s2/workflows/R-CMD-check/badge.svg)
9-
[![codecov](https://codecov.io/gh/r-spatial/s2/branch/master/graph/badge.svg)](https://app.codecov.io/gh/r-spatial/s2)
8+
[![R-CMD-check](https://github.com/r-spatial/s2/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-spatial/s2/actions/workflows/R-CMD-check.yaml)
9+
[![codecov](https://codecov.io/gh/r-spatial/s2/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-spatial/s2)
1010
[![CRAN](http://www.r-pkg.org/badges/version/s2)](https://cran.r-project.org/package=s2)
1111
[![Downloads](http://cranlogs.r-pkg.org/badges/s2?color=brightgreen)](https://www.r-pkg.org/pkg/s2)
1212
<!-- badges: end -->
@@ -41,6 +41,15 @@ And the development version from [GitHub](https://github.com/) with:
4141
remotes::install_github("r-spatial/s2")
4242
```
4343

44+
The S2 package requires [Abseil]() and OpenSSL. You can install these
45+
using a system package manager on most platforms:
46+
47+
- Windows: Both OpenSSL and Abseil are available from RTools since R 4.3
48+
- MacOS: `brew install openssl abseil`
49+
- Debian/Ubuntu: `apt-get install libssl-dev libabsl-dev`
50+
- Fedora: `dnf install openssl-devel abseil-cpp-devel`
51+
- Alpine: `apk add abseil-cpp`
52+
4453
## Example
4554

4655
The s2 package provides geometry transformers and predicates similar to
@@ -69,9 +78,9 @@ using `as_s2_geography()`:
6978
library(dplyr)
7079
library(sf)
7180

72-
nc_s2 <- read_sf(system.file("shape/nc.shp", package = "sf")) %>%
73-
mutate(geometry = as_s2_geography(geometry)) %>%
74-
as_tibble() %>%
81+
nc_s2 <- read_sf(system.file("shape/nc.shp", package = "sf")) %>%
82+
mutate(geometry = as_s2_geography(geometry)) %>%
83+
as_tibble() %>%
7584
select(NAME, geometry)
7685

7786
nc_s2
@@ -88,13 +97,13 @@ nc_s2
8897
#> 8 Gates POLYGON ((-76.46035 36.3738976, -76.5024643 36.4522858, -76.4983…
8998
#> 9 Warren POLYGON ((-78.1347198 36.2365837, -78.1096268 36.2135086, -78.05…
9099
#> 10 Stokes POLYGON ((-80.0240555 36.5450249, -80.0480957 36.5471344, -80.43…
91-
#> # … with 90 more rows
100+
#> # 90 more rows
92101
```
93102

94103
Use accessors to extract information about geometries:
95104

96105
``` r
97-
nc_s2 %>%
106+
nc_s2 %>%
98107
mutate(
99108
area = s2_area(geometry),
100109
perimeter = s2_perimeter(geometry)
@@ -112,13 +121,13 @@ nc_s2 %>%
112121
#> 8 Gates POLYGON ((-76.46035 36.3738976, -76.5024643 36.… 9.03e8 123170.
113122
#> 9 Warren POLYGON ((-78.1347198 36.2365837, -78.1096268 3… 1.18e9 141073.
114123
#> 10 Stokes POLYGON ((-80.0240555 36.5450249, -80.0480957 3… 1.23e9 140583.
115-
#> # … with 90 more rows
124+
#> # 90 more rows
116125
```
117126

118127
Use predicates to subset vectors:
119128

120129
``` r
121-
nc_s2 %>%
130+
nc_s2 %>%
122131
filter(s2_contains(geometry, "POINT (-80.9313 35.6196)"))
123132
#> # A tibble: 1 × 2
124133
#> NAME geometry
@@ -129,7 +138,7 @@ nc_s2 %>%
129138
Use transformers to create new geometries:
130139

131140
``` r
132-
nc_s2 %>%
141+
nc_s2 %>%
133142
mutate(geometry = s2_boundary(geometry))
134143
#> # A tibble: 100 × 2
135144
#> NAME geometry
@@ -144,15 +153,15 @@ nc_s2 %>%
144153
#> 8 Gates LINESTRING (-76.46035 36.3738976, -76.5024643 36.4522858, -76.49…
145154
#> 9 Warren LINESTRING (-78.1347198 36.2365837, -78.1096268 36.2135086, -78.…
146155
#> 10 Stokes LINESTRING (-80.0240555 36.5450249, -80.0480957 36.5471344, -80.…
147-
#> # … with 90 more rows
156+
#> # 90 more rows
148157
```
149158

150159
Finally, use the WKB or WKT exporters to export to sf or some other
151160
package:
152161

153162
``` r
154-
nc_s2 %>%
155-
mutate(geometry = st_as_sfc(s2_as_binary(geometry))) %>%
163+
nc_s2 %>%
164+
mutate(geometry = st_as_sfc(s2_as_binary(geometry))) %>%
156165
st_as_sf()
157166
#> Simple feature collection with 100 features and 1 field
158167
#> Geometry type: GEOMETRY
@@ -172,13 +181,13 @@ nc_s2 %>%
172181
#> 8 Gates POLYGON ((-76.46035 36.3739, -76.50246 36.45229, -76.49834 36.50…
173182
#> 9 Warren POLYGON ((-78.13472 36.23658, -78.10963 36.21351, -78.05835 36.2…
174183
#> 10 Stokes POLYGON ((-80.02406 36.54502, -80.0481 36.54713, -80.43531 36.55…
175-
#> # … with 90 more rows
184+
#> # 90 more rows
176185
```
177186

178187
## Acknowledgment
179188

180189
This project gratefully acknowledges financial
181-
[support](https://www.r-consortium.org/projects) from the
190+
[support](https://www.r-consortium.org/) from the
182191

183-
<a href="https://www.r-consortium.org/projects">
192+
<a href="https://www.r-consortium.org/">
184193
<img src="man/figures/rc300.png" width="300" /> </a>

0 commit comments

Comments
 (0)