1
+ export Configuration
2
+
1
3
function prepare_runner ()
2
4
for runner in (" ubuntu" , " arch" )
3
5
cd (joinpath (dirname (@__DIR__ ), " runner.$runner " )) do
@@ -460,26 +462,34 @@ function kill_container(container)
460
462
Base. run (cmd)
461
463
end
462
464
463
- function run (julia_versions:: Vector{VersionNumber} , pkgs:: Vector ;
465
+ struct Configuration
466
+ julia:: VersionNumber
467
+ compiled:: Bool
468
+ # TODO : depwarn, checkbounds, etc
469
+ end
470
+
471
+ Configuration (julia:: VersionNumber ) = new (julia, false )
472
+
473
+ function run (configs:: Vector{Configuration} , pkgs:: Vector ;
464
474
ninstances:: Integer = Sys. CPU_THREADS, retries:: Integer = 2 , kwargs... )
465
475
# here we deal with managing execution: spawning workers, output, result I/O, etc
466
476
467
477
prepare_runner ()
468
478
469
479
# Julia installation and local cache
470
- julia_environments = Dict {VersionNumber ,Tuple{String,String}} ()
471
- for julia in julia_versions
472
- install = prepare_julia (julia)
480
+ instantiated_configs = Dict {Configuration ,Tuple{String,String}} ()
481
+ for config in configs
482
+ install = prepare_julia (config . julia)
473
483
cache = mktempdir ()
474
- julia_environments[julia ] = (install, cache)
484
+ instantiated_configs[config ] = (install, cache)
475
485
end
476
486
477
487
# global storage
478
488
storage = storage_dir ()
479
489
mkpath (storage)
480
490
481
491
# make sure data is writable
482
- for (julia , (install,cache)) in julia_environments
492
+ for (config , (install,cache)) in instantiated_configs
483
493
Base. run (``` docker run --mount type=bind,source=$storage ,target=/storage
484
494
--mount type=bind,source=$cache ,target=/cache
485
495
newpkgeval:ubuntu
@@ -501,16 +511,14 @@ function run(julia_versions::Vector{VersionNumber}, pkgs::Vector;
501
511
JSON. parse (body)
502
512
end
503
513
504
- jobs = [(julia= julia, install= install, cache= cache,
505
- pkg= pkg) for (julia,(install,cache)) in julia_environments
506
- for pkg in pkgs]
514
+ jobs = vec (collect (Iterators. product (instantiated_configs, pkgs)))
507
515
508
516
# use a random test order to (hopefully) get a more reasonable ETA
509
517
shuffle! (jobs)
510
518
511
519
njobs = length (jobs)
512
520
ninstances = min (njobs, ninstances)
513
- running = Vector {Union{Nothing, eltype(jobs)} } (nothing , ninstances)
521
+ running = Vector {Any } (nothing , ninstances)
514
522
times = DateTime[now () for i = 1 : ninstances]
515
523
all_workers = Task[]
516
524
@@ -572,7 +580,8 @@ function run(julia_versions::Vector{VersionNumber}, pkgs::Vector;
572
580
str = if job === nothing
573
581
" #$i : -------"
574
582
else
575
- " #$i : $(job. pkg. name) @ $(job. julia) ($(runtimestr (times[i])) )"
583
+ config, pkg = job
584
+ " #$i : $(pkg. name) @ $(config. julia) ($(runtimestr (times[i])) )"
576
585
end
577
586
if i% 2 == 1 && i < ninstances
578
587
print (io, rpad (str, 50 ))
@@ -590,6 +599,7 @@ function run(julia_versions::Vector{VersionNumber}, pkgs::Vector;
590
599
end
591
600
592
601
result = DataFrame (julia = VersionNumber[],
602
+ compiled = Bool[],
593
603
name = String[],
594
604
uuid = UUID[],
595
605
version = Union{Missing,VersionNumber}[],
@@ -612,44 +622,45 @@ function run(julia_versions::Vector{VersionNumber}, pkgs::Vector;
612
622
end
613
623
614
624
# Workers
625
+ # TODO : we don't want to do this for both. but rather one of the builds is compiled, the other not...
615
626
try @sync begin
616
627
for i = 1 : ninstances
617
628
push! (all_workers, @async begin
618
629
try
619
630
while ! isempty (jobs) && ! done
620
- job = pop! (jobs)
631
+ (config, (install, cache)), pkg = pop! (jobs)
621
632
times[i] = now ()
622
- running[i] = job
633
+ running[i] = (config, pkg)
623
634
624
635
# can we even test this package?
625
636
julia_supported = Dict {VersionNumber,Bool} ()
626
637
if VERSION >= v " 1.5"
627
638
ctx = Pkg. Types. Context ()
628
- pkg_version_info = Pkg. Operations. load_versions (ctx, job . pkg. path)
639
+ pkg_version_info = Pkg. Operations. load_versions (ctx, pkg. path)
629
640
pkg_versions = sort! (collect (keys (pkg_version_info)))
630
641
pkg_compat =
631
642
Pkg. Operations. load_package_data (Pkg. Types. VersionSpec,
632
- joinpath (job . pkg. path,
643
+ joinpath (pkg. path,
633
644
" Compat.toml" ),
634
645
pkg_versions)
635
646
for (pkg_version, bounds) in pkg_compat
636
647
if haskey (bounds, " julia" )
637
648
julia_supported[pkg_version] =
638
- job . julia ∈ bounds[" julia" ]
649
+ config . julia ∈ bounds[" julia" ]
639
650
end
640
651
end
641
652
else
642
- pkg_version_info = Pkg. Operations. load_versions (job . pkg. path)
653
+ pkg_version_info = Pkg. Operations. load_versions (pkg. path)
643
654
pkg_compat =
644
655
Pkg. Operations. load_package_data_raw (Pkg. Types. VersionSpec,
645
- joinpath (job . pkg. path,
656
+ joinpath (pkg. path,
646
657
" Compat.toml" ))
647
658
for (version_range, bounds) in pkg_compat
648
659
if haskey (bounds, " julia" )
649
660
for pkg_version in keys (pkg_version_info)
650
661
if pkg_version in version_range
651
662
julia_supported[pkg_version] =
652
- job . julia ∈ bounds[" julia" ]
663
+ config . julia ∈ bounds[" julia" ]
653
664
end
654
665
end
655
666
end
@@ -663,37 +674,43 @@ function run(julia_versions::Vector{VersionNumber}, pkgs::Vector;
663
674
supported = any (values (julia_supported))
664
675
end
665
676
if ! supported
666
- push! (result, [job. julia, job. pkg. name, job. pkg. uuid, missing ,
677
+ push! (result, [config. julia, config. compiled,
678
+ pkg. name, pkg. uuid, missing ,
667
679
:skip , :unsupported , 0 , missing ])
668
680
continue
669
- elseif job. pkg. name in skip_lists[job. pkg. registry]
670
- push! (result, [job. julia, job. pkg. name, job. pkg. uuid, missing ,
681
+ elseif pkg. name in skip_lists[pkg. registry]
682
+ push! (result, [config. julia, config. compiled,
683
+ pkg. name, pkg. uuid, missing ,
671
684
:skip , :explicit , 0 , missing ])
672
685
continue
673
- elseif endswith (job. pkg. name, " _jll" )
674
- push! (result, [job. julia, job. pkg. name, job. pkg. uuid, missing ,
686
+ elseif endswith (pkg. name, " _jll" )
687
+ push! (result, [config. julia, config. compiled,
688
+ pkg. name, pkg. uuid, missing ,
675
689
:skip , :jll , 0 , missing ])
676
690
continue
677
691
end
678
692
693
+ runner = config. compiled ? run_compiled_test : run_sandboxed_test
694
+
679
695
# perform an initial run
680
696
pkg_version, status, reason, log =
681
- run_sandboxed_test (job . install, job . pkg; cache= job . cache,
682
- storage= storage, cpus= [i- 1 ], kwargs... )
697
+ runner ( install, pkg; cache= cache,
698
+ storage= storage, cpus= [i- 1 ], kwargs... )
683
699
684
700
# certain packages are known to have flaky tests; retry them
685
701
for j in 1 : retries
686
702
if status == :fail && reason == :test_failures &&
687
- job . pkg. name in retry_lists[job . pkg. registry]
703
+ pkg. name in retry_lists[pkg. registry]
688
704
times[i] = now ()
689
705
pkg_version, status, reason, log =
690
- run_sandboxed_test (job . install, job . pkg; cache= job . cache,
691
- storage= storage, cpus= [i- 1 ], kwargs... )
706
+ runner ( install, pkg; cache= cache,
707
+ storage= storage, cpus= [i- 1 ], kwargs... )
692
708
end
693
709
end
694
710
695
711
duration = (now ()- times[i]) / Millisecond (1000 )
696
- push! (result, [job. julia, job. pkg. name, job. pkg. uuid, pkg_version,
712
+ push! (result, [config. julia, config. compiled,
713
+ pkg. name, pkg. uuid, pkg_version,
697
714
status, reason, duration, log])
698
715
running[i] = nothing
699
716
end
@@ -711,7 +728,7 @@ function run(julia_versions::Vector{VersionNumber}, pkgs::Vector;
711
728
println ()
712
729
713
730
# clean-up
714
- for (julia , (install,cache)) in julia_environments
731
+ for (config , (install,cache)) in instantiated_configs
715
732
rm (install; recursive= true )
716
733
uid = ccall (:getuid , Cint, ())
717
734
gid = ccall (:getgid , Cint, ())
@@ -726,21 +743,24 @@ function run(julia_versions::Vector{VersionNumber}, pkgs::Vector;
726
743
end
727
744
728
745
"""
729
- run(julia_versions ::Vector{VersionNumber }=[Base.VERSION],
746
+ run(configs ::Vector{Configuration }=[Configuration(julia= Base.VERSION) ],
730
747
pkg_names::Vector{String}=[]]; registry=General, update_registry=true, kwargs...)
731
748
732
749
Run all tests for all packages in the registry `registry`, or only for the packages as
733
- identified by their name in `pkgnames`, using Julia versions `julia_versions `.
750
+ identified by their name in `pkgnames`, using the configurations from `configs `.
734
751
The registry is first updated if `update_registry` is set to true.
735
752
736
753
Refer to `run_sandboxed_test`[@ref] and `run_sandboxed_julia`[@ref] for more possible
737
754
keyword arguments.
738
755
"""
739
- function run (julia_versions :: Vector{VersionNumber } = [Base. VERSION ],
756
+ function run (configs :: Vector{Configuration } = [Configuration ( Base. VERSION ) ],
740
757
pkg_names:: Vector{String} = String[];
741
758
registry:: String = DEFAULT_REGISTRY, update_registry:: Bool = true , kwargs... )
742
759
prepare_registry (registry; update= update_registry)
743
760
pkgs = read_pkgs (pkg_names)
744
761
745
- run (julia_versions , pkgs; kwargs... )
762
+ run (configs , pkgs; kwargs... )
746
763
end
764
+
765
+ run (julia_versions:: Vector{VersionNumber} , args... ; kwargs... ) =
766
+ run (Configuration .(julia_versions), args... ; kwargs... )
0 commit comments