From 578d0682a9ee5530abe905b99c6a5777765dca67 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Tue, 17 Sep 2024 21:46:58 +0300 Subject: [PATCH] tmp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` Running tests: 1 ambiguities found. To get a list, set `broken = false`. Ambiguity #1 frule(::ChainRulesCore.RuleConfig, args...) in ChainRulesCore at /home/runner/.julia/packages/ChainRulesCore/I1EbV/src/rules.jl:64 frule(::Any, ::typeof(Distributions.logpdf), d::Distributions.Uniform, x::Real) in Distributions.DistributionsChainRulesCoreExt at /home/runner/work/Distributions.jl/Distributions.jl/ext/DistributionsChainRulesCoreExt/univariate/continuous/uniform.jl:1 Possible fix, define frule(::ChainRulesCore.RuleConfig, ::typeof(Distributions.logpdf), ::Distributions.Uniform, ::Real) Aqua: Test Failed at /home/runner/.julia/packages/Aqua/tHrmY/src/ambiguities.jl:78 Expression: iszero(num_ambiguities) Stacktrace: [1] macro expansion @ /opt/hostedtoolcache/julia/1.8.5/x64/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined] [2] _test_ambiguities(packages::Vector{Base.PkgId}; broken::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ Aqua ~/.julia/packages/Aqua/tHrmY/src/ambiguities.jl:78 ``` ``` pdf/logpdf: Error During Test at /Users/runner/work/Distributions.jl/Distributions.jl/test/multivariate/jointorderstatistics.jl:76 Test threw exception Expression: #= /Users/runner/work/Distributions.jl/Distributions.jl/test/multivariate/jointorderstatistics.jl:76 =# @inferred(logpdf(d, x)) isa T DomainError with -0.31736627: log will only return a complex result if called with a complex argument. Try log(Complex(x)). Stacktrace: [1] throw_complex_domainerror(f::Symbol, x::Float32) @ Base.Math ./math.jl:33 [2] _log(x::Float32, base::Val{:ℯ}, func::Symbol) @ Base.Math ./special/log.jl:336 [3] log @ ./special/log.jl:264 [inlined] [4] log1mexp @ ~/.julia/packages/LogExpFunctions/X95j7/src/basicfuns.jl:240 [inlined] [5] logdiffcdf(d::Uniform{Float32}, x::Float32, y::Float32) @ Distributions ~/work/Distributions.jl/Distributions.jl/src/univariates.jl:372 [6] _marginalize_range @ ~/work/Distributions.jl/Distributions.jl/src/multivariate/jointorderstatistics.jl:125 [inlined] [7] logpdf(d::JointOrderStatistics{Uniform{Float32}, Tuple{Int64, Int64, Int64}}, x::Vector{Float32}) @ Distributions ~/work/Distributions.jl/Distributions.jl/src/multivariate/jointorderstatistics.jl:111 [8] macro expansion @ ~/hostedtoolcache/julia/1.8.5/aarch64/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined] [9] macro expansion @ ~/work/Distributions.jl/Distributions.jl/test/multivariate/jointorderstatistics.jl:76 [inlined] [10] macro expansion @ ~/hostedtoolcache/julia/1.8.5/aarch64/share/julia/stdlib/v1.8/Test/src/Test.jl:1363 [inlined] [11] macro expansion @ ~/work/Distributions.jl/Distributions.jl/test/multivariate/jointorderstatistics.jl:75 [inlined] [12] macro expansion @ ~/hostedtoolcache/julia/1.8.5/aarch64/share/julia/stdlib/v1.8/Test/src/Test.jl:1439 [inlined] [13] macro expansion @ ~/work/Distributions.jl/Distributions.jl/test/multivariate/jointorderstatistics.jl:35 [inlined] [14] macro expansion @ ~/hostedtoolcache/julia/1.8.5/aarch64/share/julia/stdlib/v1.8/Test/src/Test.jl:1363 [inlined] [15] top-level scope @ ~/work/Distributions.jl/Distributions.jl/test/multivariate/jointorderstatistics.jl:4 [16] include @ ./client.jl:476 [inlined] [17] macro expansion @ ~/work/Distributions.jl/Distributions.jl/test/runtests.jl:175 [inlined] [18] macro expansion @ ~/hostedtoolcache/julia/1.8.5/aarch64/share/julia/stdlib/v1.8/Test/src/Test.jl:1439 [inlined] [19] macro expansion @ ~/work/Distributions.jl/Distributions.jl/test/runtests.jl:174 [inlined] [20] macro expansion @ ~/hostedtoolcache/julia/1.8.5/aarch64/share/julia/stdlib/v1.8/Test/src/Test.jl:1363 [inlined] [21] top-level scope @ ~/work/Distributions.jl/Distributions.jl/test/runtests.jl:174 [22] include(fname::String) @ Base.MainInclude ./client.jl:476 [23] top-level scope @ none:6 [24] eval @ ./boot.jl:368 [inlined] [25] exec_options(opts::Base.JLOptions) @ Base ./client.jl:276 [26] _start() @ Base ./client.jl:522 ``` --- .github/workflows/CI.yml | 32 ++++++++++++++------------- test/aqua.jl | 5 +---- test/testutils.jl | 6 ++--- test/univariate/continuous/uniform.jl | 10 ++++++--- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 886724bd29..3ba5c49513 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,13 +1,7 @@ name: CI -on: - pull_request: - push: - branches: - - master - tags: '*' - workflow_dispatch: - merge_group: +on: push + concurrency: # Skip intermediate builds: always. @@ -23,13 +17,26 @@ jobs: fail-fast: false matrix: version: - - '1.3' - - '1' + - '1.10' + - '1.9' + - '1.8' + - '1.7' + - '1.6' - pre os: - ubuntu-latest - macos-latest - windows-latest + include: + - version: '1.7' + os: macos-12 + - version: '1.6' + os: macos-12 + exclude: + - version: '1.7' + os: macos-latest + - version: '1.6' + os: macos-latest steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v2 @@ -47,11 +54,6 @@ jobs: Pkg.instantiate()' - run: julia --project=perf perf/samplers.jl - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} # required - fail_ci_if_error: true - files: lcov.info docs: name: Documentation runs-on: ubuntu-latest diff --git a/test/aqua.jl b/test/aqua.jl index 4dd8c07064..17b06f4249 100644 --- a/test/aqua.jl +++ b/test/aqua.jl @@ -9,13 +9,10 @@ import Aqua Aqua.test_all( Distributions; ambiguities = false, - # On older Julia versions, installed dependencies are quite old - # Thus unbound type parameters show up that are fixed in newer versions - unbound_args = VERSION >= v"1.6", ) # Tests are not reliable on older Julia versions and # show ambiguities in loaded packages - if VERSION >= v"1.6" + if VERSION >= v"1.9" Aqua.test_ambiguities(Distributions) end end diff --git a/test/testutils.jl b/test/testutils.jl index 2859856a73..d9d24108d4 100644 --- a/test/testutils.jl +++ b/test/testutils.jl @@ -50,10 +50,8 @@ function test_cgf(dist, ts) d(f) = Base.Fix1(ForwardDiff.derivative, f) κ₁ = d(Base.Fix1(cgf, dist))(0) @test κ₁ ≈ mean(dist) - if VERSION >= v"1.4" - κ₂ = d(d(Base.Fix1(cgf, dist)))(0) - @test κ₂ ≈ var(dist) - end + κ₂ = d(d(Base.Fix1(cgf, dist)))(0) + @test κ₂ ≈ var(dist) for t in ts val = @inferred cgf(dist, t) @test isfinite(val) diff --git a/test/univariate/continuous/uniform.jl b/test/univariate/continuous/uniform.jl index e3a5d729ed..f7201ba963 100644 --- a/test/univariate/continuous/uniform.jl +++ b/test/univariate/continuous/uniform.jl @@ -6,17 +6,21 @@ using StatsFuns using Random using Test +Random.seed!(34567) + +rng = MersenneTwister(123) + @testset "uniform.jl" begin # affine transformations - test_affine_transformations(Uniform, rand(), 4 + rand()) + test_affine_transformations(Uniform, rand(rng), 4 + rand(rng)) test_cgf(Uniform(0,1), (1, -1, 100f0, 1e6, -1e6)) test_cgf(Uniform(100f0,101f0), (1, -1, 100f0, 1e6, -1e6)) @testset "ChainRules" begin # run test suite for values in the support - dist = Uniform(- 1 - rand(), 1 + rand()) + dist = Uniform(- 1 - rand(rng), 1 + rand(rng)) tangent = ChainRulesTestUtils.Tangent{Uniform{Float64}}(; a=randn(), b=randn()) - for x in (rand(), -rand()) + for x in (rand(rng), -rand(rng)) test_frule(logpdf, dist ⊢ tangent, x) test_rrule(logpdf, dist ⊢ tangent, x) end