diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index 0614de9..70f2dc6 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -1,13 +1,11 @@ name: "CompatHelper" - on: schedule: - - cron: '0 0 * * *' - workflow_dispatch: + - cron: "0 0 * * *" + workflow_dispatch: ~ permissions: - contents: write - pull-requests: write - + contents: "write" + pull-requests: "write" jobs: compat-helper: name: "CompatHelper" diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index 01a7f7a..c3b11ec 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -1,23 +1,20 @@ name: "Documentation" - on: push: branches: - - main - tags: '*' - pull_request: + - "main" + tags: "*" + pull_request: ~ schedule: - - cron: '1 4 * * 4' - + - cron: "1 4 * * 4" concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch || github.ref != 'refs/tags/v*' }} - + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: "${{ github.ref_name != github.event.repository.default_branch || github.ref != 'refs/tags/v*' }}" jobs: build-and-deploy-docs: name: "Documentation" uses: "ITensor/ITensorActions/.github/workflows/Documentation.yml@main" with: - localregistry: https://github.com/ITensor/ITensorRegistry.git + localregistry: "https://github.com/ITensor/ITensorRegistry.git" secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}" diff --git a/.github/workflows/FormatCheck.yml b/.github/workflows/FormatCheck.yml index 1525861..3c290ea 100644 --- a/.github/workflows/FormatCheck.yml +++ b/.github/workflows/FormatCheck.yml @@ -1,15 +1,15 @@ name: "Format Check" - on: pull_request_target: - paths: ['**/*.jl'] - types: [opened, synchronize, reopened, ready_for_review] - + types: + - "opened" + - "synchronize" + - "reopened" + - "ready_for_review" permissions: - contents: read - actions: write - pull-requests: write - + contents: "read" + actions: "write" + pull-requests: "write" jobs: format-check: name: "Format Check" diff --git a/.github/workflows/FormatPullRequest.yml b/.github/workflows/FormatPullRequest.yml index 93875cc..5a8b627 100644 --- a/.github/workflows/FormatPullRequest.yml +++ b/.github/workflows/FormatPullRequest.yml @@ -1,14 +1,16 @@ name: "Format Pull Request" - on: schedule: - - cron: '0 0 * * *' - workflow_dispatch: + - cron: "0 0 * * *" + workflow_dispatch: ~ + issue_comment: + types: + - "created" permissions: - contents: write - pull-requests: write - + contents: "write" + pull-requests: "write" jobs: format-pull-request: name: "Format Pull Request" uses: "ITensor/ITensorActions/.github/workflows/FormatPullRequest.yml@main" + secrets: "inherit" diff --git a/.github/workflows/IntegrationTest.yml b/.github/workflows/IntegrationTest.yml index bd9a6c1..366df3a 100644 --- a/.github/workflows/IntegrationTest.yml +++ b/.github/workflows/IntegrationTest.yml @@ -1,25 +1,37 @@ name: "IntegrationTest" - on: push: branches: - - 'main' - tags: '*' - paths: - - 'Project.toml' - pull_request: - paths: - - 'Project.toml' - + - "main" + tags: "*" + pull_request_target: + types: + - "opened" + - "synchronize" + - "reopened" + - "ready_for_review" + - "converted_to_draft" jobs: integration-test: name: "IntegrationTest" strategy: - matrix: - pkg: - - 'ITensorBase' - - 'UnallocatedArrays' + fail-fast: false + matrix: + pkg: + - "ITensorBase" + - "UnallocatedArrays" uses: "ITensor/ITensorActions/.github/workflows/IntegrationTest.yml@main" + secrets: "inherit" with: localregistry: "https://github.com/ITensor/ITensorRegistry.git" pkg: "${{ matrix.pkg }}" + integration-gate: + name: "IntegrationTest" + needs: "integration-test" + if: "${{ always() && needs.integration-test.result != 'skipped' }}" + runs-on: "ubuntu-latest" + steps: + - name: "Fail if any downstream integration test failed" + run: | + echo "integration-test.result = ${{ needs.integration-test.result }}" + test "${{ needs.integration-test.result }}" = "success" diff --git a/.github/workflows/IntegrationTestRequest.yml b/.github/workflows/IntegrationTestRequest.yml index d42fcca..6f58e45 100644 --- a/.github/workflows/IntegrationTestRequest.yml +++ b/.github/workflows/IntegrationTestRequest.yml @@ -1,14 +1,14 @@ name: "Integration Test Request" - on: issue_comment: - types: [created] - + types: + - "created" jobs: integrationrequest: if: | github.event.issue.pull_request && contains(fromJSON('["OWNER", "COLLABORATOR", "MEMBER"]'), github.event.comment.author_association) - uses: ITensor/ITensorActions/.github/workflows/IntegrationTestRequest.yml@main + + uses: "ITensor/ITensorActions/.github/workflows/IntegrationTestRequest.yml@main" with: - localregistry: https://github.com/ITensor/ITensorRegistry.git + localregistry: "https://github.com/ITensor/ITensorRegistry.git" diff --git a/.github/workflows/LiterateCheck.yml b/.github/workflows/LiterateCheck.yml deleted file mode 100644 index 2ca5f27..0000000 --- a/.github/workflows/LiterateCheck.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: "Literate Check" - -on: - push: - branches: - - 'main' - tags: '*' - pull_request: - -jobs: - literate: - name: "Literate Check" - uses: "ITensor/ITensorActions/.github/workflows/LiterateCheck.yml@main" - with: - localregistry: https://github.com/ITensor/ITensorRegistry.git diff --git a/.github/workflows/Registrator.yml b/.github/workflows/Registrator.yml index 4ae82c4..97dc033 100644 --- a/.github/workflows/Registrator.yml +++ b/.github/workflows/Registrator.yml @@ -1,21 +1,22 @@ -name: Register Package +name: "Register Package" on: - workflow_dispatch: + workflow_dispatch: ~ push: branches: - - 'master' - - 'main' + - "master" + - "main" paths: - - 'Project.toml' - + - "Project.toml" + issue_comment: + types: + - "created" permissions: - contents: write - pull-requests: write - + contents: "write" + pull-requests: "write" + issues: "write" jobs: Register: uses: "ITensor/ITensorActions/.github/workflows/Registrator.yml@main" with: - localregistry: ITensor/ITensorRegistry - secrets: - REGISTRATOR_KEY: ${{ secrets.REGISTRATOR_KEY }} + localregistry: "ITensor/ITensorRegistry" + secrets: "inherit" diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 5a0a306..70f6c8d 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -1,21 +1,24 @@ -name: Tests +name: "Tests" on: push: branches: - - 'master' - - 'main' - - 'release-' - tags: '*' + - "master" + - "main" + - "release-" + tags: "*" paths-ignore: - - 'docs/**' + - "docs/**" pull_request: - workflow_dispatch: - + types: + - "opened" + - "synchronize" + - "reopened" + - "ready_for_review" + - "converted_to_draft" + workflow_dispatch: ~ concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - # Cancel intermediate builds: only if it is a pull request build. - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: "${{ startsWith(github.ref, 'refs/pull/') }}" jobs: tests: name: "Tests" @@ -23,20 +26,28 @@ jobs: fail-fast: false matrix: version: - - 'lts' # minimal supported version - - '1' # latest released Julia version - # group: - # - 'core' - # - 'optional' + - "lts" + - "1" os: - - ubuntu-latest - - macOS-latest - - windows-latest + - "ubuntu-latest" + - "macOS-latest" + - "windows-latest" uses: "ITensor/ITensorActions/.github/workflows/Tests.yml@main" with: group: "${{ matrix.group }}" julia-version: "${{ matrix.version }}" os: "${{ matrix.os }}" - localregistry: https://github.com/ITensor/ITensorRegistry.git + localregistry: "https://github.com/ITensor/ITensorRegistry.git" secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}" + tests-gate: + name: "Tests" + needs: "tests" + if: "${{ always() && needs.tests.result != 'skipped' }}" + runs-on: "ubuntu-latest" + steps: + - name: "Fail if any matrix leg failed" + run: | + echo "tests.result = ${{ needs.tests.result }}" + test "${{ needs.tests.result }}" = "success" + diff --git a/.github/workflows/VersionCheck.yml b/.github/workflows/VersionCheck.yml index 69444f1..bb0df88 100644 --- a/.github/workflows/VersionCheck.yml +++ b/.github/workflows/VersionCheck.yml @@ -1,11 +1,9 @@ name: "Version Check" - on: - pull_request: - + pull_request: ~ jobs: version-check: name: "Version Check" uses: "ITensor/ITensorActions/.github/workflows/VersionCheck.yml@main" with: - localregistry: https://github.com/ITensor/ITensorRegistry.git + localregistry: "https://github.com/ITensor/ITensorRegistry.git" diff --git a/.gitignore b/.gitignore index 7085ca8..0727bc4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,15 @@ -*.jl.*.cov -*.jl.cov -*.jl.mem +*.cov +*.mem *.o *.swp .DS_Store .benchmarkci .tmp .vscode/ -Manifest.toml +.worktrees/ +LocalPreferences.toml +Manifest*.toml benchmark/*.json dev/ -docs/LocalPreferences.toml -docs/Manifest.toml docs/build/ docs/src/index.md -examples/LocalPreferences.toml -test/LocalPreferences.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9106f2c..d5593c0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,17 +1,17 @@ ci: - skip: [runic] - + skip: + - "itensor-formatter" repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v6.0.0 - hooks: - - id: check-merge-conflict - - id: check-toml - - id: check-yaml - - id: end-of-file-fixer - exclude_types: [markdown] # incompatible with Literate.jl - -- repo: https://github.com/fredrikekre/runic-pre-commit - rev: v2.1.0 - hooks: - - id: runic + - repo: "https://github.com/pre-commit/pre-commit-hooks" + rev: "v6.0.0" + hooks: + - id: "check-merge-conflict" + - id: "check-toml" + - id: "check-yaml" + - id: "end-of-file-fixer" + exclude_types: + - "markdown" + - repo: "https://github.com/ITensor/itensorformatter-pre-commit" + rev: "v1.0.0" + hooks: + - id: "itensor-formatter" diff --git a/Project.toml b/Project.toml index 1b113b6..58181fc 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,10 @@ name = "UnspecifiedTypes" uuid = "42b3faec-625b-4613-8ddc-352bf9672b8d" -version = "0.1.8" +version = "0.1.9" authors = ["ITensor developers and contributors"] +[workspace] +projects = ["benchmark", "dev", "docs", "examples", "test"] + [compat] julia = "1.10" diff --git a/docs/Project.toml b/docs/Project.toml index 14cbc42..75f9b62 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,9 +1,14 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +ITensorFormatter = "b6bf39f1-c9d3-4bad-aad8-593d802f65fd" Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" UnspecifiedTypes = "42b3faec-625b-4613-8ddc-352bf9672b8d" +[sources.UnspecifiedTypes] +path = ".." + [compat] Documenter = "1.8.1" +ITensorFormatter = "0.2.27" Literate = "2.20.1" UnspecifiedTypes = "0.1.3" diff --git a/docs/make.jl b/docs/make.jl index 8553d88..90cfed7 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,11 +1,12 @@ using Documenter: Documenter, DocMeta, deploydocs, makedocs +using ITensorFormatter: ITensorFormatter using UnspecifiedTypes: UnspecifiedTypes DocMeta.setdocmeta!( UnspecifiedTypes, :DocTestSetup, :(using UnspecifiedTypes); recursive = true ) -include("make_index.jl") +ITensorFormatter.make_index!(pkgdir(UnspecifiedTypes)) makedocs(; modules = [UnspecifiedTypes], diff --git a/docs/make_index.jl b/docs/make_index.jl deleted file mode 100644 index b279393..0000000 --- a/docs/make_index.jl +++ /dev/null @@ -1,21 +0,0 @@ -using Literate: Literate -using UnspecifiedTypes: UnspecifiedTypes - -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(UnspecifiedTypes), "examples", "README.jl"), - joinpath(pkgdir(UnspecifiedTypes), "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 0b404de..0000000 --- a/docs/make_readme.jl +++ /dev/null @@ -1,21 +0,0 @@ -using Literate: Literate -using UnspecifiedTypes: UnspecifiedTypes - -function ccq_logo(content) - include_ccq_logo = """ - - - Flatiron Center for Computational Quantum Physics logo. - - """ - content = replace(content, "{CCQ_LOGO}" => include_ccq_logo) - return content -end - -Literate.markdown( - joinpath(pkgdir(UnspecifiedTypes), "examples", "README.jl"), - joinpath(pkgdir(UnspecifiedTypes)); - flavor = Literate.CommonMarkFlavor(), - name = "README", - postprocess = ccq_logo -) diff --git a/test/Project.toml b/test/Project.toml index 78b0741..53a4974 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,12 +1,17 @@ [deps] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +ITensorPkgSkeleton = "3d388ab1-018a-49f4-ae50-18094d5f71ea" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" UnspecifiedTypes = "42b3faec-625b-4613-8ddc-352bf9672b8d" +[sources.UnspecifiedTypes] +path = ".." + [compat] Aqua = "0.8.9" +ITensorPkgSkeleton = "0.3.42" SafeTestsets = "0.1" Suppressor = "0.2" Test = "1.10" diff --git a/test/runtests.jl b/test/runtests.jl index 9786268..05baac8 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,71 +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) - get(ENV, "GROUP", "ALL") - else - only(match(pat, ARGS[arg_id]).captures) - end -) - -""" -match files of the form `test_*.jl`, but exclude `*setup*.jl` -""" -function istestfile(fn) - 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(fn) - 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__)) - if GROUP == "ALL" || GROUP == uppercase(testgroup) - for file in - filter(istestfile, readdir(joinpath(@__DIR__, testgroup); join = true)) - @eval @safetestset $file begin - include($file) - end - end - end - end - - # single files in top folder - for file in filter(istestfile, readdir(@__DIR__)) - (file == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion - @eval @safetestset $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__)