Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ The build script locates the `tensor4all-rs` Rust workspace in this priority ord

1. `TENSOR4ALL_RS_PATH` environment variable
2. Sibling directory `../tensor4all-rs/` (relative to the package root)
3. Automatic clone from GitHub
3. Automatic clone from GitHub at the pinned fallback commit in [deps/build.jl](deps/build.jl)

## Running Tests

Expand Down
7 changes: 4 additions & 3 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using Libdl
using RustToolChain: cargo

# Configuration
const TENSOR4ALL_RS_VERSION = "main" # Branch, tag, or commit hash
const TENSOR4ALL_RS_FALLBACK_COMMIT = "8a68db84d517286ee55fda3585eebb26667e200a"
const TENSOR4ALL_RS_REPO = "https://github.com/tensor4all/tensor4all-rs.git"

# Paths
Expand Down Expand Up @@ -59,8 +59,9 @@ end
Clone tensor4all-rs from GitHub to the specified directory.
"""
function clone_from_github(dest::String)
println("Cloning tensor4all-rs from GitHub (version: $TENSOR4ALL_RS_VERSION)...")
run(`git clone --depth 1 --branch $TENSOR4ALL_RS_VERSION $TENSOR4ALL_RS_REPO $dest`)
println("Cloning tensor4all-rs from GitHub (pinned commit: $TENSOR4ALL_RS_FALLBACK_COMMIT)...")
run(`git clone $TENSOR4ALL_RS_REPO $dest`)
run(`git -C $dest checkout --detach $TENSOR4ALL_RS_FALLBACK_COMMIT`)
end

"""
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const T4ATensor = Tensor4all.Tensor
skip_hdf5 = get(ENV, "T4A_SKIP_HDF5_TESTS", "") == "1"

@testset "Tensor4all.jl" begin
include("test_build_script.jl")
include("test_index.jl")
include("test_tensor.jl")
include("test_treetn.jl")
Expand Down
9 changes: 9 additions & 0 deletions test/test_build_script.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Test

@testset "build.jl" begin
script = read(joinpath(dirname(@__DIR__), "deps", "build.jl"), String)

@test occursin(r"const TENSOR4ALL_RS_FALLBACK_COMMIT = \"[0-9a-f]{40}\"", script)
@test occursin("checkout --detach", script)
@test !occursin("--branch", script)
end
Loading