2121 required : false
2222 type : boolean
2323 default : false
24- local_dependencies :
25- description : " Local Dependencies"
26- required : false
27- type : string
28- default : " "
29- local_test_dependencies :
30- description : " Local Test Dependencies"
31- required : false
32- type : string
33- default : " "
3424 test_args :
3525 description : " Test Arguments"
3626 required : false
@@ -61,55 +51,106 @@ jobs:
6151 version : ${{ inputs.julia_version }}
6252 - uses : julia-actions/cache@v2
6353 with :
64- cache-name : julia-cache;workflow=${{ inputs.julia_version }}-${{ inputs.os }}-${{ github.event_name }}-${{ inputs.project }}-${{ inputs.downgrade_testing }}-${{ inputs.local_dependencies }}-${{ inputs.local_test_dependencies }}-${{ inputs. test_args }}
54+ cache-name : julia-cache;workflow=${{ inputs.julia_version }}-${{ inputs.os }}-${{ github.event_name }}-${{ inputs.project }}-${{ inputs.downgrade_testing }}-${{ inputs.test_args }}
6555
6656 - uses : julia-actions/julia-downgrade-compat@v2.1
6757 if : ${{ inputs.downgrade_testing }}
6858 with :
6959 mode : forcedeps
70- projects : ${{ inputs.project }}
60+ projects : ${{ inputs.project }}, ${{ inputs.project }}/test
7161 julia_version : ${{ inputs.julia_version }}
7262 skip : Pkg, TOML, Statistics, LinearAlgebra, Random, Serialization, Markdown, Test, LuxCore, LuxLib, LuxTestUtils, MLDataDevices, WeightInitializers, UUIDs
7363
74- # For 1.10 we need to manually develop the packages.
64+ # For 1.10 we need to manually develop the packages from [sources] .
7565 - name : " Develop Dependencies"
7666 run : |
7767 import Pkg
78- Pkg.activate(joinpath(pwd(), get(ENV, "PROJECT", "")))
68+ import TOML
69+
70+ project = joinpath(pwd(), get(ENV, "PROJECT", ""))
71+ Pkg.activate(project)
72+ Pkg.status()
73+ Pkg.instantiate()
74+
75+ # Parse the [sources] section from the Project.toml
76+ project_toml = TOML.parsefile(joinpath(project, "Project.toml"))
77+ sources = get(project_toml, "sources", Dict())
78+
7979 dev_pkgs = Pkg.PackageSpec[]
80- for pkg in filter(!isempty, split(get(ENV, "DEV_DEPS", ""), ","))
81- push!(dev_pkgs, Pkg.PackageSpec(path=pkg))
80+ for (pkg, source) in sources
81+ if haskey(source, "path")
82+ pkg_path = joinpath(project, source["path"])
83+ push!(dev_pkgs, Pkg.PackageSpec(path=pkg_path))
84+ end
85+ end
86+
87+ if !isempty(dev_pkgs)
88+ @info "Developing dependencies: $dev_pkgs"
89+ if parse(Bool, get(ENV, "DOWNGRADE_TESTING", "false"))
90+ @info "Preserving dependencies"
91+ Pkg.develop(dev_pkgs; preserve=Pkg.PRESERVE_ALL)
92+ else
93+ Pkg.develop(dev_pkgs)
94+ end
8295 end
83- length(dev_pkgs) > 0 && Pkg.develop(dev_pkgs)
8496 shell : julia --color=yes --threads=auto {0}
85- if : ${{ ( inputs.julia_version == '1.10' || inputs.julia_version == 'lts') && inputs.local_dependencies != ' ' }}
97+ if : ${{ inputs.julia_version == '1.10' || inputs.julia_version == 'lts' }}
8698 env :
8799 PROJECT : ${{ inputs.project }}
88- DEV_DEPS : ${{ inputs.local_dependencies }}
100+ DOWNGRADE_TESTING : ${{ inputs.downgrade_testing }}
101+ JULIA_PKG_PRECOMPILE_AUTO : 0
89102
90- # For 1.11 and beyond we can use sources. For older versions we need to
91- # manually develop the packages.
103+ # For 1.11 and beyond we can use sources.
92104 - uses : julia-actions/julia-buildpkg@v1
93105 with :
94106 project : ${{ inputs.project }}
95107 precompile : true
96- if : ${{ ( inputs.julia_version != '1.10' && inputs.julia_version != 'lts') || inputs.local_dependencies == ' ' }}
108+ if : ${{ inputs.julia_version != '1.10' && inputs.julia_version != 'lts' }}
97109
98110 - name : " Develop Test Dependencies"
99111 run : |
100112 import Pkg
113+ import TOML
114+
101115 project = joinpath(pwd(), get(ENV, "PROJECT", ""))
102- Pkg.activate(joinpath(project, "test"))
103- dev_pkgs = Pkg.PackageSpec[Pkg.PackageSpec(path=project)]
104- for pkg in filter(!isempty, split(get(ENV, "TEST_DEPS", ""), ","))
105- push!(dev_pkgs, Pkg.PackageSpec(path=pkg))
116+ test_project = joinpath(project, "test")
117+ Pkg.activate(test_project)
118+ Pkg.status()
119+ Pkg.instantiate()
120+
121+ # Add the main project itself
122+ dev_pkgs = Pkg.PackageSpec[]
123+
124+ # Parse the [sources] section from the test/Project.toml
125+ test_project_toml_path = joinpath(test_project, "Project.toml")
126+ if isfile(test_project_toml_path)
127+ test_project_toml = TOML.parsefile(test_project_toml_path)
128+ sources = get(test_project_toml, "sources", Dict())
129+
130+ for (pkg, source) in sources
131+ if haskey(source, "path")
132+ pkg_path = joinpath(test_project, source["path"])
133+ push!(dev_pkgs, Pkg.PackageSpec(path=pkg_path))
134+ end
135+ end
136+ end
137+
138+ if !isempty(dev_pkgs)
139+ @info "Developing dependencies: $dev_pkgs"
140+ if parse(Bool, get(ENV, "DOWNGRADE_TESTING", "false"))
141+ @info "Preserving dependencies"
142+ Pkg.develop(dev_pkgs; preserve=Pkg.PRESERVE_ALL)
143+ else
144+ Pkg.develop(dev_pkgs)
145+ end
106146 end
107- length(dev_pkgs) > 0 && Pkg.develop(dev_pkgs)
108147 shell : julia --color=yes --threads=auto {0}
109- if : ${{ ( inputs.julia_version == '1.10' || inputs.julia_version == 'lts') && inputs.local_test_dependencies != ' ' }}
148+ if : ${{ inputs.julia_version == '1.10' || inputs.julia_version == 'lts' }}
110149 env :
111150 PROJECT : ${{ inputs.project }}
112- TEST_DEPS : ${{ inputs.local_test_dependencies }}
151+ DOWNGRADE_TESTING : ${{ inputs.downgrade_testing }}
152+ JULIA_PKG_PRECOMPILE_AUTO : 0
153+
113154 - name : " Run Tests"
114155 run : |
115156 import Pkg
@@ -118,7 +159,7 @@ jobs:
118159 const TEST_ARGS = filter(!isempty, split(get(ENV, "TEST_ARGS", "")))
119160 include(joinpath(project, "test", "runtests.jl"))
120161 shell : julia --color=yes --code-coverage=user --depwarn=yes --threads=auto --check-bounds=yes {0}
121- if : ${{ ( inputs.julia_version == '1.10' || inputs.julia_version == 'lts') && inputs.local_test_dependencies != ' ' }}
162+ if : ${{ inputs.julia_version == '1.10' || inputs.julia_version == 'lts' }}
122163 env :
123164 PROJECT : ${{ inputs.project }}
124165 TEST_ARGS : ${{ inputs.test_args }}
@@ -128,7 +169,7 @@ jobs:
128169 project : ${{ inputs.project }}
129170 test_args : ${{ inputs.test_args }}
130171 allow_reresolve : ${{ !(inputs.downgrade_testing) }}
131- if : ${{ ( inputs.julia_version != '1.10' && inputs.julia_version != 'lts') || inputs.local_test_dependencies == ' ' }}
172+ if : ${{ inputs.julia_version != '1.10' && inputs.julia_version != 'lts' }}
132173
133174 - name : " Upload MLIR modules"
134175 uses : actions/upload-artifact@v6
0 commit comments