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
20 changes: 20 additions & 0 deletions .github/actions/check-compat-bounds/check_compat_bounds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
48 changes: 41 additions & 7 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 }}"