Skip to content

Make the GitHub actions script more parallel #2674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 2, 2025
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
48 changes: 16 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
26 changes: 0 additions & 26 deletions test/Bridges/Bridges.jl

This file was deleted.

14 changes: 14 additions & 0 deletions test/Bridges/Constraint/runtests.jl
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions test/Bridges/Objective/runtests.jl
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions test/Bridges/Variable/runtests.jl
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions test/Bridges/runtests.jl
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions test/General/runtests.jl
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
2 changes: 0 additions & 2 deletions test/Nonlinear/Nonlinear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1423,5 +1423,3 @@ end
end # TestNonlinear

TestNonlinear.runtests()

include("ReverseAD.jl")
8 changes: 8 additions & 0 deletions test/Nonlinear/runtests.jl
Original file line number Diff line number Diff line change
@@ -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")
File renamed without changes.
2 changes: 1 addition & 1 deletion test/Utilities/Utilities.jl → test/Utilities/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 5 additions & 23 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# * General
# * Benchmarks
# * Bridges
# * Bridges/Constraint
# * Bridges/Objective
# * Bridges/Variable
# * FileFormats
# * Nonlinear
# * Test
Expand All @@ -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

Expand Down
Loading