diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index f9c1ffc..2837816 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -41,6 +41,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: + dependencies: ${{ matrix.config.os == 'macos-latest' && '"hard"' || '"all"' }} extra-packages: any::rcmdcheck needs: check @@ -48,3 +49,5 @@ jobs: with: upload-snapshots: true error-on: '"error"' + + diff --git a/.github/workflows/fedora.yaml b/.github/workflows/fedora.yaml new file mode 100644 index 0000000..745870c --- /dev/null +++ b/.github/workflows/fedora.yaml @@ -0,0 +1,63 @@ +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: Fedora R-CMD-check + +jobs: + R-CMD-check: + runs-on: ubuntu-latest + container: + image: ghcr.io/r-hub/containers/valgrind:latest + + name: Fedora R CMD check + + strategy: + fail-fast: false + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + # First run of check-r-package@v2 + - name: Run R package checks + uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true + error-on: '"error"' + + # Set Rust toolchain to 1.67 using dtolnay action + - name: Setup Rust 1.67 + uses: dtolnay/rust-toolchain@1.67.0 + + # Second run of check-r-package@v2 with Rust 1.67 + - name: Run R package checks with Rust 1.67 + id: check_rust_167 + uses: r-lib/actions/check-r-package@v2 + with: + error-on: '"error"' + continue-on-error: true + + # Check if the step succeeded when it should have failed, and fail the job if so + - name: Fail if check succeeds + if: ${{ steps.check_rust_167.outcome == 'success' }} + run: | + echo "The R CMD check with Rust 1.67 unexpectedly succeeded." + exit 1 + + # Mark the job as success if it fails as expected + - name: Mark as success if failure was expected + if: ${{ steps.check_rust_167.outcome == 'failure' }} + run: echo "The R CMD check with Rust 1.67 failed as expected." diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION deleted file mode 100644 index ca1fc37..0000000 --- a/CRAN-SUBMISSION +++ /dev/null @@ -1,3 +0,0 @@ -Version: 0.1.4 -Date: 2024-07-31 13:34:25 UTC -SHA: 803aa2ec99b6ea0c0f0eca0761a0984f853181f0 diff --git a/DESCRIPTION b/DESCRIPTION index d40c503..48b2c88 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: arcpbf Title: Process ArcGIS Protocol Buffer FeatureCollections -Version: 0.1.4 +Version: 0.1.5 Authors@R: person("Josiah", "Parry", , "josiah.parry@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9910-865X")) @@ -14,7 +14,7 @@ Language: en Roxygen: list(markdown = TRUE) RoxygenNote: 7.2.3 Config/rextendr/version: 0.3.1.9000 -SystemRequirements: Cargo (Rust's package manager), rustc +SystemRequirements: Cargo (Rust's package manager), rustc >= 1.70 Suggests: httr2, sf, @@ -23,4 +23,6 @@ Suggests: Imports: arcgisutils (>= 0.3.0), rlang +Remotes: + R-ArcGIS/arcgislayers Config/testthat/edition: 3 diff --git a/NEWS.md b/NEWS.md index 8f5929d..e46bfec 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# arcpbf 0.1.5 + +* Addresses CRAN removal for failing to compile on Fedora. + # arcpbf 0.1.4 * Addresses MSRV requirement by replacing `std::cell::OnceCell` with `once_cell::sync::OnceCell` diff --git a/configure b/configure index d9b66ed..96ff328 100755 --- a/configure +++ b/configure @@ -1,15 +1,3 @@ -#!/bin/sh - -# https://github.com/eitsupi/prqlr/blob/main/configure.win -export PATH="$PATH:$HOME/.cargo/bin" - -if [ ! "$(command -v cargo)" ]; then - echo "----------------------- [RUST NOT FOUND]---------------------------" - echo "The 'cargo' command was not found on the PATH. Please install rustc" - echo "from: https://www.rust-lang.org/tools/install" - echo "-------------------------------------------------------------------" - echo "" - exit 1 -fi - -exit 0 +#!/usr/bin/env sh +: "${R_HOME=`R RHOME`}" +"${R_HOME}/bin/Rscript" tools/msrv.R \ No newline at end of file diff --git a/configure.win b/configure.win index d9b66ed..5ec6de3 100644 --- a/configure.win +++ b/configure.win @@ -1,15 +1,2 @@ -#!/bin/sh - -# https://github.com/eitsupi/prqlr/blob/main/configure.win -export PATH="$PATH:$HOME/.cargo/bin" - -if [ ! "$(command -v cargo)" ]; then - echo "----------------------- [RUST NOT FOUND]---------------------------" - echo "The 'cargo' command was not found on the PATH. Please install rustc" - echo "from: https://www.rust-lang.org/tools/install" - echo "-------------------------------------------------------------------" - echo "" - exit 1 -fi - -exit 0 +#!/usr/bin/env sh +"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" tools/msrv.R \ No newline at end of file diff --git a/src/rust/arcpbf/Cargo.toml b/src/rust/arcpbf/Cargo.toml index 6dd912c..8e4d3ba 100644 --- a/src/rust/arcpbf/Cargo.toml +++ b/src/rust/arcpbf/Cargo.toml @@ -16,7 +16,7 @@ once_cell = "*" chrono = "*" [patch.crates-io] -libR-sys = { git = "https://github.com/extendr/libR-sys", rev = "976c56d396175f8d09548b0a1f0a77fc393018f2" } +libR-sys = { git = "https://github.com/extendr/libR-sys", rev = "8649204b2490f3aa3732d56f4d84af7f042e5f05" } [profile.release] diff --git a/src/rust/vendor.tar.xz b/src/rust/vendor.tar.xz index 10c2da2..2f51033 100644 Binary files a/src/rust/vendor.tar.xz and b/src/rust/vendor.tar.xz differ diff --git a/tools/msrv.R b/tools/msrv.R new file mode 100644 index 0000000..baa33aa --- /dev/null +++ b/tools/msrv.R @@ -0,0 +1,116 @@ +# read the DESCRIPTION file +desc <- read.dcf("DESCRIPTION") + +if (!"SystemRequirements" %in% colnames(desc)) { + fmt <- c( + "`SystemRequirements` not found in `DESCRIPTION`.", + "Please specify `SystemRequirements: Cargo (Rust's package manager), rustc`" + ) + stop(paste(fmt, collapse = "\n")) +} + +# extract system requirements +sysreqs <- desc[, "SystemRequirements"] + +# check that cargo and rustc is found +if (!grepl("cargo", sysreqs, ignore.case = TRUE)) { + stop("You must specify `Cargo (Rust's package manager)` in your `SystemRequirements`") +} + +if (!grepl("rustc", sysreqs, ignore.case = TRUE)) { + stop("You must specify `Cargo (Rust's package manager), rustc` in your `SystemRequirements`") +} + +# split into parts +parts <- strsplit(sysreqs, ", ")[[1]] + +# identify which is the rustc +rustc_ver <- parts[grepl("rustc", parts)] + +# perform checks for the presence of rustc and cargo on the OS +no_cargo_msg <- c( + "----------------------- [CARGO NOT FOUND]--------------------------", + "The 'cargo' command was not found on the PATH. Please install Cargo", + "from: https://www.rust-lang.org/tools/install", + "", + "Alternatively, you may install Cargo from your OS package manager:", + " - Debian/Ubuntu: apt-get install cargo", + " - Fedora/CentOS: dnf install cargo", + " - macOS: brew install rustc", + "-------------------------------------------------------------------" +) + +no_rustc_msg <- c( + "----------------------- [RUST NOT FOUND]---------------------------", + "The 'rustc' compiler was not found on the PATH. Please install", + paste(rustc_ver, "or higher from:"), + "https://www.rust-lang.org/tools/install", + "", + "Alternatively, you may install Rust from your OS package manager:", + " - Debian/Ubuntu: apt-get install rustc", + " - Fedora/CentOS: dnf install rustc", + " - macOS: brew install rustc", + "-------------------------------------------------------------------" +) + +# Add {user}/.cargo/bin to path before checking +new_path <- paste0( + Sys.getenv("PATH"), + ":", + paste0(Sys.getenv("HOME"), "/.cargo/bin") +) + +# set the path with the new path +Sys.setenv("PATH" = new_path) + +# check for rustc installation +rustc_version <- tryCatch( + system("rustc --version", intern = TRUE), + error = function(e) { + stop(paste(no_rustc_msg, collapse = "\n")) + } +) + +# check for cargo installation +cargo_version <- tryCatch( + system("cargo --version", intern = TRUE), + error = function(e) { + stop(paste(no_cargo_msg, collapse = "\n")) + } +) + +# helper function to extract versions +extract_semver <- function(ver) { + if (grepl("\\d+\\.\\d+(\\.\\d+)?", ver)) { + sub(".*?(\\d+\\.\\d+(\\.\\d+)?).*", "\\1", ver) + } else { + NA + } +} + +# get the MSRV +msrv <- extract_semver(rustc_ver) + +# extract current version +current_rust_version <- extract_semver(rustc_version) + +# perform check +if (!is.na(msrv)) { + # -1 when current version is later + # 0 when they are the same + # 1 when MSRV is newer than current + is_msrv <- utils::compareVersion(msrv, current_rust_version) + if (is_msrv == 1) { + fmt <- paste0( + "\n------------------ [UNSUPPORTED RUST VERSION]------------------\n", + "- Minimum supported Rust version is %s.\n", + "- Installed Rust version is %s.\n", + "---------------------------------------------------------------" + ) + stop(sprintf(fmt, msrv, current_rust_version)) + } +} + +# print the versions +versions_fmt <- "Using %s\nUsing %s" +message(sprintf(versions_fmt, cargo_version, rustc_version))