diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27d10bbff2..d8299fbaf7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,66 +6,50 @@ on: - release-* pull_request: types: [opened, synchronize, reopened] +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} # needed to allow julia-actions/cache to delete old caches that it has created permissions: actions: write contents: read jobs: test: - name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ matrix.moi_test_modules }} - ${{ github.event_name }} - runs-on: ${{ matrix.os }} + name: Julia ${{ matrix.machine.version }} - ${{ matrix.machine.os }}-${{ matrix.machine.arch }} - ${{ matrix.moi_test_modules }} + runs-on: ${{ matrix.machine.os }} strategy: fail-fast: false matrix: - # Since MOI doesn't have binary dependencies, only test on a subset of - # possible platforms. - include: + moi_test_modules: + - 'General;Benchmarks;FileFormats;Nonlinear' + - 'Bridges' + - 'Bridges/Constraint;Bridges/Objective;Bridges/Variable' + - 'Test' + - 'Utilities' + machine: - version: 'nightly' os: ubuntu-latest arch: x64 - moi_test_modules: 'General;Nonlinear;Bridges;FileFormats' - - version: 'nightly' - os: ubuntu-latest - arch: x64 - moi_test_modules: 'Test;Utilities;Benchmarks' - - version: '1' - os: ubuntu-latest - arch: x64 - moi_test_modules: 'General;Nonlinear;Bridges;FileFormats' - version: '1' os: ubuntu-latest arch: x64 - moi_test_modules: 'Test;Utilities;Benchmarks' - version: '1' os: windows-latest arch: x64 - moi_test_modules: 'General;Nonlinear;Bridges;FileFormats' - - version: '1' - os: windows-latest - arch: x64 - moi_test_modules: 'Test;Utilities;Benchmarks' - - version: '1.6' - os: ubuntu-latest - arch: x64 - moi_test_modules: 'General;Nonlinear;Bridges;FileFormats' - version: '1.6' os: ubuntu-latest arch: x64 - moi_test_modules: 'Test;Utilities;Benchmarks' - - version: '1' - os: ubuntu-latest - arch: x86 - moi_test_modules: 'General;Nonlinear;Bridges;FileFormats' - version: '1' os: ubuntu-latest arch: x86 - moi_test_modules: 'Test;Utilities;Benchmarks' steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v2 with: - version: ${{ matrix.version }} - arch: ${{ matrix.arch }} + version: ${{ matrix.machine.version }} + arch: ${{ matrix.machine.arch }} - uses: julia-actions/cache@v1 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 diff --git a/test/Benchmarks/Benchmarks.jl b/test/Benchmarks/runtests.jl similarity index 100% rename from test/Benchmarks/Benchmarks.jl rename to test/Benchmarks/runtests.jl diff --git a/test/Bridges/Bridges.jl b/test/Bridges/Bridges.jl deleted file mode 100644 index b5abf078f8..0000000000 --- a/test/Bridges/Bridges.jl +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2017: Miles Lubin and contributors -# Copyright (c) 2017: Google Inc. -# -# Use of this source code is governed by an MIT-style license that can be found -# in the LICENSE.md file or at https://opensource.org/licenses/MIT. - -using Test - -function _timed_include(file) - println("Testing ", file) - start = time() - include(file) - run_time = round(time() - start, digits = 1) - return println(" Took $(run_time) seconds") -end - -@testset "$(dir)" for dir in [".", "Variable", "Constraint", "Objective"] - @testset "$(file)" for file in readdir(joinpath(@__DIR__, dir)) - if !endswith(file, ".jl") - continue - elseif (dir == ".") && (file == "Bridges.jl" || file == "utilities.jl") - continue - end - _timed_include(joinpath(@__DIR__, dir, file)) - end -end diff --git a/test/Bridges/Constraint/runtests.jl b/test/Bridges/Constraint/runtests.jl new file mode 100644 index 0000000000..7f9712e994 --- /dev/null +++ b/test/Bridges/Constraint/runtests.jl @@ -0,0 +1,14 @@ +# Copyright (c) 2017: Miles Lubin and contributors +# Copyright (c) 2017: Google Inc. +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + +using Test + +@testset "$(file)" for file in readdir(@__DIR__; join = true) + if !endswith(file, ".jl") || endswith(file, "runtests.jl") + continue + end + include(file) +end diff --git a/test/Bridges/Objective/runtests.jl b/test/Bridges/Objective/runtests.jl new file mode 100644 index 0000000000..7f9712e994 --- /dev/null +++ b/test/Bridges/Objective/runtests.jl @@ -0,0 +1,14 @@ +# Copyright (c) 2017: Miles Lubin and contributors +# Copyright (c) 2017: Google Inc. +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + +using Test + +@testset "$(file)" for file in readdir(@__DIR__; join = true) + if !endswith(file, ".jl") || endswith(file, "runtests.jl") + continue + end + include(file) +end diff --git a/test/Bridges/Variable/runtests.jl b/test/Bridges/Variable/runtests.jl new file mode 100644 index 0000000000..7f9712e994 --- /dev/null +++ b/test/Bridges/Variable/runtests.jl @@ -0,0 +1,14 @@ +# Copyright (c) 2017: Miles Lubin and contributors +# Copyright (c) 2017: Google Inc. +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + +using Test + +@testset "$(file)" for file in readdir(@__DIR__; join = true) + if !endswith(file, ".jl") || endswith(file, "runtests.jl") + continue + end + include(file) +end diff --git a/test/Bridges/runtests.jl b/test/Bridges/runtests.jl new file mode 100644 index 0000000000..df1f74142c --- /dev/null +++ b/test/Bridges/runtests.jl @@ -0,0 +1,15 @@ +# Copyright (c) 2017: Miles Lubin and contributors +# Copyright (c) 2017: Google Inc. +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + +using Test + +files_to_exclude = ["runtests.jl", "sdpa_models.jl", "utilities.jl"] +@testset "$(file)" for file in readdir(@__DIR__; join = true) + if !endswith(file, ".jl") || any(f -> endswith(file, f), files_to_exclude) + continue + end + include(file) +end diff --git a/test/FileFormats/FileFormats.jl b/test/FileFormats/runtests.jl similarity index 100% rename from test/FileFormats/FileFormats.jl rename to test/FileFormats/runtests.jl diff --git a/test/attributes.jl b/test/General/attributes.jl similarity index 100% rename from test/attributes.jl rename to test/General/attributes.jl diff --git a/test/constraints.jl b/test/General/constraints.jl similarity index 100% rename from test/constraints.jl rename to test/General/constraints.jl diff --git a/test/dummy.jl b/test/General/dummy.jl similarity index 100% rename from test/dummy.jl rename to test/General/dummy.jl diff --git a/test/errors.jl b/test/General/errors.jl similarity index 100% rename from test/errors.jl rename to test/General/errors.jl diff --git a/test/functions.jl b/test/General/functions.jl similarity index 100% rename from test/functions.jl rename to test/General/functions.jl diff --git a/test/instantiate.jl b/test/General/instantiate.jl similarity index 100% rename from test/instantiate.jl rename to test/General/instantiate.jl diff --git a/test/General/runtests.jl b/test/General/runtests.jl new file mode 100644 index 0000000000..aafbb6d557 --- /dev/null +++ b/test/General/runtests.jl @@ -0,0 +1,22 @@ +# Copyright (c) 2017: Miles Lubin and contributors +# Copyright (c) 2017: Google Inc. +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + +using Test + +import MathOptInterface as MOI + +@test isempty(Test.detect_ambiguities(MOI; recursive = true)) + +for file in readdir(@__DIR__) + if file in ["issue980.jl", "dummy.jl", "hygiene.jl", "runtests.jl"] + continue + elseif !endswith(file, ".jl") + continue + end + @testset "$(file)" begin + include(file) + end +end diff --git a/test/sets.jl b/test/General/sets.jl similarity index 100% rename from test/sets.jl rename to test/General/sets.jl diff --git a/test/Nonlinear/Nonlinear.jl b/test/Nonlinear/Nonlinear.jl index d233c6eae4..ba60fff1a2 100644 --- a/test/Nonlinear/Nonlinear.jl +++ b/test/Nonlinear/Nonlinear.jl @@ -1423,5 +1423,3 @@ end end # TestNonlinear TestNonlinear.runtests() - -include("ReverseAD.jl") diff --git a/test/Nonlinear/runtests.jl b/test/Nonlinear/runtests.jl new file mode 100644 index 0000000000..9f5e3681bc --- /dev/null +++ b/test/Nonlinear/runtests.jl @@ -0,0 +1,8 @@ +# Copyright (c) 2017: Miles Lubin and contributors +# Copyright (c) 2017: Google Inc. +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + +include("Nonlinear.jl") +include("ReverseAD.jl") diff --git a/test/Test/Test.jl b/test/Test/runtests.jl similarity index 100% rename from test/Test/Test.jl rename to test/Test/runtests.jl diff --git a/test/Utilities/Utilities.jl b/test/Utilities/runtests.jl similarity index 91% rename from test/Utilities/Utilities.jl rename to test/Utilities/runtests.jl index 74c5af9b1e..8c78fb81d1 100644 --- a/test/Utilities/Utilities.jl +++ b/test/Utilities/runtests.jl @@ -7,7 +7,7 @@ using Test for file in readdir(@__DIR__) - if file in ["Utilities.jl"] + if file == "runtests.jl" continue end @testset "$(file)" begin diff --git a/test/runtests.jl b/test/runtests.jl index c4acc9c9ac..3f54349f4d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -11,6 +11,9 @@ # * General # * Benchmarks # * Bridges +# * Bridges/Constraint +# * Bridges/Objective +# * Bridges/Variable # * FileFormats # * Nonlinear # * Test @@ -19,38 +22,17 @@ # If present, the tests run only those submodules defined above. `General` is # not a submodule, but it runs all of the top-level tests in MOI. -using Test - # This file gets called first. If it doesn't crash, all is well. include("issue980.jl") -import MathOptInterface as MOI - MODULES_TO_TEST = get( ENV, "MOI_TEST_MODULES", - "General;Benchmarks;Bridges;FileFormats;Nonlinear;Test;Utilities", + "General;Benchmarks;Bridges;Bridges/Constraint;Bridges/Objective;Bridges/Variable;FileFormats;Nonlinear;Test;Utilities", ) -if occursin("General", MODULES_TO_TEST) - @test isempty(Test.detect_ambiguities(MOI; recursive = true)) - for file in readdir(@__DIR__) - if file in ["issue980.jl", "dummy.jl", "hygiene.jl", "runtests.jl"] - continue - elseif !endswith(file, ".jl") - continue - end - @testset "$(file)" begin - include(file) - end - end -end - for submodule in split(MODULES_TO_TEST, ";") - if submodule == "General" - continue - end - include("$(submodule)/$(submodule).jl") + include("$(submodule)/runtests.jl") GC.gc() # Force GC run here to reduce memory pressure end