Skip to content

Commit feae1f2

Browse files
authored
Make the GitHub actions script more parallel (#2674)
1 parent b3a78e6 commit feae1f2

File tree

21 files changed

+109
-84
lines changed

21 files changed

+109
-84
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,50 @@ on:
66
- release-*
77
pull_request:
88
types: [opened, synchronize, reopened]
9+
concurrency:
10+
# Skip intermediate builds: always.
11+
# Cancel intermediate builds: only if it is a pull request build.
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
914
# needed to allow julia-actions/cache to delete old caches that it has created
1015
permissions:
1116
actions: write
1217
contents: read
1318
jobs:
1419
test:
15-
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ matrix.moi_test_modules }} - ${{ github.event_name }}
16-
runs-on: ${{ matrix.os }}
20+
name: Julia ${{ matrix.machine.version }} - ${{ matrix.machine.os }}-${{ matrix.machine.arch }} - ${{ matrix.moi_test_modules }}
21+
runs-on: ${{ matrix.machine.os }}
1722
strategy:
1823
fail-fast: false
1924
matrix:
20-
# Since MOI doesn't have binary dependencies, only test on a subset of
21-
# possible platforms.
22-
include:
25+
moi_test_modules:
26+
- 'General;Benchmarks;FileFormats;Nonlinear'
27+
- 'Bridges'
28+
- 'Bridges/Constraint;Bridges/Objective;Bridges/Variable'
29+
- 'Test'
30+
- 'Utilities'
31+
machine:
2332
- version: 'nightly'
2433
os: ubuntu-latest
2534
arch: x64
26-
moi_test_modules: 'General;Nonlinear;Bridges;FileFormats'
27-
- version: 'nightly'
28-
os: ubuntu-latest
29-
arch: x64
30-
moi_test_modules: 'Test;Utilities;Benchmarks'
31-
- version: '1'
32-
os: ubuntu-latest
33-
arch: x64
34-
moi_test_modules: 'General;Nonlinear;Bridges;FileFormats'
3535
- version: '1'
3636
os: ubuntu-latest
3737
arch: x64
38-
moi_test_modules: 'Test;Utilities;Benchmarks'
3938
- version: '1'
4039
os: windows-latest
4140
arch: x64
42-
moi_test_modules: 'General;Nonlinear;Bridges;FileFormats'
43-
- version: '1'
44-
os: windows-latest
45-
arch: x64
46-
moi_test_modules: 'Test;Utilities;Benchmarks'
47-
- version: '1.6'
48-
os: ubuntu-latest
49-
arch: x64
50-
moi_test_modules: 'General;Nonlinear;Bridges;FileFormats'
5141
- version: '1.6'
5242
os: ubuntu-latest
5343
arch: x64
54-
moi_test_modules: 'Test;Utilities;Benchmarks'
55-
- version: '1'
56-
os: ubuntu-latest
57-
arch: x86
58-
moi_test_modules: 'General;Nonlinear;Bridges;FileFormats'
5944
- version: '1'
6045
os: ubuntu-latest
6146
arch: x86
62-
moi_test_modules: 'Test;Utilities;Benchmarks'
6347
steps:
6448
- uses: actions/checkout@v4
6549
- uses: julia-actions/setup-julia@v2
6650
with:
67-
version: ${{ matrix.version }}
68-
arch: ${{ matrix.arch }}
51+
version: ${{ matrix.machine.version }}
52+
arch: ${{ matrix.machine.arch }}
6953
- uses: julia-actions/cache@v1
7054
- uses: julia-actions/julia-buildpkg@v1
7155
- uses: julia-actions/julia-runtest@v1
File renamed without changes.

test/Bridges/Bridges.jl

Lines changed: 0 additions & 26 deletions
This file was deleted.

test/Bridges/Constraint/runtests.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2017: Miles Lubin and contributors
2+
# Copyright (c) 2017: Google Inc.
3+
#
4+
# Use of this source code is governed by an MIT-style license that can be found
5+
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
6+
7+
using Test
8+
9+
@testset "$(file)" for file in readdir(@__DIR__; join = true)
10+
if !endswith(file, ".jl") || endswith(file, "runtests.jl")
11+
continue
12+
end
13+
include(file)
14+
end

test/Bridges/Objective/runtests.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2017: Miles Lubin and contributors
2+
# Copyright (c) 2017: Google Inc.
3+
#
4+
# Use of this source code is governed by an MIT-style license that can be found
5+
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
6+
7+
using Test
8+
9+
@testset "$(file)" for file in readdir(@__DIR__; join = true)
10+
if !endswith(file, ".jl") || endswith(file, "runtests.jl")
11+
continue
12+
end
13+
include(file)
14+
end

test/Bridges/Variable/runtests.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2017: Miles Lubin and contributors
2+
# Copyright (c) 2017: Google Inc.
3+
#
4+
# Use of this source code is governed by an MIT-style license that can be found
5+
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
6+
7+
using Test
8+
9+
@testset "$(file)" for file in readdir(@__DIR__; join = true)
10+
if !endswith(file, ".jl") || endswith(file, "runtests.jl")
11+
continue
12+
end
13+
include(file)
14+
end

test/Bridges/runtests.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) 2017: Miles Lubin and contributors
2+
# Copyright (c) 2017: Google Inc.
3+
#
4+
# Use of this source code is governed by an MIT-style license that can be found
5+
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
6+
7+
using Test
8+
9+
files_to_exclude = ["runtests.jl", "sdpa_models.jl", "utilities.jl"]
10+
@testset "$(file)" for file in readdir(@__DIR__; join = true)
11+
if !endswith(file, ".jl") || any(f -> endswith(file, f), files_to_exclude)
12+
continue
13+
end
14+
include(file)
15+
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.

test/General/runtests.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (c) 2017: Miles Lubin and contributors
2+
# Copyright (c) 2017: Google Inc.
3+
#
4+
# Use of this source code is governed by an MIT-style license that can be found
5+
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
6+
7+
using Test
8+
9+
import MathOptInterface as MOI
10+
11+
@test isempty(Test.detect_ambiguities(MOI; recursive = true))
12+
13+
for file in readdir(@__DIR__)
14+
if file in ["issue980.jl", "dummy.jl", "hygiene.jl", "runtests.jl"]
15+
continue
16+
elseif !endswith(file, ".jl")
17+
continue
18+
end
19+
@testset "$(file)" begin
20+
include(file)
21+
end
22+
end
File renamed without changes.

test/Nonlinear/Nonlinear.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,5 +1423,3 @@ end
14231423
end # TestNonlinear
14241424

14251425
TestNonlinear.runtests()
1426-
1427-
include("ReverseAD.jl")

test/Nonlinear/runtests.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2017: Miles Lubin and contributors
2+
# Copyright (c) 2017: Google Inc.
3+
#
4+
# Use of this source code is governed by an MIT-style license that can be found
5+
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
6+
7+
include("Nonlinear.jl")
8+
include("ReverseAD.jl")
File renamed without changes.

test/Utilities/Utilities.jl renamed to test/Utilities/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using Test
88

99
for file in readdir(@__DIR__)
10-
if file in ["Utilities.jl"]
10+
if file == "runtests.jl"
1111
continue
1212
end
1313
@testset "$(file)" begin

test/runtests.jl

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# * General
1212
# * Benchmarks
1313
# * Bridges
14+
# * Bridges/Constraint
15+
# * Bridges/Objective
16+
# * Bridges/Variable
1417
# * FileFormats
1518
# * Nonlinear
1619
# * Test
@@ -19,38 +22,17 @@
1922
# If present, the tests run only those submodules defined above. `General` is
2023
# not a submodule, but it runs all of the top-level tests in MOI.
2124

22-
using Test
23-
2425
# This file gets called first. If it doesn't crash, all is well.
2526
include("issue980.jl")
2627

27-
import MathOptInterface as MOI
28-
2928
MODULES_TO_TEST = get(
3029
ENV,
3130
"MOI_TEST_MODULES",
32-
"General;Benchmarks;Bridges;FileFormats;Nonlinear;Test;Utilities",
31+
"General;Benchmarks;Bridges;Bridges/Constraint;Bridges/Objective;Bridges/Variable;FileFormats;Nonlinear;Test;Utilities",
3332
)
3433

35-
if occursin("General", MODULES_TO_TEST)
36-
@test isempty(Test.detect_ambiguities(MOI; recursive = true))
37-
for file in readdir(@__DIR__)
38-
if file in ["issue980.jl", "dummy.jl", "hygiene.jl", "runtests.jl"]
39-
continue
40-
elseif !endswith(file, ".jl")
41-
continue
42-
end
43-
@testset "$(file)" begin
44-
include(file)
45-
end
46-
end
47-
end
48-
4934
for submodule in split(MODULES_TO_TEST, ";")
50-
if submodule == "General"
51-
continue
52-
end
53-
include("$(submodule)/$(submodule).jl")
35+
include("$(submodule)/runtests.jl")
5436
GC.gc() # Force GC run here to reduce memory pressure
5537
end
5638

0 commit comments

Comments
 (0)