From e20bf27c3ba0b59529fb8be7b57092c04d816fd9 Mon Sep 17 00:00:00 2001 From: Abel Soares Siqueira Date: Thu, 27 May 2021 15:19:12 -0300 Subject: [PATCH] Split tests on CI --- .github/workflows/ci.yml | 20 ++++++-------------- test/nlp/nlpmodelstest.jl | 2 +- test/nls/nlpmodelstest.jl | 2 +- test/runtests.jl | 30 ++++++++++++++++++++++++++---- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec74b254..7b525e1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,29 +7,18 @@ on: types: [opened, synchronize, reopened] jobs: test: - name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + name: Julia ${{ matrix.version }}|${{ matrix.os }}|${{ matrix.problem_type }}|${{ matrix.adbackend }}|${{ github.event_name }} runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.allow_failure }} strategy: fail-fast: false matrix: version: ['1.3', '1'] + adbackend: ["ForwardDiffAD", "ZygoteAD", "ReverseDiffAD"] + problem_type: ["NLP", "NLS"] os: [ubuntu-latest, macOS-latest, windows-latest] arch: [x64] allow_failure: [false] - include: - - version: 'nightly' - os: ubuntu-latest - arch: x64 - allow_failure: true - - version: 'nightly' - os: macOS-latest - arch: x64 - allow_failure: true - - version: 'nightly' - os: windows-latest - arch: x64 - allow_failure: true steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 @@ -48,6 +37,9 @@ jobs: ${{ runner.os }}- - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 + env: + ADBACKEND: ${{ matrix.adbackend }} + PROBLEMTYPE: ${{ matrix.problem_type }} - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v1 with: diff --git a/test/nlp/nlpmodelstest.jl b/test/nlp/nlpmodelstest.jl index 935754e0..8120fed5 100644 --- a/test/nlp/nlpmodelstest.jl +++ b/test/nlp/nlpmodelstest.jl @@ -1,5 +1,5 @@ -@testset "AD backend - $(adbackend)" for adbackend in (:ForwardDiffAD, :ZygoteAD, :ReverseDiffAD) +@testset "AD backend - $(adbackend)" for adbackend in backends() for problem in NLPModelsTest.nlp_problems @testset "Checking NLPModelsTest tests on problem $problem" begin nlp_ad = eval(Meta.parse(lowercase(problem) * "_autodiff"))() diff --git a/test/nls/nlpmodelstest.jl b/test/nls/nlpmodelstest.jl index 6ffd55aa..1de6e5ae 100644 --- a/test/nls/nlpmodelstest.jl +++ b/test/nls/nlpmodelstest.jl @@ -1,4 +1,4 @@ -@testset "AD backend - $(adbackend)" for adbackend in (:ForwardDiffAD, :ZygoteAD, :ReverseDiffAD) +@testset "AD backend - $(adbackend)" for adbackend in backends() for problem in NLPModelsTest.nls_problems @testset "Checking NLPModelsTest tests on problem $problem" begin nls_ad = eval(Meta.parse(lowercase(problem) * "_autodiff"))() diff --git a/test/runtests.jl b/test/runtests.jl index f49e4be2..d9ac808d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -19,7 +19,29 @@ for problem in NLPModelsTest.nls_problems include("nls/problems/$(lowercase(problem)).jl") end -include("nlp/basic.jl") -include("nls/basic.jl") -include("nlp/nlpmodelstest.jl") -include("nls/nlpmodelstest.jl") +function backends() + x = get(ENV, "ADBACKEND", nothing) + if x === nothing + return (:ForwardDiffAD, :ZygoteAD, :ReverseDiffAD) + elseif get(ENV, "GITHUB_REPOSITORY", nothing) == "JuliaSmoothOptimizers/ADNLPModels.jl" + return [Symbol(x)] + else # + return [:ForwardDiffAD] + end +end + +if get(ENV, "CI", "false") == "true" && get(ENV, "GITHUB_REPOSITORY", nothing) == "JuliaSmoothOptimizers/ADNLPModels.jl" + if get(ENV, "PROBLEMTYPE", nothing) == "NLP" + include("nlp/basic.jl") + include("nlp/nlpmodelstest.jl") + else + include("nls/basic.jl") + include("nls/nlpmodelstest.jl") + end +else + + include("nlp/basic.jl") + include("nls/basic.jl") + include("nlp/nlpmodelstest.jl") + include("nls/nlpmodelstest.jl") +end