From d076bc23cdbc12a6d46968d84655e267ed2be301 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Thu, 25 Sep 2025 00:00:34 +0900 Subject: [PATCH 1/5] Use bootstrap.R --- .github/workflows/r.yml | 12 ++++------ r/sedonadb/DESCRIPTION | 3 ++- r/sedonadb/README.Rmd | 6 ++--- r/sedonadb/README.md | 6 ++--- r/sedonadb/bootstrap.R | 52 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 63 insertions(+), 16 deletions(-) create mode 100644 r/sedonadb/bootstrap.R diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index f9ef4d2b..4d036502 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -91,10 +91,8 @@ jobs: needs: check working-directory: r/sedonadb - - name: Install R Package - run: | - R CMD INSTALL r/sedonadb --preclean - - - name: Test R Package - run: | - R -e 'library(testthat); test_local("r/sedonadb", MultiReporter$new(list(CheckReporter$new(), LocationReporter$new())))' + - uses: r-lib/actions/check-r-package@v2 + with: + args: 'c("--no-manual")' # no --as-cran + upload-snapshots: true + working-directory: r/sedonadb diff --git a/r/sedonadb/DESCRIPTION b/r/sedonadb/DESCRIPTION index 51673914..f550038b 100644 --- a/r/sedonadb/DESCRIPTION +++ b/r/sedonadb/DESCRIPTION @@ -17,7 +17,8 @@ Suggests: testthat (>= 3.0.0), withr, wk -Config/testthat/edition: 3 Imports: geoarrow, nanoarrow +Config/testthat/edition: 3 +Config/build/bootstrap: TRUE diff --git a/r/sedonadb/README.Rmd b/r/sedonadb/README.Rmd index 5b9a784d..bf18f8b5 100644 --- a/r/sedonadb/README.Rmd +++ b/r/sedonadb/README.Rmd @@ -42,10 +42,8 @@ The goal of sedonadb is to provide an R interface to [Apache SedonaDB](https://s You can install the development version of sedonadb from [GitHub](https://github.com/) with: -``` shell -git clone https://github.com/apache/sedona-db.git -cd sedona-db/r/sedonadb -R CMD INSTALL . +``` r +pak::pkg_install("apache/sedona-db/r/sedonadb") ``` Installing a development version of sedonadb requires a [Rust compiler](https://rustup.rs) and a GEOS system dependency (e.g., `brew install geos` or `apt-get install libgeos-dev`). Install instructions for these dependencies on other platforms can be found on the [sf package homepage](https://r-spatial.github.io/sf). diff --git a/r/sedonadb/README.md b/r/sedonadb/README.md index 20bc812e..6f8dd822 100644 --- a/r/sedonadb/README.md +++ b/r/sedonadb/README.md @@ -33,10 +33,8 @@ SQL with high function coverage and GeoParquet IO. You can install the development version of sedonadb from [GitHub](https://github.com/) with: -``` shell -git clone https://github.com/apache/sedona-db.git -cd sedona-db/r/sedonadb -R CMD INSTALL . +``` r +pak::pkg_install("apache/sedona-db/r/sedonadb") ``` Installing a development version of sedonadb requires a [Rust diff --git a/r/sedonadb/bootstrap.R b/r/sedonadb/bootstrap.R new file mode 100644 index 00000000..e51c0d92 --- /dev/null +++ b/r/sedonadb/bootstrap.R @@ -0,0 +1,52 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# R builds a package by copying only the sources under the directory of the R +# package, which means it cannot refer to the Rust files above the directory. +# So, this R script copies the necessary Rust crates under the R package dir. +# Note that, this is not a standard mechanism of R, but is only invoked by +# pkgbuild (cf. https://github.com/r-lib/pkgbuild/pull/157) + +# Tweak Cargo.toml +cargo_toml <- "src/rust/Cargo.toml" +lines <- readLines(cargo_toml) +writeLines( + gsub("../../../../", "../", lines, fixed = TRUE), + cargo_toml +) + +dir.create("src/dep_crates/") +file.copy( + c( + "../../rust", + "../../c", + "../../Cargo.toml", + "../../Cargo.lock" + ), + "src/", + recursive = TRUE +) + +# Tweak workspace Cargo.toml +top_cargo_toml <- "src/Cargo.toml" +lines <- readLines(top_cargo_toml) +# change the path to the R package's Rust code +lines <- gsub("r/sedonadb/src/rust", "rust", lines, fixed = TRUE) +# remove unnecessary workspace members +lines <- gsub('"python/sedonadb",', "", lines, fixed = TRUE) +lines <- gsub('"sedona-cli",', "", lines, fixed = TRUE) +writeLines(lines, top_cargo_toml) From b8d267f74f3f71e28e69eb50cc305cb43daa8e01 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Thu, 25 Sep 2025 00:28:42 +0900 Subject: [PATCH 2/5] Add to .Rbuildignore --- r/sedonadb/.Rbuildignore | 1 + 1 file changed, 1 insertion(+) diff --git a/r/sedonadb/.Rbuildignore b/r/sedonadb/.Rbuildignore index 7e7df631..d18da406 100644 --- a/r/sedonadb/.Rbuildignore +++ b/r/sedonadb/.Rbuildignore @@ -10,3 +10,4 @@ ^compile_commands\.json$ ^\.vscode$ ^README\.Rmd$ +^bootstrap\.R$ From 2d2bf3df4d79b38462efa0b14d7b64acf3b0e00d Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Thu, 25 Sep 2025 00:29:41 +0900 Subject: [PATCH 3/5] Install rcmdcheck --- .github/workflows/r.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index 4d036502..e6690b55 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -88,6 +88,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: + extra-packages: any::rcmdcheck needs: check working-directory: r/sedonadb From 1e781b6f4e89abdc9871dbcff2c5b2af19ae0a3d Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Thu, 25 Sep 2025 01:03:35 +0900 Subject: [PATCH 4/5] Allow CRAN warnings and do not upload too-heavy results --- .github/workflows/r.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index e6690b55..e6d95cda 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -97,3 +97,5 @@ jobs: args: 'c("--no-manual")' # no --as-cran upload-snapshots: true working-directory: r/sedonadb + error-on: '"error"' # ignore CRAN warnings + upload-results: 'never' # results are too heavy to upload From b76a22e7fa3b7c26233890be3e5c455023357b4d Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Thu, 25 Sep 2025 01:05:13 +0900 Subject: [PATCH 5/5] Revert CI --- .github/workflows/r.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index e6d95cda..f9ef4d2b 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -88,14 +88,13 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: any::rcmdcheck needs: check working-directory: r/sedonadb - - uses: r-lib/actions/check-r-package@v2 - with: - args: 'c("--no-manual")' # no --as-cran - upload-snapshots: true - working-directory: r/sedonadb - error-on: '"error"' # ignore CRAN warnings - upload-results: 'never' # results are too heavy to upload + - name: Install R Package + run: | + R CMD INSTALL r/sedonadb --preclean + + - name: Test R Package + run: | + R -e 'library(testthat); test_local("r/sedonadb", MultiReporter$new(list(CheckReporter$new(), LocationReporter$new())))'