Skip to content

Commit c006452

Browse files
Merge pull request #176 from StructuralEquationModels/devel
fix local testing, fix nlopt constrained tests
2 parents 0ebcadb + 6544ee9 commit c006452

File tree

7 files changed

+14
-13
lines changed

7 files changed

+14
-13
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
1010
runs-on: ${{ matrix.os }}
1111
env:
12+
JULIA_ON_CI: true
1213
JULIA_NUM_THREADS: 8
1314
JULIA_EXTENDED_TESTS: false
1415
strategy:

.github/workflows/CI_ecosystem.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
1313
runs-on: ${{ matrix.os }}
1414
env:
15+
JULIA_ON_CI: true
1516
JULIA_NUM_THREADS: 8
1617
JULIA_EXTENDED_TESTS: true
1718
strategy:
1819
fail-fast: false
1920
matrix:
2021
version:
2122
- '1'
22-
- '1.9'
2323
os:
2424
- ubuntu-latest
2525
- macos-latest

.github/workflows/CI_extended.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
1313
runs-on: ${{ matrix.os }}
1414
env:
15+
JULIA_ON_CI: true
1516
JULIA_NUM_THREADS: 8
1617
JULIA_EXTENDED_TESTS: true
1718
strategy:
1819
fail-fast: false
1920
matrix:
2021
version:
2122
- '1'
22-
- '1.9'
2323
os:
2424
- ubuntu-latest
2525
- macos-latest

test/examples/political_democracy/constraints.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ end
2323
constrained_optimizer = SemOptimizerNLopt(;
2424
algorithm = :AUGLAG,
2525
local_algorithm = :LD_LBFGS,
26-
local_options = Dict(
27-
:ftol_rel => 1e-6
28-
),
26+
options = Dict(:xtol_rel => 1e-4),
2927
# equality_constraints = NLoptConstraint(;f = eq_constraint, tol = 1e-14),
30-
inequality_constraints = NLoptConstraint(;f = ineq_constraint, tol = 0.0),
28+
inequality_constraints = NLoptConstraint(;f = ineq_constraint, tol = 1e-8),
3129
)
3230

3331
model_ml_constrained = Sem(
@@ -59,7 +57,7 @@ end
5957

6058
@testset "ml_solution_constrained" begin
6159
solution_constrained = sem_fit(model_ml_constrained)
62-
@test solution_constrained.solution[31]*solution_constrained.solution[30] >= 0.6
60+
@test solution_constrained.solution[31]*solution_constrained.solution[30] >= (0.6-1e-8)
6361
@test all(abs.(solution_constrained.solution) .< 10)
6462
@test solution_constrained.optimization_result.result[3] == :FTOL_REACHED skip=true
6563
@test abs(solution_constrained.minimum - 21.21) < 0.01

test/examples/political_democracy/political_democracy.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ semoptimizer = SemOptimizerOptim
9797
semoptimizer = SemOptimizerNLopt
9898
@testset "RAMMatrices | constructor | NLopt" begin include("constructor.jl") end
9999

100-
if ENV["JULIA_EXTENDED_TESTS"] == "true"
100+
if !haskey(ENV, "JULIA_EXTENDED_TESTS") || ENV["JULIA_EXTENDED_TESTS"] == "true"
101101
semoptimizer = SemOptimizerOptim
102102
@testset "RAMMatrices | parts | Optim" begin include("by_parts.jl") end
103103
semoptimizer = SemOptimizerNLopt
@@ -121,7 +121,7 @@ semoptimizer = SemOptimizerOptim
121121
semoptimizer = SemOptimizerNLopt
122122
@testset "RAMMatrices → ParameterTable | constructor | NLopt" begin include("constructor.jl") end
123123

124-
if ENV["JULIA_EXTENDED_TESTS"] == "true"
124+
if !haskey(ENV, "JULIA_EXTENDED_TESTS") || ENV["JULIA_EXTENDED_TESTS"] == "true"
125125
semoptimizer = SemOptimizerOptim
126126
@testset "RAMMatrices → ParameterTable | parts | Optim" begin include("by_parts.jl") end
127127
semoptimizer = SemOptimizerNLopt
@@ -205,7 +205,7 @@ semoptimizer = SemOptimizerOptim
205205
semoptimizer = SemOptimizerNLopt
206206
@testset "Graph → ParameterTable | constructor | NLopt" begin include("constructor.jl") end
207207

208-
if ENV["JULIA_EXTENDED_TESTS"] == "true"
208+
if !haskey(ENV, "JULIA_EXTENDED_TESTS") || ENV["JULIA_EXTENDED_TESTS"] == "true"
209209
semoptimizer = SemOptimizerOptim
210210
@testset "Graph → ParameterTable | parts | Optim" begin include("by_parts.jl") end
211211
semoptimizer = SemOptimizerNLopt

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ using Test, SafeTestsets
33
@time @safetestset "Unit Tests" begin include("unit_tests/unit_tests.jl") end
44
@time @safetestset "Example Models" begin include("examples/examples.jl") end
55

6-
if ENV["JULIA_EXTENDED_TESTS"] == "true"
6+
if !haskey(ENV, "JULIA_EXTENDED_TESTS") || ENV["JULIA_EXTENDED_TESTS"] == "true"
77

88
end

test/unit_tests/multithreading.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using Test
22

3-
@testset "multithreading_enabled" begin
4-
@test Threads.nthreads() == 8
3+
if haskey(ENV, "JULIA_ON_CI")
4+
@testset "multithreading_enabled" begin
5+
@test Threads.nthreads() == 8
6+
end
57
end

0 commit comments

Comments
 (0)