Skip to content

Commit 10ad9ee

Browse files
authored
Break tests into different groups (#323)
1 parent 6084a57 commit 10ad9ee

File tree

2 files changed

+146
-112
lines changed

2 files changed

+146
-112
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
pull_request:
77
jobs:
88
test:
9-
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
9+
name: Julia ${{ matrix.version }} - ${{ matrix.group }}
1010
runs-on: ${{ matrix.os }}
1111
continue-on-error: ${{ matrix.version == 'nightly' }}
1212
strategy:
@@ -18,10 +18,14 @@ jobs:
1818
- 'nightly'
1919
os:
2020
- ubuntu-latest
21-
- macOS-latest
22-
- windows-latest
2321
arch:
2422
- x64
23+
group:
24+
- 'Transform'
25+
- 'BaseKernels'
26+
- 'Kernels'
27+
- 'MultiOutput'
28+
- 'Others'
2529
steps:
2630
- uses: actions/checkout@v2
2731
- uses: julia-actions/setup-julia@v1
@@ -40,10 +44,26 @@ jobs:
4044
${{ runner.os }}-
4145
- uses: julia-actions/julia-buildpkg@v1
4246
- uses: julia-actions/julia-runtest@v1
47+
with:
48+
coverage: ${{ matrix.version == '1' && matrix.os == 'ubuntu-latest' }}
49+
env:
50+
GROUP: ${{ matrix.group }}
4351
- uses: julia-actions/julia-processcoverage@v1
44-
- name: Send coverage
4552
if: matrix.version == '1' && matrix.os == 'ubuntu-latest'
53+
- name: Coveralls parallel
54+
if: matrix.version == '1' && matrix.os == 'ubuntu-latest'
55+
uses: coverallsapp/github-action@master
56+
with:
57+
github-token: ${{ secrets.GITHUB_TOKEN }}
58+
path-to-lcov: ./lcov.info
59+
flag-name: run-${{ matrix.group }}
60+
parallel: true
61+
finish:
62+
needs: test
63+
runs-on: ubuntu-latest
64+
steps:
65+
- name: Send coverage
4666
uses: coverallsapp/github-action@master
4767
with:
48-
github-token: ${{ secrets.GITHUB_TOKEN }}
49-
path-to-lcov: ./lcov.info
68+
github-token: ${{ secrets.github_token }}
69+
parallel-finished: true

test/runtests.jl

Lines changed: 120 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ using KernelFunctions: SimpleKernel, metric, kappa, ColVecs, RowVecs, TestUtils
1919

2020
using KernelFunctions.TestUtils: test_interface
2121

22+
# The GROUP is used to run different sets of tests in parallel on the GitHub Actions CI.
23+
# If you want to introduce a new group, ensure you also add it to .github/workflows/ci.yml
24+
const GROUP = get(ENV, "GROUP", "")
25+
2226
# Writing tests:
2327
# 1. The file structure of the test should match precisely the file structure of src.
2428
# Amongst other things, this means that there should be exactly 1 test file per src file.
@@ -54,123 +58,133 @@ using KernelFunctions.TestUtils: test_interface
5458
include("test_utils.jl")
5559

5660
@testset "KernelFunctions" begin
57-
include("utils.jl")
58-
59-
@testset "distances" begin
60-
include(joinpath("distances", "pairwise.jl"))
61-
include(joinpath("distances", "dotproduct.jl"))
62-
include(joinpath("distances", "delta.jl"))
63-
include(joinpath("distances", "sinus.jl"))
61+
if GROUP == "" || GROUP == "Transform"
62+
@testset "transform" begin
63+
include(joinpath("transform", "transform.jl"))
64+
print(" ")
65+
include(joinpath("transform", "scaletransform.jl"))
66+
print(" ")
67+
include(joinpath("transform", "ardtransform.jl"))
68+
print(" ")
69+
include(joinpath("transform", "lineartransform.jl"))
70+
print(" ")
71+
include(joinpath("transform", "functiontransform.jl"))
72+
print(" ")
73+
include(joinpath("transform", "selecttransform.jl"))
74+
print(" ")
75+
include(joinpath("transform", "chaintransform.jl"))
76+
print(" ")
77+
include(joinpath("transform", "periodic_transform.jl"))
78+
print(" ")
79+
end
80+
@info "Ran tests on Transform"
6481
end
65-
@info "Ran tests on Distances"
6682

67-
@testset "transform" begin
68-
include(joinpath("transform", "transform.jl"))
69-
print(" ")
70-
include(joinpath("transform", "scaletransform.jl"))
71-
print(" ")
72-
include(joinpath("transform", "ardtransform.jl"))
73-
print(" ")
74-
include(joinpath("transform", "lineartransform.jl"))
75-
print(" ")
76-
include(joinpath("transform", "functiontransform.jl"))
77-
print(" ")
78-
include(joinpath("transform", "selecttransform.jl"))
79-
print(" ")
80-
include(joinpath("transform", "chaintransform.jl"))
81-
print(" ")
82-
include(joinpath("transform", "periodic_transform.jl"))
83-
print(" ")
83+
if GROUP == "" || GROUP == "BaseKernels"
84+
@testset "basekernels" begin
85+
include(joinpath("basekernels", "constant.jl"))
86+
print(" ")
87+
include(joinpath("basekernels", "cosine.jl"))
88+
print(" ")
89+
include(joinpath("basekernels", "exponential.jl"))
90+
print(" ")
91+
include(joinpath("basekernels", "exponentiated.jl"))
92+
print(" ")
93+
include(joinpath("basekernels", "fbm.jl"))
94+
print(" ")
95+
include(joinpath("basekernels", "gabor.jl"))
96+
print(" ")
97+
include(joinpath("basekernels", "matern.jl"))
98+
print(" ")
99+
include(joinpath("basekernels", "nn.jl"))
100+
print(" ")
101+
include(joinpath("basekernels", "periodic.jl"))
102+
print(" ")
103+
include(joinpath("basekernels", "piecewisepolynomial.jl"))
104+
print(" ")
105+
include(joinpath("basekernels", "polynomial.jl"))
106+
print(" ")
107+
include(joinpath("basekernels", "rational.jl"))
108+
print(" ")
109+
include(joinpath("basekernels", "sm.jl"))
110+
print(" ")
111+
include(joinpath("basekernels", "wiener.jl"))
112+
print(" ")
113+
end
114+
@info "Ran tests on BaseKernel"
84115
end
85-
@info "Ran tests on Transform"
86116

87-
@testset "basekernels" begin
88-
include(joinpath("basekernels", "constant.jl"))
89-
print(" ")
90-
include(joinpath("basekernels", "cosine.jl"))
91-
print(" ")
92-
include(joinpath("basekernels", "exponential.jl"))
93-
print(" ")
94-
include(joinpath("basekernels", "exponentiated.jl"))
95-
print(" ")
96-
include(joinpath("basekernels", "fbm.jl"))
97-
print(" ")
98-
include(joinpath("basekernels", "gabor.jl"))
99-
print(" ")
100-
include(joinpath("basekernels", "matern.jl"))
101-
print(" ")
102-
include(joinpath("basekernels", "nn.jl"))
103-
print(" ")
104-
include(joinpath("basekernels", "periodic.jl"))
105-
print(" ")
106-
include(joinpath("basekernels", "piecewisepolynomial.jl"))
107-
print(" ")
108-
include(joinpath("basekernels", "polynomial.jl"))
109-
print(" ")
110-
include(joinpath("basekernels", "rational.jl"))
111-
print(" ")
112-
include(joinpath("basekernels", "sm.jl"))
113-
print(" ")
114-
include(joinpath("basekernels", "wiener.jl"))
115-
print(" ")
117+
if GROUP == "" || GROUP == "Kernels"
118+
@testset "kernels" begin
119+
include(joinpath("kernels", "kernelproduct.jl"))
120+
include(joinpath("kernels", "kernelsum.jl"))
121+
include(joinpath("kernels", "kerneltensorproduct.jl"))
122+
include(joinpath("kernels", "overloads.jl"))
123+
include(joinpath("kernels", "scaledkernel.jl"))
124+
include(joinpath("kernels", "transformedkernel.jl"))
125+
include(joinpath("kernels", "normalizedkernel.jl"))
126+
include(joinpath("kernels", "neuralkernelnetwork.jl"))
127+
end
128+
@info "Ran tests on Kernel"
116129
end
117-
@info "Ran tests on BaseKernel"
118130

119-
@testset "kernels" begin
120-
include(joinpath("kernels", "kernelproduct.jl"))
121-
include(joinpath("kernels", "kernelsum.jl"))
122-
include(joinpath("kernels", "kerneltensorproduct.jl"))
123-
include(joinpath("kernels", "overloads.jl"))
124-
include(joinpath("kernels", "scaledkernel.jl"))
125-
include(joinpath("kernels", "transformedkernel.jl"))
126-
include(joinpath("kernels", "normalizedkernel.jl"))
127-
include(joinpath("kernels", "neuralkernelnetwork.jl"))
131+
if GROUP == "" || GROUP == "MultiOutput"
132+
@testset "multi_output" begin
133+
include(joinpath("mokernels", "moinput.jl"))
134+
include(joinpath("mokernels", "independent.jl"))
135+
include(joinpath("mokernels", "slfm.jl"))
136+
include(joinpath("mokernels", "intrinsiccoregion.jl"))
137+
include(joinpath("mokernels", "lmm.jl"))
138+
end
139+
@info "Ran tests on Multi-Output Kernels"
128140
end
129-
@info "Ran tests on Kernel"
130141

131-
@testset "matrix" begin
132-
include(joinpath("matrix", "kernelmatrix.jl"))
133-
include(joinpath("matrix", "kernelkroneckermat.jl"))
134-
include(joinpath("matrix", "kernelpdmat.jl"))
135-
end
136-
@info "Ran tests on matrix"
142+
if GROUP == "" || GROUP == "Others"
143+
include("utils.jl")
137144

138-
@testset "multi_output" begin
139-
include(joinpath("mokernels", "moinput.jl"))
140-
include(joinpath("mokernels", "independent.jl"))
141-
include(joinpath("mokernels", "slfm.jl"))
142-
include(joinpath("mokernels", "intrinsiccoregion.jl"))
143-
include(joinpath("mokernels", "lmm.jl"))
144-
end
145-
@info "Ran tests on Multi-Output Kernels"
145+
@testset "distances" begin
146+
include(joinpath("distances", "pairwise.jl"))
147+
include(joinpath("distances", "dotproduct.jl"))
148+
include(joinpath("distances", "delta.jl"))
149+
include(joinpath("distances", "sinus.jl"))
150+
end
151+
@info "Ran tests on Distances"
146152

147-
@testset "approximations" begin
148-
include(joinpath("approximations", "nystrom.jl"))
149-
end
153+
@testset "matrix" begin
154+
include(joinpath("matrix", "kernelmatrix.jl"))
155+
include(joinpath("matrix", "kernelkroneckermat.jl"))
156+
include(joinpath("matrix", "kernelpdmat.jl"))
157+
end
158+
@info "Ran tests on matrix"
159+
160+
@testset "approximations" begin
161+
include(joinpath("approximations", "nystrom.jl"))
162+
end
150163

151-
include("generic.jl")
152-
include("chainrules.jl")
153-
include("zygoterules.jl")
164+
include("generic.jl")
165+
include("chainrules.jl")
166+
include("zygoterules.jl")
154167

155-
@testset "doctests" begin
156-
DocMeta.setdocmeta!(
157-
KernelFunctions,
158-
:DocTestSetup,
159-
quote
160-
using KernelFunctions
161-
using LinearAlgebra
162-
using Random
163-
using PDMats: PDMats
164-
end;
165-
recursive=true,
166-
)
167-
doctest(
168-
KernelFunctions;
169-
doctestfilters=[
170-
r"{([a-zA-Z0-9]+,\s?)+[a-zA-Z0-9]+}",
171-
r"(Array{[a-zA-Z0-9]+,\s?1}|Vector{[a-zA-Z0-9]+})",
172-
r"(Array{[a-zA-Z0-9]+,\s?2}|Matrix{[a-zA-Z0-9]+})",
173-
],
174-
)
168+
@testset "doctests" begin
169+
DocMeta.setdocmeta!(
170+
KernelFunctions,
171+
:DocTestSetup,
172+
quote
173+
using KernelFunctions
174+
using LinearAlgebra
175+
using Random
176+
using PDMats: PDMats
177+
end;
178+
recursive=true,
179+
)
180+
doctest(
181+
KernelFunctions;
182+
doctestfilters=[
183+
r"{([a-zA-Z0-9]+,\s?)+[a-zA-Z0-9]+}",
184+
r"(Array{[a-zA-Z0-9]+,\s?1}|Vector{[a-zA-Z0-9]+})",
185+
r"(Array{[a-zA-Z0-9]+,\s?2}|Matrix{[a-zA-Z0-9]+})",
186+
],
187+
)
188+
end
175189
end
176190
end

0 commit comments

Comments
 (0)