From 18ef350a197fb054fdf0ab33dcb255d3f917bfa6 Mon Sep 17 00:00:00 2001 From: Hiroshi Shinaoka Date: Mon, 6 Apr 2026 17:42:13 +0900 Subject: [PATCH] pin GitHub fallback tensor4all-rs commit --- README.md | 2 +- deps/build.jl | 7 ++++--- test/runtests.jl | 1 + test/test_build_script.jl | 9 +++++++++ 4 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 test/test_build_script.jl diff --git a/README.md b/README.md index acec74d..5aa3eaf 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/deps/build.jl b/deps/build.jl index 2ed2000..ece2851 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -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 @@ -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 """ diff --git a/test/runtests.jl b/test/runtests.jl index 97bfcd9..5b1b823 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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") diff --git a/test/test_build_script.jl b/test/test_build_script.jl new file mode 100644 index 0000000..6e98a6e --- /dev/null +++ b/test/test_build_script.jl @@ -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