Skip to content

Commit

Permalink
Put local installation in CI (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
gdalle authored Aug 6, 2024
1 parent d0e26ef commit 0e5ecfd
Show file tree
Hide file tree
Showing 24 changed files with 57 additions and 32 deletions.
36 changes: 14 additions & 22 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ jobs:
group: Down/Detector
env:
SHOULDRUN: ${{ matrix.version == '1' || !github.event.pull_request.draft }}
JULIA_DI_TEST_GROUP: ${{ matrix.group }}
steps:
- run: echo "$SHOULDRUN"
- uses: actions/checkout@v4
Expand All @@ -101,17 +102,14 @@ jobs:
arch: x64
- uses: julia-actions/cache@v2
if: ${{ env.SHOULDRUN == 'true' }}
- uses: julia-actions/julia-buildpkg@v1
- name: Install dependencies & run tests
if: ${{ env.SHOULDRUN == 'true' }}
- name: Update registry
if: ${{ env.SHOULDRUN == 'true' }}
run: julia -e 'using Pkg; Pkg.Registry.update()'
- uses: julia-actions/julia-runtest@v1
if: ${{ env.SHOULDRUN == 'true' }}
with:
project: ./DifferentiationInterface
env:
JULIA_DI_TEST_GROUP: ${{ matrix.group }}
# how to add the local DIT to the DI test env?
run: julia --project=./DifferentiationInterface -e '
using Pkg;
Pkg.Registry.update();
Pkg.update();
Pkg.test("DifferentiationInterface"; coverage=true);'
- uses: julia-actions/julia-processcoverage@v1
if: ${{ env.SHOULDRUN == 'true' }}
with:
Expand Down Expand Up @@ -149,6 +147,7 @@ jobs:
group: Weird
env:
SHOULDRUN: ${{ matrix.version == '1' || !github.event.pull_request.draft }}
JULIA_DIT_TEST_GROUP: ${{ matrix.group }}
steps:
- run: echo "$SHOULDRUN"
- uses: actions/checkout@v4
Expand All @@ -160,21 +159,14 @@ jobs:
arch: x64
- uses: julia-actions/cache@v2
if: ${{ env.SHOULDRUN == 'true' }}
- uses: julia-actions/julia-buildpkg@v1
if: ${{ env.SHOULDRUN == 'true' }}
- name: Dev dependencies (temporary)
- name: Install dependencies & run tests
if: ${{ env.SHOULDRUN == 'true' }}
run: julia --project='./DifferentiationInterfaceTest' -e '
run: julia --project=./DifferentiationInterfaceTest -e '
using Pkg;
Pkg.Registry.update();
Pkg.develop(PackageSpec(path="./DifferentiationInterface"));
Pkg.instantiate();'
- uses: julia-actions/julia-runtest@v1
if: ${{ env.SHOULDRUN == 'true' }}
with:
project: ./DifferentiationInterfaceTest
env:
JULIA_DI_TEST_GROUP: ${{ matrix.group }}
Pkg.update();
Pkg.develop(path="./DifferentiationInterface");
Pkg.test("DifferentiationInterfaceTest"; coverage=true);'
- uses: julia-actions/julia-processcoverage@v1
if: ${{ env.SHOULDRUN == 'true' }}
with:
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Back/ChainRulesCore/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ using DifferentiationInterface, DifferentiationInterfaceTest
using Test
using Zygote: ZygoteRuleConfig

LOGGING = get(ENV, "CI", "false") == "false"

for backend in [AutoChainRules(ZygoteRuleConfig())]
@test check_available(backend)
@test !check_twoarg(backend)
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Back/Diffractor/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ using DifferentiationInterface, DifferentiationInterfaceTest
using Diffractor: Diffractor
using Test

LOGGING = get(ENV, "CI", "false") == "false"

for backend in [AutoDiffractor()]
@test check_available(backend)
@test !check_twoarg(backend)
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Back/Enzyme/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ using SparseConnectivityTracer, SparseMatrixColorings
using StableRNGs
using Test

LOGGING = get(ENV, "CI", "false") == "false"

dense_backends = [
AutoEnzyme(; mode=nothing),
AutoEnzyme(; mode=Enzyme.Forward),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ using DifferentiationInterface, DifferentiationInterfaceTest
using FastDifferentiation: FastDifferentiation
using Test

LOGGING = get(ENV, "CI", "false") == "false"

for backend in [AutoFastDifferentiation(), AutoSparse(AutoFastDifferentiation())]
@test check_available(backend)
@test check_twoarg(backend)
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Back/FiniteDiff/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ using DifferentiationInterface, DifferentiationInterfaceTest
using FiniteDiff: FiniteDiff
using Test

LOGGING = get(ENV, "CI", "false") == "false"

for backend in [AutoFiniteDiff()]
@test check_available(backend)
@test check_twoarg(backend)
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Back/FiniteDifferences/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ using DifferentiationInterface, DifferentiationInterfaceTest
using FiniteDifferences: FiniteDifferences
using Test

LOGGING = get(ENV, "CI", "false") == "false"

for backend in [AutoFiniteDifferences(; fdm=FiniteDifferences.central_fdm(3, 1))]
@test check_available(backend)
@test !check_twoarg(backend)
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Back/ForwardDiff/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ using SparseConnectivityTracer, SparseMatrixColorings
using StaticArrays: StaticArrays
using Test

LOGGING = get(ENV, "CI", "false") == "false"

dense_backends = [AutoForwardDiff(), AutoForwardDiff(; chunksize=5, tag=:hello)]

sparse_backends = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ using DifferentiationInterface, DifferentiationInterfaceTest
using PolyesterForwardDiff: PolyesterForwardDiff
using Test

LOGGING = get(ENV, "CI", "false") == "false"

for backend in [AutoPolyesterForwardDiff(; chunksize=1)]
@test check_available(backend)
@test check_twoarg(backend)
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Back/ReverseDiff/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ using ReverseDiff: ReverseDiff
using StaticArrays: StaticArrays
using Test

LOGGING = get(ENV, "CI", "false") == "false"

dense_backends = [AutoReverseDiff(; compile=false), AutoReverseDiff(; compile=true)]

fromprimitive_backends = [AutoReverseFromPrimitive(AutoReverseDiff())]
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Back/SecondOrder/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ using SparseMatrixColorings
using Zygote: Zygote
using Test

LOGGING = get(ENV, "CI", "false") == "false"

## Dense

onearg_backends = [
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Back/Symbolics/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ using DifferentiationInterface, DifferentiationInterfaceTest
using Symbolics: Symbolics
using Test

LOGGING = get(ENV, "CI", "false") == "false"

for backend in [AutoSymbolics(), AutoSparse(AutoSymbolics())]
@test check_available(backend)
@test check_twoarg(backend)
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Back/Tapir/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ using DifferentiationInterface, DifferentiationInterfaceTest
using Tapir: Tapir
using Test

LOGGING = get(ENV, "CI", "false") == "false"

for backend in [AutoTapir(; safe_mode=false)]
@test check_available(backend)
@test check_twoarg(backend)
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Back/Tracker/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ using DifferentiationInterface, DifferentiationInterfaceTest
using Tracker: Tracker
using Test

LOGGING = get(ENV, "CI", "false") == "false"

for backend in [AutoTracker()]
@test check_available(backend)
@test !check_twoarg(backend)
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Back/Zygote/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ using StaticArrays: StaticArrays
using Test
using Zygote: Zygote

LOGGING = get(ENV, "CI", "false") == "false"

dense_backends = [AutoZygote()]

sparse_backends = [
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Down/DifferentiateWith/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ using ForwardDiff: ForwardDiff
using Zygote: Zygote
using Test

LOGGING = get(ENV, "CI", "false") == "false"

function zygote_breaking_scenarios()
onearg_scens = filter(default_scenarios()) do scen
DIT.nb_args(scen) == 1
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Down/Flux/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ using Random
using Zygote: Zygote
using Test

LOGGING = get(ENV, "CI", "false") == "false"

Random.seed!(0)

test_differentiation(
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Down/Lux/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ using Lux: Lux
using LuxTestUtils: LuxTestUtils
using Random

LOGGING = get(ENV, "CI", "false") == "false"

Random.seed!(0)

test_differentiation(
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/test/Internals/fromprimitive.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ using DifferentiationInterfaceTest: add_batchified!
using ForwardDiff: ForwardDiff
using Test

LOGGING = get(ENV, "CI", "false") == "false"

fromprimitive_backends = [ #
AutoForwardFromPrimitive(AutoForwardDiff(; chunksize=5)),
AutoReverseFromPrimitive(AutoForwardDiff(; chunksize=5)),
Expand Down
2 changes: 0 additions & 2 deletions DifferentiationInterface/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ else
Pkg.add("DifferentiationInterfaceTest")
end

LOGGING = get(ENV, "CI", "false") == "false"

GROUP = get(ENV, "JULIA_DI_TEST_GROUP", "All")

## Main tests
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterfaceTest/test/forwarddiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ using SparseMatrixColorings
using ComponentArrays: ComponentArrays
using StaticArrays: StaticArrays

LOGGING = get(ENV, "CI", "false") == "false"

## Dense

test_differentiation(AutoForwardDiff(); logging=LOGGING)
Expand Down
9 changes: 1 addition & 8 deletions DifferentiationInterfaceTest/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@ using Pkg
using SparseConnectivityTracer
using Test

DI_PATH = joinpath(@__DIR__, "..", "..", "DifferentiationInterface")
if isdir(DI_PATH)
Pkg.develop(; path=DI_PATH)
end

LOGGING = get(ENV, "CI", "false") == "false"

GROUP = get(ENV, "JULIA_DI_TEST_GROUP", "All")
GROUP = get(ENV, "JULIA_DIT_TEST_GROUP", "All")

## Main tests

Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterfaceTest/test/weird.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ using SparseMatrixColorings
using StaticArrays: StaticArrays
using Zygote: Zygote

LOGGING = get(ENV, "CI", "false") == "false"

test_differentiation(
AutoForwardDiff(),
vcat(component_scenarios(), static_scenarios());
Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterfaceTest/test/zero.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ using StaticArrays: StaticArrays

using Test

LOGGING = get(ENV, "CI", "false") == "false"

@test check_available(AutoZeroForward())
@test check_available(AutoZeroReverse())
@test check_twoarg(AutoZeroForward())
Expand Down

0 comments on commit 0e5ecfd

Please sign in to comment.