From 0e7f90685be96a6ecbb7662bda6db65aaf28620d Mon Sep 17 00:00:00 2001 From: David Widmann Date: Wed, 25 Oct 2023 00:11:24 +0200 Subject: [PATCH 1/3] Add downstream tests --- .github/workflows/IntegrationTest.yml | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/IntegrationTest.yml diff --git a/.github/workflows/IntegrationTest.yml b/.github/workflows/IntegrationTest.yml new file mode 100644 index 0000000..515d061 --- /dev/null +++ b/.github/workflows/IntegrationTest.yml @@ -0,0 +1,58 @@ +name: IntegrationTest + +on: + pull_request: + branches: + - master + push: + branches: + - master + tags: '*' + +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + +jobs: + test: + name: ${{ matrix.package.repo }}/${{ matrix.package.group }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + julia-version: [1] + os: [ubuntu-latest] + package: + - {user: JuliaStats, repo: Distributions.jl} + + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.julia-version }} + arch: x64 + - uses: julia-actions/julia-buildpkg@v1 + - name: Clone Downstream + uses: actions/checkout@v4 + with: + repository: ${{ matrix.package.user }}/${{ matrix.package.repo }} + path: downstream + - name: Load this and run the downstream tests + shell: julia --color=yes --project=downstream {0} + run: | + using Pkg + try + # force it to use this PR's version of the package + Pkg.develop(PackageSpec(path=".")) # resolver may fail with main deps + Pkg.update() + Pkg.test() # resolver may fail with test time deps + catch err + err isa Pkg.Resolve.ResolverError || rethrow() + # If we can't resolve that means this is incompatible by SemVer and this is fine + # It means we marked this as a breaking change, so we don't need to worry about + # Mistakenly introducing a breaking change, as we have intentionally made one + @info "Not compatible with this release. No problem." exception=err + exit(0) # Exit immediately, as a success + end From 9c3a3011a889a0a3b77b08f7a87d57ff13d73ba0 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Fri, 10 Nov 2023 09:04:53 +0100 Subject: [PATCH 2/3] Ensure that `Matrix` constructor returns a `Matrix` for a `PDMat` (#196) * Ensure that `Matrix` constructor returns a `Matrix` for a `PDMat` * Add test for `Matrix` constructor * Check type of `Matrix` for static pd matrices --- src/pdmat.jl | 2 +- test/specialarrays.jl | 2 ++ test/testutils.jl | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pdmat.jl b/src/pdmat.jl index bc09e3e..0e44780 100644 --- a/src/pdmat.jl +++ b/src/pdmat.jl @@ -42,7 +42,7 @@ Base.convert(::Type{AbstractPDMat{T}}, a::PDMat) where {T<:Real} = convert(PDMat ### Basics Base.size(a::PDMat) = (a.dim, a.dim) -Base.Matrix(a::PDMat) = copy(a.mat) +Base.Matrix(a::PDMat) = Matrix(a.mat) LinearAlgebra.diag(a::PDMat) = diag(a.mat) LinearAlgebra.cholesky(a::PDMat) = a.chol diff --git a/test/specialarrays.jl b/test/specialarrays.jl index e896d72..75468ba 100644 --- a/test/specialarrays.jl +++ b/test/specialarrays.jl @@ -28,6 +28,8 @@ using StaticArrays Y = @SMatrix rand(4, 10) for A in (PDS, D, E, C) + @test Matrix(A) isa Matrix + if !(A isa Cholesky) # `*(::Cholesky, ::SArray)` is not defined @test A * x isa SVector{4, Float64} diff --git a/test/testutils.jl b/test/testutils.jl index 96843c9..32bd5a9 100644 --- a/test/testutils.jl +++ b/test/testutils.jl @@ -98,6 +98,11 @@ function pdtest_basics(C, Cmat::Matrix, d::Int, verbose::Int) if C isa AbstractPDMat @test M === C end + + _pdt(verbose, "Matrix") + M = Matrix(C) + @test M isa Matrix + @test M == Cmat end From e0cad7caf7d955d5a14fe830f3684026a9652ad7 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Fri, 10 Nov 2023 09:05:46 +0100 Subject: [PATCH 3/3] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 47b8eaa..64011c8 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "PDMats" uuid = "90014a1f-27ba-587c-ab20-58faa44d9150" -version = "0.11.28" +version = "0.11.29" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"