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
29 changes: 6 additions & 23 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,9 @@ on:
paths-ignore:
- 'docs/**'
jobs:
test:
runs-on: ubuntu-latest
container:
image: cmhyett/julia-fenics:latest

strategy:
fail-fast: false
matrix:
group:
- Core
version:
- 'lts'
- '1'
- 'pre'
steps:
- uses: actions/checkout@v6

- uses: julia-actions/setup-julia@v3
with:
version: ${{ matrix.version }}

- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
tests:
uses: "SciML/.github/.github/workflows/grouped-tests.yml@v1"
with:
coverage: false
container: "cmhyett/julia-fenics:latest"
secrets: "inherit"
9 changes: 7 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,20 @@ OrdinaryDiffEqSDIRK = "1, 2"
ProgressMeter = "1.2"
PyCall = "1.90"
Requires = "0.5, 1.0"
SafeTestsets = "0.1, 1"
SciMLTesting = "1"
SpecialFunctions = "0.8, 0.9, 1.2, 2"
julia = "1.6"
Test = "1"
julia = "1.10"

[extras]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
OrdinaryDiffEqSDIRK = "2d112036-d095-4a1e-ab9a-08536f3ecdbf"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["ADTypes", "ExplicitImports", "Test", "OrdinaryDiffEq", "OrdinaryDiffEqSDIRK"]
test = ["ADTypes", "ExplicitImports", "Test", "OrdinaryDiffEq", "OrdinaryDiffEqSDIRK", "SafeTestsets", "SciMLTesting"]
53 changes: 53 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using FEniCS
using Test

FEniCS.set_log_level(FEniCS.WARNING)

@testset "Explicit Imports" begin
include("explicit_imports.jl")
end

examples_dir = joinpath(@__DIR__, "..", "examples")
@assert ispath(examples_dir)
example_filenames = readdir(examples_dir)
@assert "tutorial1.jl" in example_filenames

@testset "Example $(filename)" for filename in example_filenames
path = joinpath(examples_dir, filename)
@test (include(path); true)
# Test that PyCall is not used in the example.
# Use of PyCall indicates, that we did not wrap enough
# functionality
s = read(path, String)
@test !occursin("PyCall", s)
end

@testset "Creation" begin
@test include("test_create.jl")
@test include("test_pycreate.jl")
@test include("test_jfem.jl")
end

@testset "assign" begin
mesh = UnitIntervalMesh(10)
V = FunctionSpace(mesh, "P", 1)
u = interpolate(Expression("x[0]", degree = 1), V)
arr1 = get_array(u)
arr2 = randn(size(arr1))
assign(u, arr2)
@test get_array(u) == arr2
assign(u, arr1)
@test get_array(u) == arr1
end

#tests relating to interface.jl file
@testset "Interface" begin
global mesh = UnitSquareMesh(2, 2)
dbc(x, y) = 1
global u = feMesh(mesh, dbc)
@test (u.n_nodes == 9)
@test (u.n_elements == 8)
@test (u.n_internal_nodes == 1)
@test (u.n_boundary_nodes == 8)
@test (u.node_vals == [1, 1, 1, 1, 0, 1, 1, 1, 1])
end
18 changes: 18 additions & 0 deletions test/qa/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
FEniCS = "186dfeec-b415-5c13-8e76-5fbf19f56f9b"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
FEniCS = {path = "../.."}

[compat]
Aqua = "0.8"
JET = "0.9,0.10,0.11"
SafeTestsets = "0.1, 1"
SciMLTesting = "1"
Test = "1"
julia = "1.10"
9 changes: 9 additions & 0 deletions test/qa/qa.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using FEniCS, Aqua, JET, Test

@testset "Aqua" begin
Aqua.test_all(FEniCS)
end

@testset "JET" begin
JET.test_package(FEniCS; target_defined_modules = true)
end
68 changes: 16 additions & 52 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,53 +1,17 @@
using FEniCS
using Test
using SciMLTesting

FEniCS.set_log_level(FEniCS.WARNING)

@testset "Explicit Imports" begin
include("explicit_imports.jl")
end

examples_dir = joinpath(@__DIR__, "..", "examples")
@assert ispath(examples_dir)
example_filenames = readdir(examples_dir)
@assert "tutorial1.jl" in example_filenames

@testset "Example $(filename)" for filename in example_filenames
path = joinpath(examples_dir, filename)
@test (include(path); true)
# Test that PyCall is not used in the example.
# Use of PyCall indicates, that we did not wrap enough
# functionality
s = read(path, String)
@test !occursin("PyCall", s)
end

@testset "Creation" begin
@test include("test_create.jl")
@test include("test_pycreate.jl")
@test include("test_jfem.jl")
end;

@testset "assign" begin
mesh = UnitIntervalMesh(10)
V = FunctionSpace(mesh, "P", 1)
u = interpolate(Expression("x[0]", degree = 1), V)
arr1 = get_array(u)
arr2 = randn(size(arr1))
assign(u, arr2)
@test get_array(u) == arr2
assign(u, arr1)
@test get_array(u) == arr1
end

#tests relating to interface.jl file
@testset "Interface" begin
global mesh = UnitSquareMesh(2, 2)
dbc(x, y) = 1
global u = feMesh(mesh, dbc)
@test (u.n_nodes == 9)
@test (u.n_elements == 8)
@test (u.n_internal_nodes == 1)
@test (u.n_boundary_nodes == 8)
@test (u.node_vals == [1, 1, 1, 1, 0, 1, 1, 1, 1])
end;
run_tests(;
# Core orchestrates the example sweep and inline FEniCS testsets in a single
# body (core.jl) rather than as independent per-file groups, so it is passed
# explicitly instead of being discovered as a folder.
core = joinpath(@__DIR__, "core.jl"),
groups = Dict(
"QA" => (;
env = joinpath(@__DIR__, "qa"),
body = joinpath(@__DIR__, "qa", "qa.jl"),
),
),
# The original ran only the Core body for the default GROUP="All"; QA ran only
# when explicitly selected (it exited early before loading FEniCS).
all = ["Core"],
)
5 changes: 5 additions & 0 deletions test/test_groups.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Core]
versions = ["lts", "1", "pre"]

[QA]
versions = ["lts", "1"]
Loading