From 88a19a8054bfc253a9ca86a7f5f4e42c46db4c1e Mon Sep 17 00:00:00 2001 From: mtfishman Date: Tue, 3 Mar 2026 23:03:46 -0500 Subject: [PATCH] Apply shared_docs_and_tests_workflows patch --- Project.toml | 2 +- docs/Project.toml | 2 ++ docs/make.jl | 3 +- docs/make_index.jl | 21 ------------- docs/make_readme.jl | 17 ---------- test/Project.toml | 2 ++ test/runtests.jl | 76 ++------------------------------------------- 7 files changed, 9 insertions(+), 114 deletions(-) delete mode 100644 docs/make_index.jl delete mode 100644 docs/make_readme.jl diff --git a/Project.toml b/Project.toml index b6d454f4..ed57ad63 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "BlockSparseArrays" uuid = "2c9a651f-6452-4ace-a6ac-809f4280fbb4" -version = "0.10.33" +version = "0.10.34" authors = ["ITensor developers and contributors"] [workspace] diff --git a/docs/Project.toml b/docs/Project.toml index f1824a0a..0cad40c3 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -2,6 +2,7 @@ BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e" BlockSparseArrays = "2c9a651f-6452-4ace-a6ac-809f4280fbb4" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +ITensorFormatter = "b6bf39f1-c9d3-4bad-aad8-593d802f65fd" Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" [sources.BlockSparseArrays] @@ -11,4 +12,5 @@ path = ".." BlockArrays = "1" BlockSparseArrays = "0.10" Documenter = "1" +ITensorFormatter = "0.2.27" Literate = "2" diff --git a/docs/make.jl b/docs/make.jl index 78ade73d..c2da2afb 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,5 +1,6 @@ using BlockSparseArrays: BlockSparseArrays using Documenter: Documenter, DocMeta, deploydocs, makedocs +using ITensorFormatter: ITensorFormatter DocMeta.setdocmeta!( BlockSparseArrays, :DocTestSetup, quote @@ -8,7 +9,7 @@ DocMeta.setdocmeta!( end; recursive = true ) -include("make_index.jl") +ITensorFormatter.make_index!(pkgdir(BlockSparseArrays)) makedocs(; modules = [BlockSparseArrays], diff --git a/docs/make_index.jl b/docs/make_index.jl deleted file mode 100644 index 00f65be7..00000000 --- a/docs/make_index.jl +++ /dev/null @@ -1,21 +0,0 @@ -using BlockSparseArrays: BlockSparseArrays -using Literate: Literate - -function ccq_logo(content) - include_ccq_logo = """ - ```@raw html - Flatiron Center for Computational Quantum Physics logo. - Flatiron Center for Computational Quantum Physics logo. - ``` - """ - content = replace(content, "{CCQ_LOGO}" => include_ccq_logo) - return content -end - -Literate.markdown( - joinpath(pkgdir(BlockSparseArrays), "examples", "README.jl"), - joinpath(pkgdir(BlockSparseArrays), "docs", "src"); - flavor = Literate.DocumenterFlavor(), - name = "index", - postprocess = ccq_logo -) diff --git a/docs/make_readme.jl b/docs/make_readme.jl deleted file mode 100644 index 02eed8b2..00000000 --- a/docs/make_readme.jl +++ /dev/null @@ -1,17 +0,0 @@ -using Literate: Literate - -let inputfile = joinpath(@__DIR__, "..", "examples", "README.jl"), - outputdir = joinpath(@__DIR__, ".."), flavor = Literate.CommonMarkFlavor(), - name = "README" - - function postprocess(content) - include_ccq_logo = """ - - - Flatiron Center for Computational Quantum Physics logo. - - """ - return replace(content, "{CCQ_LOGO}" => include_ccq_logo) - end - Literate.markdown(inputfile, outputdir; flavor, name, postprocess) -end diff --git a/test/Project.toml b/test/Project.toml index b3882462..3ecd5e4a 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -7,6 +7,7 @@ BlockSparseArrays = "2c9a651f-6452-4ace-a6ac-809f4280fbb4" DiagonalArrays = "74fd4be6-21e2-4f6f-823a-4360d37c7a77" FunctionImplementations = "7c7cc465-9c6a-495f-bdd1-f42428e86d0c" GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527" +ITensorPkgSkeleton = "3d388ab1-018a-49f4-ae50-18094d5f71ea" JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MatrixAlgebraKit = "6c742aac-3347-4629-af66-fc926824e5e4" @@ -32,6 +33,7 @@ BlockSparseArrays = "0.10" DiagonalArrays = "0.3" FunctionImplementations = "0.4" GPUArraysCore = "0.2" +ITensorPkgSkeleton = "0.3.42" JLArrays = "0.2, 0.3" LinearAlgebra = "1" MatrixAlgebraKit = "0.6" diff --git a/test/runtests.jl b/test/runtests.jl index e5afded7..05baac8a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,75 +1,3 @@ -using SafeTestsets: @safetestset -using Suppressor: Suppressor +using ITensorPkgSkeleton: ITensorPkgSkeleton -# check for filtered groups -# either via `--group=ALL` or through ENV["GROUP"] -const pat = r"(?:--group=)(\w+)" -arg_id = findfirst(contains(pat), ARGS) -const GROUP = uppercase( - if isnothing(arg_id) - arg = get(ENV, "GROUP", "ALL") - # For some reason `ENV["GROUP"]` is set to `""` - # when running via GitHub Actions, so handle that case: - arg == "" ? "ALL" : arg - else - only(match(pat, ARGS[arg_id]).captures) - end -) - -""" -match files of the form `test_*.jl`, but exclude `*setup*.jl` -""" -function istestfile(path) - fn = basename(path) - return endswith(fn, ".jl") && startswith(basename(fn), "test_") && - !contains(fn, "setup") -end -""" -match files of the form `*.jl`, but exclude `*_notest.jl` and `*setup*.jl` -""" -function isexamplefile(path) - fn = basename(path) - return endswith(fn, ".jl") && !endswith(fn, "_notest.jl") && !contains(fn, "setup") -end - -@time begin - # tests in groups based on folder structure - for testgroup in filter(isdir, readdir(@__DIR__; join = true)) - if GROUP == "ALL" || GROUP == uppercase(basename(testgroup)) - for filename in filter(istestfile, readdir(testgroup; join = true)) - @eval @safetestset $(basename(filename)) begin - include($filename) - end - end - end - end - - # single files in top folder - for file in filter(istestfile, readdir(@__DIR__; join = true)) - (basename(file) == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion - @eval @safetestset $(basename(file)) begin - include($file) - end - end - - # test examples - examplepath = joinpath(@__DIR__, "..", "examples") - for (root, _, files) in walkdir(examplepath) - contains(chopprefix(root, @__DIR__), "setup") && continue - for file in filter(isexamplefile, files) - filename = joinpath(root, file) - @eval begin - @safetestset $file begin - $( - Expr( - :macrocall, - GlobalRef(Suppressor, Symbol("@suppress")), - LineNumberNode(@__LINE__, @__FILE__), - :(include($filename)) - ) - ) - end - end - end - end -end +ITensorPkgSkeleton.runtests(; testdir = @__DIR__)