diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 35761d43..25e74e84 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -56,21 +56,14 @@ jobs: version: '1.12' allow_failure: true steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v4 - env: - cache-name: cache-artifacts + - uses: julia-actions/cache@v2 with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} - restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- + include-matrix: false - uses: julia-actions/julia-buildpkg@latest - uses: julia-actions/julia-runtest@latest - uses: julia-actions/julia-processcoverage@v1 diff --git a/Project.toml b/Project.toml index 85d31495..606f5577 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "GeophysicalModelGenerator" uuid = "3700c31b-fa53-48a6-808a-ef22d5a84742" +version = "0.7.17" authors = ["Boris Kaus", "Marcel Thielmann"] -version = "0.7.16" [deps] Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" @@ -22,6 +22,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MeshIO = "7269a6da-0436-5bbc-96c2-40638cbb6118" NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab" NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce" +ParallelTestRunner = "d3525ed8-44d0-4b2c-a655-542cee43accc" Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" @@ -65,6 +66,7 @@ LightXML = "0.8, 0.9" MeshIO = "0.1 - 0.5" NCDatasets = "0.14" NearestNeighbors = "0.2 - 0.4" +ParallelTestRunner = "2" Parameters = "0.9 - 0.12" SpecialFunctions = "1.0, 2" StaticArrays = "1" diff --git a/ext/Gmsh_utils.jl b/ext/Gmsh_utils.jl index 128a6b09..2984326b 100644 --- a/ext/Gmsh_utils.jl +++ b/ext/Gmsh_utils.jl @@ -14,7 +14,7 @@ Reads a Gmsh file and returns a `FEData` object with info about the mesh. `tag_n """ function import_Gmsh(fname::String) - mesh = GmshDiscreteModel(fname, renumber = false) + mesh = GmshDiscreteModel(fname, renumber = false, has_affine_map = false) # Extract vertices nverts = length(mesh.grid.node_coordinates) diff --git a/src/IO.jl b/src/IO.jl index be75073b..cbf946ff 100644 --- a/src/IO.jl +++ b/src/IO.jl @@ -59,7 +59,7 @@ GeoData """ function load_GMG(filename::String, dir = pwd(); maxattempts = 5) - local_filename = "download_GMG_temp.jld2" + local_filename = "download_GMG_temp_$(getpid()).jld2" if contains(filename, "http") file_ext = download_data(filename, local_filename, dir = dir, maxattempts = maxattempts) else @@ -72,7 +72,7 @@ function load_GMG(filename::String, dir = pwd(); maxattempts = 5) # remove local temporary file if contains(filename, "http") - rm(local_filename) + rm(joinpath(dir, local_filename), force = true) end return data @@ -118,4 +118,4 @@ function download_data(url::String, local_filename = "temp.dat"; dir = pwd(), ma end return file_ext -end +end diff --git a/src/ProfileProcessing.jl b/src/ProfileProcessing.jl index 4977e05f..6fe0aff9 100644 --- a/src/ProfileProcessing.jl +++ b/src/ProfileProcessing.jl @@ -299,7 +299,7 @@ function create_profile_screenshot!(Profile::ProfileData, DataSet::NamedTuple) x_profile = flatten_cross_section(data_tmp, Start = Profile.start_lonlat) # compute the distance along the profile data_tmp = addfield(data_tmp, "x_profile", x_profile) - # add the data set as a NamedTuple + # add the data set as a NamedTuple data_NT = NamedTuple{(DataSetName[idata],)}((data_tmp,)) tmp = merge(tmp, data_NT) else @@ -414,8 +414,6 @@ function extract_ProfileData!(Profile::ProfileData, VolData::Union{Nothing, GeoD end - - """ This reads the picked profiles from disk and returns a vector of ProfileData """ diff --git a/src/data_import.jl b/src/data_import.jl index e983f305..d6cbbdf0 100644 --- a/src/data_import.jl +++ b/src/data_import.jl @@ -366,15 +366,15 @@ function tomo_2_GeoData(filename::String; vel_type::String = "vs") # Extract the variables depth = data["depth"][:] - lon = data["longitude"][:] - lat = data["latitude"][:] - vel = data[vel_type][:,:,:] + lon = data["longitude"][:] + lat = data["latitude"][:] + vel = data[vel_type][:, :, :] # create lon, lat, depth grid Lon, Lat, Depth = lonlatdepth_grid(lon, lat, .- depth) # create GeoData struct - Tomo_data = GeoData(Lon, Lat, Depth, (vel=vel,)) + Tomo_data = GeoData(Lon, Lat, Depth, (vel = vel,)) return Tomo_data -end \ No newline at end of file +end diff --git a/test/runtests.jl b/test/runtests.jl index 12ea9bb9..d681790c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,104 +1,25 @@ using GeophysicalModelGenerator -using Test +using ParallelTestRunner -@testset verbose = true "GeophysicalModelGenerator" begin +testsuite = find_tests(@__DIR__) - @testset "Data import.jl" begin - include("test_data_import.jl") - end - @testset "Data types.jl" begin - include("test_data_types.jl") - end - @testset "Paraview" begin - include("test_paraview.jl") - end - @testset "Paraview collection" begin - include("test_paraview_collection.jl") - end - @testset "Gravity model" begin - include("test_voxel_gravity.jl") - end - @testset "Nearest points" begin - include("test_nearest_points.jl") - end - @testset "Utils" begin - include("test_utils.jl") - end - @testset "Transformations" begin - include("test_transformation.jl") - end - @testset "Surfaces" begin - include("test_surfaces.jl") - end - - @testset "LaMEM" begin - include("test_lamem.jl") - end - - @testset "pTatin" begin - include("test_pTatin_IO.jl") - end - - @testset "SetupGeometry" begin - include("test_setup_geometry.jl") - end - - @testset "STL" begin - include("test_stl.jl") - end - - @testset "IO" begin - include("test_IO.jl") - end - - @testset "ProfileProcessing" begin - include("test_ProfileProcessing.jl") - end - - @testset "GMT integration" begin - include("test_GMT.jl") - end - - @testset "Gmsh integration" begin - include("test_Gmsh.jl") - end - - @testset "Event counts" begin - include("test_event_counts.jl") - end - @testset "Create movie" begin - include("test_create_movie.jl") - end - - @testset "Sea level" begin - include("test_sea_level.jl") - end - - @testset "Ridge Thermal Structure Tests" begin - include("test_ridge_segments.jl") - end - - @testset "Plate Tests" begin - include("test_plate.jl") - end - - @testset "Waterflow" begin - include("test_WaterFlow.jl") - end - - @testset "ASAGI_IO" begin - include("test_ASAGI_IO.jl") +# Add `using GeophysicalModelGenerator` to each test +for (name, expr) in testsuite + if name != "test_tutorials" # Tutorials are standalone + testsuite[name] = quote + using GeophysicalModelGenerator + $expr + end end +end - @testset "Chmy" begin - include("test_Chmy.jl") +try + ParallelTestRunner.runtests(GeophysicalModelGenerator, ARGS; testsuite) +finally + # Cleanup + foreach(f -> rm(joinpath(@__DIR__, f)), filter(endswith(".vts"), readdir(@__DIR__))) + foreach(f -> rm(joinpath(@__DIR__, f)), filter(endswith(".vtu"), readdir(@__DIR__))) + if isdir(joinpath(@__DIR__, "markers")) + rm(joinpath(@__DIR__, "markers"), recursive = true) end end - -# Include tutorials -include("test_tutorials.jl") - -# Cleanup -foreach(rm, filter(endswith(".vts"), readdir())) -foreach(rm, filter(endswith(".vtu"), readdir())) -rm("./markers/", recursive = true) diff --git a/test/test_setup_geometry.jl b/test/test_setup_geometry.jl index 977bf7e1..0607c9b0 100644 --- a/test/test_setup_geometry.jl +++ b/test/test_setup_geometry.jl @@ -1,5 +1,5 @@ # test setting geometries in the different grid types -using Test, GeophysicalModelGenerator, GeoParams +using Test, GeophysicalModelGenerator, GeoParams, Statistics # GeoData Lon3D, Lat3D, Depth3D = lonlatdepth_grid(1.0:1:10.0, 11.0:1:20.0, (-20:1:-10) * km);