-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide access to TileDB shared libraries in downstream packages (#782)
New helper function to provide access to `libtiledb` used by tiledb-r for downstream packages. This builds off the prototype code @LTLA provided New functions provided: - `.pkg_config()`: provide compiler flags for linking to the version of `libtiledb` that tiledb-r either vendors or links to at the system level - `.core_info()`: provides a vector with the `libtiledb` version and install type (eg. `"vendored"`, `"system"`) - `.core_hash()`: provides the same information as `.core_info()`, but as an MD5 hash Also includes a mini-test suite for CI that tests this functionality with both a system install and vendored install of `libtiledb` [SC-59185](https://app.shortcut.com/tiledb-inc/story/59185/) resolves #780 * Update windows install to include libtiledb source * Clean up comments * Better Windows support * Add tests for .pkg_config() * Add utility functions to check version of libtiledb a package was built with vs version package is loaded with * Rename `R/Init.R` to `R/zzz.R` * Add quoting for Windows * Update changelog Bump develop version
- Loading branch information
1 parent
de4f684
commit ffabb43
Showing
14 changed files
with
504 additions
and
12 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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
on: | ||
push: | ||
pull_request: | ||
|
||
name: pkgconfig | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
pkgconfig: | ||
runs-on: ${{ matrix.os }} | ||
name: ${{ matrix.os }} (r-${{ matrix.r }}) (${{ matrix.vendored }} libtiledb) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
r: | ||
- release | ||
# - devel | ||
vendored: | ||
- 'vendored' | ||
- 'system' | ||
include: | ||
- os: ubuntu-latest | ||
use-public-rspm: true | ||
# - os: ubuntu-latest | ||
# r: devel | ||
# http-user-agent: 'release' | ||
exclude: | ||
- os: macos-latest | ||
r: devel | ||
|
||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
_R_CHECK_FORCE_SUGGESTS_: "FALSE" | ||
_R_TILEDB_LIBTILEDB_: ${{ matrix.vendored }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
r-version: ${{ matrix.r }} | ||
http-user-agent: ${{ matrix.http-user-agent }} | ||
use-public-rspm: ${{ matrix.use-public-rspm }} | ||
|
||
- name: Setup libtiledb | ||
if: ${{ matrix.vendored == 'system' }} | ||
run: | | ||
VERSION=$(grep version tools/tiledbVersion.txt | cut -f 2 -d ':' | tr -d '[:space:]') | ||
SHA=$(grep sha tools/tiledbVersion.txt | cut -f 2 -d ':' | tr -d '[:space:]') | ||
URL="https://github.com/TileDB-Inc/TileDB/releases/download/${VERSION}/tiledb-linux-x86_64-${VERSION}-${SHA}.tar.gz" | ||
mkdir -vp libtiledb | ||
cd libtiledb | ||
wget -O libtiledb.tar.gz ${URL} | ||
tar -xvzf libtiledb.tar.gz | ||
/usr/bin/sudo cp -Rv include/* /usr/local/include/ | ||
/usr/bin/sudo cp -Rv lib/* /usr/local/lib/ | ||
cd .. | ||
rm -rfv libtiledb | ||
sudo ldconfig | ||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: local::. | ||
|
||
- name: Test tiledb::.pkg_config() | ||
run: Rscript tests/pkgconfig-test.R |
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
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,61 @@ | ||
|
||
if (!at_home()) { | ||
exit_file("'.pkg_config()' tests run at home") | ||
} | ||
|
||
libtype <- Sys.getenv("_R_TILEDB_LIBTILEDB_") | ||
if (nzchar(libtype)) { | ||
expect_true( | ||
libtype %in% c("system", "vendored"), | ||
info = "`Sys.getenv('_R_TILEDB_LIBTILEDB_')` must be 'system' or 'vendored'" | ||
) | ||
} | ||
|
||
# Check .core_info() | ||
expect_inherits( | ||
info <- .core_info(), | ||
class = "character", | ||
info = "'.core_info()' returns a character vector" | ||
) | ||
expect_length(info, length = 2L, info = "'.core_info()' returns a two-length vector") | ||
expect_identical( | ||
names(info), | ||
target = c("version", "libtype"), | ||
info = "'.core_info()' returns a named vector with names of 'version' and 'libtype'" | ||
) | ||
expect_identical( | ||
info[["version"]], | ||
target = as.character(tiledb_version(compact = TRUE)), | ||
info = "'.core_info()' returns the correct core version" | ||
) | ||
libtarget <- ifelse(nzchar(libtype), yes = libtype, no = "unknown") | ||
expect_identical( | ||
info[["libtype"]], | ||
target = libtarget, | ||
info = sprintf("'.core_info()' returns the correct libtype ('%s')", libtarget) | ||
) | ||
|
||
# Check .core_hash() | ||
tmpfile <- tempfile(tmpdir = tempdir(check = TRUE)) | ||
writeLines( | ||
sprintf( | ||
"version:\t%s\nlibtype:\t%s", | ||
as.character(tiledb_version(compact = TRUE)), | ||
ifelse(nzchar(libtype), yes = libtype, no = "unknown") | ||
), | ||
con = tmpfile | ||
) | ||
target <- unname(tools::md5sum(tmpfile)) | ||
hash <- .core_hash() | ||
expect_inherits( | ||
hash, | ||
class = "character", | ||
info = "'.core_hash()' returns a character value" | ||
) | ||
expect_length(hash, length = 1L, info = "'.core_hash()' returns a single value") | ||
expect_null(names(hash), info = "'.core_hash()' returns an unnamed value") | ||
expect_identical( | ||
hash, | ||
target = target, | ||
info = "'.core_hash()' returns the correct hash value" | ||
) |
Oops, something went wrong.