Skip to content

Commit

Permalink
Merge branch 'master' into repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub authored May 23, 2023
2 parents 8953e25 + 852da1e commit acc59a4
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 5 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: IntegrationTest
on:
push:
branches: [master]
tags: [v*]
pull_request:
paths-ignore:
- 'LICENSE'
- 'README.md'
- '.github/workflows/TagBot.yml'

jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
test:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
name: ${{ matrix.package.group }}/${{ matrix.package.repo }}/${{ matrix.julia-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
julia-version: ['1']
os: [ubuntu-latest]
package:
- {repo: Distributions.jl, group: JuliaStats}
- {repo: BlockArrays.jl, group: JuliaArrays}
- {repo: LazyArrays.jl, group: JuliaArrays}
- {repo: ArrayLayouts.jl, group: JuliaLinearAlgebra}
- {repo: LazyBandedMatrices.jl, group: JuliaLinearAlgebra}
- {repo: BandedMatrices.jl, group: JuliaLinearAlgebra}
- {repo: ContinuumArrays.jl, group: JuliaApproximation}
- {repo: BlockBandedMatrices.jl, group: JuliaLinearAlgebra}
- {repo: InfiniteLinearAlgebra.jl, group: JuliaLinearAlgebra}
- {repo: Optim.jl, group: JuliaNLSolvers}

steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
arch: x64
- uses: julia-actions/julia-buildpkg@latest
- name: Clone Downstream
uses: actions/checkout@v3
with:
repository: ${{ matrix.package.group }}/${{ 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(; coverage = true) # 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
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
with:
files: lcov.info
8 changes: 3 additions & 5 deletions src/fillbroadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,8 @@ function broadcasted(::DefaultArrayStyle{1}, ::typeof(*), a::AbstractRange{V}, b
return _range_convert(AbstractVector{promote_type(T,V)}, a)
end

_copy_oftype(A::AbstractArray{T,N}, ::Type{T}) where {T,N} = copy(A)
_copy_oftype(A::AbstractArray{T,N}, ::Type{S}) where {T,N,S} = convert(AbstractArray{S,N}, A)
_copy_oftype(A::AbstractRange{T}, ::Type{T}) where T = copy(A)
_copy_oftype(A::AbstractRange{T}, ::Type{S}) where {T,S} = map(S, A)
_copy_oftype(A::AbstractArray, ::Type{S}) where {S} = eltype(A) == S ? copy(A) : AbstractArray{S}(A)
_copy_oftype(A::AbstractRange, ::Type{S}) where {S} = eltype(A) == S ? copy(A) : map(S, A)

for op in (:+, :-)
@eval begin
Expand Down Expand Up @@ -254,4 +252,4 @@ broadcasted(::DefaultArrayStyle{N}, ::typeof(Base.literal_pow), ::Base.RefValue{
# supports structured broadcast
if isdefined(LinearAlgebra, :fzero)
LinearAlgebra.fzero(x::Zeros) = zero(eltype(x))
end
end
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1168,8 +1168,16 @@ end

@test copy(m) m
@test copy(D) D
@test FillArrays._copy_oftype(m, eltype(m)) m
@test FillArrays._copy_oftype(m, Int) Eye{Int}(10)
@test FillArrays._copy_oftype(D, eltype(D)) D
@test FillArrays._copy_oftype(D, Float64) Diagonal(Fill(2.0,10))

# test that _copy_oftype does, in fact, copy the array
D2 = Diagonal([1,1])
@test FillArrays._copy_oftype(D2, Float64) isa Diagonal{Float64}
@test FillArrays._copy_oftype(D2, eltype(D2)) == D2
@test FillArrays._copy_oftype(D2, eltype(D2)) !== D2
end

@testset "Issue #31" begin
Expand Down

0 comments on commit acc59a4

Please sign in to comment.