Skip to content
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
32 changes: 26 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
name: Julia ${{ matrix.version }} - ${{ matrix.group }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.version == 'nightly' }}
strategy:
Expand All @@ -18,10 +18,14 @@ jobs:
- 'nightly'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
group:
- 'Transform'
- 'BaseKernels'
- 'Kernels'
- 'MultiOutput'
- 'Others'
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
Expand All @@ -40,10 +44,26 @@ jobs:
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
with:
coverage: ${{ matrix.version == '1' && matrix.os == 'ubuntu-latest' }}
env:
GROUP: ${{ matrix.group }}
- uses: julia-actions/julia-processcoverage@v1
- name: Send coverage
if: matrix.version == '1' && matrix.os == 'ubuntu-latest'
- name: Coveralls parallel
if: matrix.version == '1' && matrix.os == 'ubuntu-latest'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./lcov.info
flag-name: run-${{ matrix.group }}
parallel: true
finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Send coverage
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./lcov.info
github-token: ${{ secrets.github_token }}
parallel-finished: true
226 changes: 120 additions & 106 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ using KernelFunctions: SimpleKernel, metric, kappa, ColVecs, RowVecs, TestUtils

using KernelFunctions.TestUtils: test_interface

# The GROUP is used to run different sets of tests in parallel on the GitHub Actions CI.
# If you want to introduce a new group, ensure you also add it to .github/workflows/ci.yml
const GROUP = get(ENV, "GROUP", "")

# Writing tests:
# 1. The file structure of the test should match precisely the file structure of src.
# Amongst other things, this means that there should be exactly 1 test file per src file.
Expand Down Expand Up @@ -54,123 +58,133 @@ using KernelFunctions.TestUtils: test_interface
include("test_utils.jl")

@testset "KernelFunctions" begin
include("utils.jl")

@testset "distances" begin
include(joinpath("distances", "pairwise.jl"))
include(joinpath("distances", "dotproduct.jl"))
include(joinpath("distances", "delta.jl"))
include(joinpath("distances", "sinus.jl"))
if GROUP == "" || GROUP == "Transform"
@testset "transform" begin
include(joinpath("transform", "transform.jl"))
print(" ")
include(joinpath("transform", "scaletransform.jl"))
print(" ")
include(joinpath("transform", "ardtransform.jl"))
print(" ")
include(joinpath("transform", "lineartransform.jl"))
print(" ")
include(joinpath("transform", "functiontransform.jl"))
print(" ")
include(joinpath("transform", "selecttransform.jl"))
print(" ")
include(joinpath("transform", "chaintransform.jl"))
print(" ")
include(joinpath("transform", "periodic_transform.jl"))
print(" ")
end
@info "Ran tests on Transform"
end
@info "Ran tests on Distances"

@testset "transform" begin
include(joinpath("transform", "transform.jl"))
print(" ")
include(joinpath("transform", "scaletransform.jl"))
print(" ")
include(joinpath("transform", "ardtransform.jl"))
print(" ")
include(joinpath("transform", "lineartransform.jl"))
print(" ")
include(joinpath("transform", "functiontransform.jl"))
print(" ")
include(joinpath("transform", "selecttransform.jl"))
print(" ")
include(joinpath("transform", "chaintransform.jl"))
print(" ")
include(joinpath("transform", "periodic_transform.jl"))
print(" ")
if GROUP == "" || GROUP == "BaseKernels"
@testset "basekernels" begin
include(joinpath("basekernels", "constant.jl"))
print(" ")
include(joinpath("basekernels", "cosine.jl"))
print(" ")
include(joinpath("basekernels", "exponential.jl"))
print(" ")
include(joinpath("basekernels", "exponentiated.jl"))
print(" ")
include(joinpath("basekernels", "fbm.jl"))
print(" ")
include(joinpath("basekernels", "gabor.jl"))
print(" ")
include(joinpath("basekernels", "matern.jl"))
print(" ")
include(joinpath("basekernels", "nn.jl"))
print(" ")
include(joinpath("basekernels", "periodic.jl"))
print(" ")
include(joinpath("basekernels", "piecewisepolynomial.jl"))
print(" ")
include(joinpath("basekernels", "polynomial.jl"))
print(" ")
include(joinpath("basekernels", "rational.jl"))
print(" ")
include(joinpath("basekernels", "sm.jl"))
print(" ")
include(joinpath("basekernels", "wiener.jl"))
print(" ")
end
@info "Ran tests on BaseKernel"
end
@info "Ran tests on Transform"

@testset "basekernels" begin
include(joinpath("basekernels", "constant.jl"))
print(" ")
include(joinpath("basekernels", "cosine.jl"))
print(" ")
include(joinpath("basekernels", "exponential.jl"))
print(" ")
include(joinpath("basekernels", "exponentiated.jl"))
print(" ")
include(joinpath("basekernels", "fbm.jl"))
print(" ")
include(joinpath("basekernels", "gabor.jl"))
print(" ")
include(joinpath("basekernels", "matern.jl"))
print(" ")
include(joinpath("basekernels", "nn.jl"))
print(" ")
include(joinpath("basekernels", "periodic.jl"))
print(" ")
include(joinpath("basekernels", "piecewisepolynomial.jl"))
print(" ")
include(joinpath("basekernels", "polynomial.jl"))
print(" ")
include(joinpath("basekernels", "rational.jl"))
print(" ")
include(joinpath("basekernels", "sm.jl"))
print(" ")
include(joinpath("basekernels", "wiener.jl"))
print(" ")
if GROUP == "" || GROUP == "Kernels"
@testset "kernels" begin
include(joinpath("kernels", "kernelproduct.jl"))
include(joinpath("kernels", "kernelsum.jl"))
include(joinpath("kernels", "kerneltensorproduct.jl"))
include(joinpath("kernels", "overloads.jl"))
include(joinpath("kernels", "scaledkernel.jl"))
include(joinpath("kernels", "transformedkernel.jl"))
include(joinpath("kernels", "normalizedkernel.jl"))
include(joinpath("kernels", "neuralkernelnetwork.jl"))
end
@info "Ran tests on Kernel"
end
@info "Ran tests on BaseKernel"

@testset "kernels" begin
include(joinpath("kernels", "kernelproduct.jl"))
include(joinpath("kernels", "kernelsum.jl"))
include(joinpath("kernels", "kerneltensorproduct.jl"))
include(joinpath("kernels", "overloads.jl"))
include(joinpath("kernels", "scaledkernel.jl"))
include(joinpath("kernels", "transformedkernel.jl"))
include(joinpath("kernels", "normalizedkernel.jl"))
include(joinpath("kernels", "neuralkernelnetwork.jl"))
if GROUP == "" || GROUP == "MultiOutput"
@testset "multi_output" begin
include(joinpath("mokernels", "moinput.jl"))
include(joinpath("mokernels", "independent.jl"))
include(joinpath("mokernels", "slfm.jl"))
include(joinpath("mokernels", "intrinsiccoregion.jl"))
include(joinpath("mokernels", "lmm.jl"))
end
@info "Ran tests on Multi-Output Kernels"
end
@info "Ran tests on Kernel"

@testset "matrix" begin
include(joinpath("matrix", "kernelmatrix.jl"))
include(joinpath("matrix", "kernelkroneckermat.jl"))
include(joinpath("matrix", "kernelpdmat.jl"))
end
@info "Ran tests on matrix"
if GROUP == "" || GROUP == "Others"
include("utils.jl")

@testset "multi_output" begin
include(joinpath("mokernels", "moinput.jl"))
include(joinpath("mokernels", "independent.jl"))
include(joinpath("mokernels", "slfm.jl"))
include(joinpath("mokernels", "intrinsiccoregion.jl"))
include(joinpath("mokernels", "lmm.jl"))
end
@info "Ran tests on Multi-Output Kernels"
@testset "distances" begin
include(joinpath("distances", "pairwise.jl"))
include(joinpath("distances", "dotproduct.jl"))
include(joinpath("distances", "delta.jl"))
include(joinpath("distances", "sinus.jl"))
end
@info "Ran tests on Distances"

@testset "approximations" begin
include(joinpath("approximations", "nystrom.jl"))
end
@testset "matrix" begin
include(joinpath("matrix", "kernelmatrix.jl"))
include(joinpath("matrix", "kernelkroneckermat.jl"))
include(joinpath("matrix", "kernelpdmat.jl"))
end
@info "Ran tests on matrix"

@testset "approximations" begin
include(joinpath("approximations", "nystrom.jl"))
end

include("generic.jl")
include("chainrules.jl")
include("zygoterules.jl")
include("generic.jl")
include("chainrules.jl")
include("zygoterules.jl")

@testset "doctests" begin
DocMeta.setdocmeta!(
KernelFunctions,
:DocTestSetup,
quote
using KernelFunctions
using LinearAlgebra
using Random
using PDMats: PDMats
end;
recursive=true,
)
doctest(
KernelFunctions;
doctestfilters=[
r"{([a-zA-Z0-9]+,\s?)+[a-zA-Z0-9]+}",
r"(Array{[a-zA-Z0-9]+,\s?1}|Vector{[a-zA-Z0-9]+})",
r"(Array{[a-zA-Z0-9]+,\s?2}|Matrix{[a-zA-Z0-9]+})",
],
)
@testset "doctests" begin
DocMeta.setdocmeta!(
KernelFunctions,
:DocTestSetup,
quote
using KernelFunctions
using LinearAlgebra
using Random
using PDMats: PDMats
end;
recursive=true,
)
doctest(
KernelFunctions;
doctestfilters=[
r"{([a-zA-Z0-9]+,\s?)+[a-zA-Z0-9]+}",
r"(Array{[a-zA-Z0-9]+,\s?1}|Vector{[a-zA-Z0-9]+})",
r"(Array{[a-zA-Z0-9]+,\s?2}|Matrix{[a-zA-Z0-9]+})",
],
)
end
end
end