From e4387630b691f7768b589b42ce8de72ab73c0a9e Mon Sep 17 00:00:00 2001 From: mtfishman Date: Wed, 22 Apr 2026 12:23:40 -0400 Subject: [PATCH] Tests.yml: run check-compat-bounds as a separate job Move the compat-bounds check out of the `tests` job into a sibling job so a compat failure no longer prevents the test matrix from running. The caller's gate job still aggregates both via `needs:` on the reusable-workflow call, so a failure here continues to block auto-merge. Gate the new job to the canonical (ubuntu-latest, julia=1) cell so it runs exactly once per caller invocation regardless of matrix size, since the check is platform-independent. Also fix check_compat_bounds.jl to not spuriously fail when a workspace project pins its own package to a not-yet-registered version (e.g. root bumps `version = "0.4.0"` and test/docs/examples pin `MyPkg = "0.4"`): merge each workspace project's declared version into the candidate set before computing max_satisfying. --- .../check_compat_bounds.jl | 20 ++++++++ .github/workflows/Tests.yml | 48 ++++++++++++++++--- 2 files changed, 61 insertions(+), 7 deletions(-) diff --git a/.github/actions/check-compat-bounds/check_compat_bounds.jl b/.github/actions/check-compat-bounds/check_compat_bounds.jl index 28e4d35..62ddbe3 100644 --- a/.github/actions/check-compat-bounds/check_compat_bounds.jl +++ b/.github/actions/check-compat-bounds/check_compat_bounds.jl @@ -53,6 +53,23 @@ function collect_uuids(projects) return uuids end +# Versions declared by the workspace itself. A package bumping its own version +# in a PR won't appear in the registry yet, so we merge these into the set of +# candidate versions so in-workspace compat entries (e.g. a test/Project.toml +# pinning the root package) don't spuriously fail the check. +function workspace_versions(projects) + versions = Dict{Base.UUID,VersionNumber}() + for path in projects + proj = TOML.parsefile(path) + uuid_str = get(proj, "uuid", nothing) + version_str = get(proj, "version", nothing) + uuid_str === nothing && continue + version_str === nothing && continue + versions[Base.UUID(uuid_str)] = VersionNumber(version_str) + end + return versions +end + function collect_compat(projects, uuids) entries = NamedTuple[] for path in projects @@ -129,6 +146,7 @@ function main(args) uuids = collect_uuids(projects) entries = collect_compat(projects, uuids) manifest = read_manifest(root) + ws_versions = workspace_versions(projects) issues = NamedTuple[] for entry in entries @@ -145,6 +163,8 @@ function main(args) resolved === nothing && continue # extras-only packages may not be resolved here versions = registry_versions(entry.uuid) + ws_version = get(ws_versions, entry.uuid, nothing) + ws_version === nothing || ws_version in versions || push!(versions, ws_version) isempty(versions) && continue # unregistered (e.g. local [sources] deps) max_allowed = max_satisfying(versions, spec) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 71cb8d4..2587a2d 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -150,13 +150,6 @@ jobs: with: localregistry: "${{ inputs.localregistry }}" - - name: "Check compat upper bounds" - if: "${{ inputs.check-compat-bounds }}" - uses: ITensor/ITensorActions/.github/actions/check-compat-bounds@main - with: - workspace-root: "." - mode: "${{ inputs.check-compat-bounds-mode }}" - - name: "Export extra environment variables" if: "${{ inputs.extra-env != '' }}" shell: "bash" @@ -193,3 +186,44 @@ jobs: files: lcov.info token: "${{ secrets.CODECOV_TOKEN }}" fail_ci_if_error: false + + check-compat-bounds: + name: "Check compat bounds" + # Runs in parallel with `tests` so a compat-bound failure does not prevent + # the test matrix from executing. The caller's gate job (which `needs:` the + # reusable-workflow call) still aggregates both jobs, so a failure here + # blocks auto-merge. + # + # The check is platform-independent, so when the caller invokes this + # reusable workflow via a matrix (typical), we only run it on the canonical + # (ubuntu-latest, julia=1) cell to avoid running it N times. + if: >- + inputs.check-compat-bounds + && inputs.os == 'ubuntu-latest' + && inputs.julia-version == '1' + && (!github.event.pull_request.draft || inputs.run-all-on-draft) + runs-on: "ubuntu-latest" + timeout-minutes: ${{ inputs.timeout-minutes }} + steps: + - uses: actions/checkout@v4 + + - name: "Setup Julia" + uses: julia-actions/setup-julia@v2 + with: + version: "1" + + - uses: julia-actions/cache@v2 + if: "${{ inputs.cache }}" + with: + token: "${{ secrets.GITHUB_TOKEN }}" + + - uses: julia-actions/julia-buildpkg@v1 + if: "${{ inputs.buildpkg }}" + with: + localregistry: "${{ inputs.localregistry }}" + + - name: "Check compat upper bounds" + uses: ITensor/ITensorActions/.github/actions/check-compat-bounds@main + with: + workspace-root: "." + mode: "${{ inputs.check-compat-bounds-mode }}"