Skip to content

Commit

Permalink
Fixed calculate_linear_dependency_ordering() and bump versions to QED…
Browse files Browse the repository at this point in the history
…core 0.2 and QEDbase 0.3 (#83)

This pull request changes the compat entry for the `QEDcore` package
from `0.1` to `0.1, 0.2`.
This keeps the compat entries for earlier versions.



Note: I have not tested your package with this new compat entry.
It is your responsibility to make sure that your package tests pass
before you merge this pull request.
  • Loading branch information
SimeonEhrig authored Oct 29, 2024
2 parents 6316403 + dac2aa6 commit 457dba2
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 17 deletions.
30 changes: 27 additions & 3 deletions .ci/SetupDevEnv/src/SetupDevEnv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -513,14 +513,38 @@ function calculate_linear_dependency_ordering(
@info "calculate linare ordering to add QED packages"
linear_pkg_ordering = Vector{String}()

for init_level in package_dependecy_list
# First we search for the highest level containing a required dependency
# All dependencies in the levels below the highest level needs to be installed
# and there be part of the output.
highest_level = 0

for level in 1:length(package_dependecy_list)
for required_dep in required_dependencies
if required_dep in init_level
push!(linear_pkg_ordering, required_dep)
if required_dep in package_dependecy_list[level]
highest_level = level
end
end
end

# could not find required dependency
if highest_level == 0
return linear_pkg_ordering
end

# copy complete level
for level in 1:(highest_level - 1)
for pkg in package_dependecy_list[level]
push!(linear_pkg_ordering, pkg)
end
end

# copy only the dependencies from the highest_level, which are required
for pkg in package_dependecy_list[highest_level]
if pkg in required_dependencies
push!(linear_pkg_ordering, pkg)
end
end

with_logger(debuglogger) do
@debug "linear ordering of QED packages to add: $(linear_pkg_ordering)"
end
Expand Down
63 changes: 63 additions & 0 deletions .ci/SetupDevEnv/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,66 @@ using Test
# end
# end
end

@testset "calculate_linear_dependency_ordering()" begin
pkg_dependecy_list = Vector{Set{String}}()
push!(pkg_dependecy_list, Set(["QEDbase"]))
push!(pkg_dependecy_list, Set(["QEDcore"]))
push!(pkg_dependecy_list, Set(["QEDevents", "QEDfields", "QEDprocesses"]))
push!(pkg_dependecy_list, Set(["QuantumElectrodynamics"]))

# For the real world code, it does not matter what is the ordering of
# entries in a set.
# For the tests it does matter.
# Therefore the current expected behavoir if we create a list from a set
# is, that the output list has the same odering than the input list.
# This behavior is implementation depend and can change
@test [a for a in Set(["QEDevents", "QEDfields", "QEDprocesses"])] == ["QEDevents", "QEDfields", "QEDprocesses"]

@test SetupDevEnv.calculate_linear_dependency_ordering(
pkg_dependecy_list, ["NotInclude"]
) == []

@test SetupDevEnv.calculate_linear_dependency_ordering(
pkg_dependecy_list, ["QEDbase"]
) == ["QEDbase"]
@test SetupDevEnv.calculate_linear_dependency_ordering(
pkg_dependecy_list, ["QEDbase", "QEDcore"]
) == ["QEDbase", "QEDcore"]

@test SetupDevEnv.calculate_linear_dependency_ordering(
pkg_dependecy_list, ["QEDcore"]
) == ["QEDbase", "QEDcore"]

@test SetupDevEnv.calculate_linear_dependency_ordering(
pkg_dependecy_list, ["QEDfields"]
) == ["QEDbase", "QEDcore", "QEDfields"]

expected_processes_fields = vcat(
["QEDbase", "QEDcore"], [a for a in Set(["QEDfields", "QEDprocesses"])]
)

@test SetupDevEnv.calculate_linear_dependency_ordering(
pkg_dependecy_list, ["QEDprocesses", "QEDfields"]
) == expected_processes_fields

@test SetupDevEnv.calculate_linear_dependency_ordering(
pkg_dependecy_list, ["QEDfields", "QEDprocesses"]
) == expected_processes_fields

@test SetupDevEnv.calculate_linear_dependency_ordering(
pkg_dependecy_list, ["QEDcore", "QEDfields"]
) == ["QEDbase", "QEDcore", "QEDfields"]

# needs to be constructed from a set, because how a set is iterated is
# implementation depend
expected_QuantumElectrodynamics = vcat(
["QEDbase", "QEDcore"],
[a for a in Set(["QEDevents", "QEDfields", "QEDprocesses"])],
["QuantumElectrodynamics"],
)

@test SetupDevEnv.calculate_linear_dependency_ordering(
pkg_dependecy_list, ["QuantumElectrodynamics"]
) == expected_QuantumElectrodynamics
end
4 changes: 2 additions & 2 deletions .github/workflows/BuildDeployDoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: "1.10"
- name: set dependencies to dev branch version
version: '1.10'
- name: set dev dependencies
run: |
$(julia --project=. .ci/integTestGen/src/get_project_name_version_path.jl)
echo "CI_DEV_PKG_NAME -> $CI_DEV_PKG_NAME"
Expand Down
18 changes: 6 additions & 12 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
name = "QuantumElectrodynamics"
uuid = "bb1fba1d-cf9b-41b3-874e-4b81465537b9"
authors = [
"Uwe Hernandez Acosta <[email protected]>",
"Simeon Ehrig",
"Klaus Steiniger",
"Tom Jungnickel",
"Anton Reinhard",
]
authors = ["Uwe Hernandez Acosta <[email protected]>", "Simeon Ehrig", "Klaus Steiniger", "Tom Jungnickel", "Anton Reinhard"]
version = "0.1.0"

[deps]
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
QEDbase = "10e22c08-3ccb-4172-bfcf-7d7aa3d04d93"
QEDcore = "35dc0263-cb5f-4c33-a114-1d7f54ab753e"
QEDevents = "fc3ce04a-5be5-4f3a-acff-eceaab723759"
QEDfields = "ac3a6c97-e859-4b9f-96bb-63d2a216042c"
QEDprocesses = "46de9c38-1bb3-4547-a1ec-da24d767fdad"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"

[compat]
julia = "1.10"
Reexport = "^1.2"
QEDbase = "0.2.2"
QEDcore = "0.1"
QEDbase = "0.3"
QEDcore = "0.2"
QEDevents = "0.1"
QEDfields = "0.1"
QEDprocesses = "0.2"
Reexport = "^1.2"
julia = "1.10"

[extras]
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Expand Down

0 comments on commit 457dba2

Please sign in to comment.