From 9439bd670709b410c0d531cd4f4deccc0819b174 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Mon, 13 Mar 2023 16:10:07 +0100 Subject: [PATCH 01/18] enable dependabot for GitHub actions --- .github/dependabot.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..700707ce --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" From 74fdcd16c7a647864eabbba880ad7da334647c53 Mon Sep 17 00:00:00 2001 From: CompatHelper Julia Date: Tue, 19 Dec 2023 00:51:30 +0000 Subject: [PATCH 02/18] CompatHelper: bump compat for Adapt to 4, (keep existing compat) --- Project.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index b2d575d6..2ef57e47 100644 --- a/Project.toml +++ b/Project.toml @@ -24,7 +24,7 @@ StructArraysSparseArraysExt = "SparseArrays" StructArraysStaticArraysExt = "StaticArrays" [compat] -Adapt = "3.4" +Adapt = "3.4, 4" ConstructionBase = "1" DataAPI = "1" GPUArraysCore = "0.1.2" @@ -47,4 +47,4 @@ TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9" WeakRefStrings = "ea10d353-3f73-51f8-a26c-33c1cb351aa5" [targets] -test = ["Adapt", "Documenter", "GPUArraysCore", "JLArrays", "LinearAlgebra", "OffsetArrays", "PooledArrays", "SparseArrays", "StaticArrays", "Test", "TypedTables", "WeakRefStrings"] \ No newline at end of file +test = ["Adapt", "Documenter", "GPUArraysCore", "JLArrays", "LinearAlgebra", "OffsetArrays", "PooledArrays", "SparseArrays", "StaticArrays", "Test", "TypedTables", "WeakRefStrings"] From 4e8f67fe4aeb023f3e804509df3f4ff64ff263cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 09:30:02 +0000 Subject: [PATCH 03/18] Bump codecov/codecov-action from 1 to 4 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 1 to 4. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v1...v4) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 22b10837..ef6d2686 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -41,6 +41,6 @@ jobs: - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v4 with: file: lcov.info From ea8a806a22ce3dfd606ee48ce9c5f5c391a70423 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 09:30:06 +0000 Subject: [PATCH 04/18] Bump actions/checkout from 2 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/CI.yml | 2 +- .github/workflows/Documenter.yml | 2 +- .github/workflows/Invalidations.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 22b10837..4d67c8da 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -23,7 +23,7 @@ jobs: arch: - x64 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} diff --git a/.github/workflows/Documenter.yml b/.github/workflows/Documenter.yml index 7710aea8..ba5a0d1b 100644 --- a/.github/workflows/Documenter.yml +++ b/.github/workflows/Documenter.yml @@ -12,7 +12,7 @@ jobs: name: Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: version: '1' diff --git a/.github/workflows/Invalidations.yml b/.github/workflows/Invalidations.yml index 4d0004e8..28b9ce2f 100644 --- a/.github/workflows/Invalidations.yml +++ b/.github/workflows/Invalidations.yml @@ -19,12 +19,12 @@ jobs: - uses: julia-actions/setup-julia@v1 with: version: '1' - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-invalidations@v1 id: invs_pr - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.event.repository.default_branch }} - uses: julia-actions/julia-buildpkg@v1 From d4b3d90524d93cdbd15b854e443271c3f6ffe321 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Thu, 8 Feb 2024 15:06:54 +0530 Subject: [PATCH 05/18] Use token from JuliaArrays --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ef6d2686..d965af0e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -43,4 +43,5 @@ jobs: - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v4 with: + token: ${{ secrets.CODECOV_TOKEN }} file: lcov.info From d589a5429c60f7732620560392b56784b8eb4115 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Thu, 8 Feb 2024 18:08:49 +0530 Subject: [PATCH 06/18] Permissions for documenter --- .github/workflows/Documenter.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/Documenter.yml b/.github/workflows/Documenter.yml index ba5a0d1b..337f0cde 100644 --- a/.github/workflows/Documenter.yml +++ b/.github/workflows/Documenter.yml @@ -9,6 +9,9 @@ on: tags: '*' jobs: docs: + permissions: + contents: write + statuses: write name: Documentation runs-on: ubuntu-latest steps: @@ -16,14 +19,10 @@ jobs: - uses: julia-actions/setup-julia@v1 with: version: '1' - - run: | - julia --project -e ' - using Pkg - Pkg.instantiate()' - julia --project=docs -e ' - using Pkg - Pkg.instantiate()' - - run: julia --project=docs docs/make.jl + - name: Install dependencies + run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' + - name: Build and deploy env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key + run: julia --project=docs/ docs/make.jl From 85ac9a9cc24ac1b01b255b8194591bb2d11e0207 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Thu, 8 Feb 2024 18:09:25 +0530 Subject: [PATCH 07/18] Remove comments from documenter build script --- .github/workflows/Documenter.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Documenter.yml b/.github/workflows/Documenter.yml index 337f0cde..779e0082 100644 --- a/.github/workflows/Documenter.yml +++ b/.github/workflows/Documenter.yml @@ -23,6 +23,6 @@ jobs: run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' - name: Build and deploy env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token - DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} run: julia --project=docs/ docs/make.jl From 2ae29095dfdf9e6bf81b0c75a3cceebcd34e8e72 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Feb 2024 23:30:31 +0530 Subject: [PATCH 08/18] Bump actions/cache from 1 to 4 (#298) Bumps [actions/cache](https://github.com/actions/cache) from 1 to 4. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v1...v4) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9794de99..c9c8aeda 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -28,7 +28,7 @@ jobs: with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v1 + - uses: actions/cache@v4 env: cache-name: cache-artifacts with: From 3880403e0816963e41f427e549e023a324e15cc3 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Fri, 23 Feb 2024 06:38:55 -0500 Subject: [PATCH 09/18] optimize get_ith (#286) Co-authored-by: Pietro Vertechi --- src/structarray.jl | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/structarray.jl b/src/structarray.jl index 64ff17a9..4cfacdcf 100644 --- a/src/structarray.jl +++ b/src/structarray.jl @@ -338,12 +338,7 @@ to map(c -> c[I...], Tuple(cols)) ``` """ -@inline get_ith(cols::NamedTuple, I...) = get_ith(Tuple(cols), I...) -@inline function get_ith(cols::Tuple, I...) - @inbounds r = first(cols)[I...] - return (r, get_ith(Base.tail(cols), I...)...) -end -@inline get_ith(::Tuple{}, I...) = () +@inline @generated get_ith(cols::Tup, I...) = :(Base.Cartesian.@ntuple $(fieldcount(cols)) i -> @inbounds cols[i][I...]) Base.@propagate_inbounds Base.getindex(x::StructArray, I...) = _getindex(x, to_indices(x, I)...) From f6b194b257f32d1f0efdca5a15e993ddce607e88 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Fri, 23 Feb 2024 06:39:34 -0500 Subject: [PATCH 10/18] support named properties for staticarrays (#277) --- ext/StructArraysStaticArraysExt.jl | 13 +++++++++++-- test/runtests.jl | 6 ++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ext/StructArraysStaticArraysExt.jl b/ext/StructArraysStaticArraysExt.jl index 0c84f5b7..14df4325 100644 --- a/ext/StructArraysStaticArraysExt.jl +++ b/ext/StructArraysStaticArraysExt.jl @@ -1,7 +1,7 @@ module StructArraysStaticArraysExt using StructArrays -using StaticArrays: StaticArray, FieldArray, tuple_prod +using StaticArrays: StaticArray, FieldArray, tuple_prod, SVector, MVector """ StructArrays.staticschema(::Type{<:StaticArray{S, T}}) where {S, T} @@ -22,7 +22,16 @@ which subtypes `FieldArray`. end end StructArrays.createinstance(::Type{T}, args...) where {T<:StaticArray} = T(args) -StructArrays.component(s::StaticArray, i) = getindex(s, i) +StructArrays.component(s::StaticArray, i::Integer) = getindex(s, i) + +function StructArrays.component(s::StructArray{<:Union{SVector,MVector}}, key::Symbol) + i = key == :x ? 1 : + key == :y ? 2 : + key == :z ? 3 : + key == :w ? 4 : + throw(ArgumentError("invalid key $key")) + StructArrays.component(s, i) +end # invoke general fallbacks for a `FieldArray` type. @inline function StructArrays.staticschema(T::Type{<:FieldArray}) diff --git a/test/runtests.jl b/test/runtests.jl index ed6f573a..30b0ccb6 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1405,6 +1405,12 @@ end @test StructArrays.components(x) == ([1.0,2.0], [2.0,3.0]) @test x .+ y == StructArray([StaticVectorType{2}(Float64[2*i+1;2*i+3]) for i = 1:2]) end + for StaticVectorType = [SVector, MVector] + x = @inferred StructArray([StaticVectorType{2}(Float64[i;i+1]) for i = 1:2]) + # numbered and named property access: + @test x.:1 == [1.0,2.0] + @test x.y == [2.0,3.0] + end # test broadcast + components for general arrays for StaticArrayType = [SArray, MArray, SizedArray] x = @inferred StructArray([StaticArrayType{Tuple{1,2}}(ones(1,2) .+ i) for i = 0:1]) From 7522dfdc807cfbe5209a4db638dc72817966aad7 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Fri, 23 Feb 2024 06:40:26 -0500 Subject: [PATCH 11/18] improve tables support (#276) * support more table types in the constructor * add fromtable() and Tables.materializer() * only run doctests on a single Julia version --------- Co-authored-by: Pietro Vertechi --- src/tables.jl | 8 ++++++++ test/runtests.jl | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/tables.jl b/src/tables.jl index d6ac2248..432a75b2 100644 --- a/src/tables.jl +++ b/src/tables.jl @@ -12,6 +12,14 @@ function _schema(::Type{T}) where {T<:NTuple{N, Any}} where N return Tables.Schema{ntuple(identity, N), T} end +StructArray(cols::Tables.AbstractColumns) = StructArray(Tables.columntable(cols)) +StructArray{T}(cols::Tables.AbstractColumns) where {T} = StructArray{T}(Tables.columntable(cols)) + +# convert from any Tables-compliant object +fromtable(cols) = StructArray(Tables.columntable(cols)) +Tables.materializer(::Type{<:StructArray}) = fromtable +Tables.materializer(::StructArray) = fromtable # Tables documentation says it's not needed, but actually it is + function try_compatible_columns(rows::R, s::StructArray) where {R} Tables.isrowtable(rows) && Tables.columnaccess(rows) || return nothing T = eltype(rows) diff --git a/test/runtests.jl b/test/runtests.jl index 30b0ccb6..736d96ff 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -14,7 +14,7 @@ using SparseArrays using InfiniteArrays using Documenter: doctest -if Base.VERSION >= v"1.6" && Int === Int64 +if Base.VERSION == v"1.6" && Int === Int64 doctest(StructArrays) end @@ -717,6 +717,22 @@ end # Testing integer column "names": @test invoke(append!, Tuple{StructVector,Any}, StructArray(([0],)), StructArray(([1],))) == StructArray(([0, 1],)) + + dtab = (a=[1,2],) |> Tables.dictcolumntable + @test StructArray(dtab) == [(a=1,), (a=2,)] + @test StructArray{NamedTuple{(:a,), Tuple{Float64}}}(dtab) == [(a=1.,), (a=2.,)] + @test StructVector{NamedTuple{(:a,), Tuple{Float64}}}(dtab) == [(a=1,), (a=2,)] + + tblbase = (a=[1,2], b=["3", "4"]) + @testset for tblfunc in [Tables.columntable, Tables.rowtable, Tables.dictcolumntable, Tables.dictrowtable] + tbl = tblfunc(tblbase) + sa = StructArrays.fromtable(tbl) + @test sa::StructArray == [(a=1, b="3"), (a=2, b="4")] + sa = Tables.materializer(StructArray)(tbl) + @test sa::StructArray == [(a=1, b="3"), (a=2, b="4")] + sa = Tables.materializer(sa)(tbl) + @test sa::StructArray == [(a=1, b="3"), (a=2, b="4")] + end end struct S From 8cb1e4cfba530b5cbfe84be82a3d34801c83d898 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Fri, 23 Feb 2024 06:43:29 -0500 Subject: [PATCH 12/18] bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index dd9b3676..5b465623 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "StructArrays" uuid = "09ab397b-f2b6-538f-b94a-2f83cf4a842a" -version = "0.6.16" +version = "0.6.17" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" From 33cd6c28823583cea89057144a7a05a21b25af15 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Fri, 23 Feb 2024 06:53:59 -0500 Subject: [PATCH 13/18] bump version correctly --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 5b465623..d5c32444 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "StructArrays" uuid = "09ab397b-f2b6-538f-b94a-2f83cf4a842a" -version = "0.6.17" +version = "0.6.18" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" From 0b997163d39e29765d7fc04b01e94e5fd9ddac48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20E=2E=20Cruz=20Serrall=C3=A9s?= Date: Fri, 1 Mar 2024 07:39:02 -0500 Subject: [PATCH 14/18] Added Base.keepat! for StructVector (#301) Co-authored-by: Pietro Vertechi Co-authored-by: Alexander Plavin --- src/structarray.jl | 7 +++++++ test/runtests.jl | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/structarray.jl b/src/structarray.jl index 4cfacdcf..d83ccbd3 100644 --- a/src/structarray.jl +++ b/src/structarray.jl @@ -413,6 +413,13 @@ function Base.deleteat!(s::StructVector{T}, idxs) where T return StructVector{T}(t) end +@static if VERSION >= v"1.7.0" + function Base.keepat!(s::StructVector{T}, idxs) where T + t = map(Base.Fix2(keepat!, idxs), components(s)) + return StructVector{T}(t) + end +end + Base.copyto!(I::StructArray, J::StructArray) = (foreachfield(copyto!, I, J); I) function Base.copyto!(I::StructArray, doffs::Integer, J::StructArray, soffs::Integer, n::Integer) diff --git a/test/runtests.jl b/test/runtests.jl index 736d96ff..9f4c95ac 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -259,6 +259,10 @@ end @test d == c == StructArray(a=[1,10,2,3], b=[2,20,3,4], c=["a","A","b","c"]) d = deleteat!(c, 2) @test d == c == StructArray(a=[1,2,3], b=[2,3,4], c=["a","b","c"]) + if Base.VERSION >= v"1.7.0" + d = keepat!(c, 2) + @test d == c == StructArray(a=[2], b=[3], c=["b"]) + end c = StructArray(a=[1], b=[2], c=["a"]) d = [(a=10, b=20, c="A")] @@ -295,6 +299,10 @@ end @test d == c == StructArray{C}(a=[1,10,2,3], b=[2,20,3,4], c=["a","A","b","c"]) d = deleteat!(c, 2) @test d == c == StructArray{C}(a=[1,2,3], b=[2,3,4], c=["a","b","c"]) + if Base.VERSION >= v"1.7.0" + d = keepat!(c, 2) + @test d == c == StructArray{C}(a=[2], b=[3], c=["b"]) + end c = StructArray{C}(a=[1], b=[2], c=["a"]) d = [C(10, 20, "A")] From b1836a697884058b4228152a44e595354da08ad7 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Thu, 14 Mar 2024 23:14:54 +0530 Subject: [PATCH 15/18] Add Aqua to tests and add stdlib versions (#306) * Add Aqua to tests and add stdlib versions * Move Aqua tests to runtests.jl * Fix import and move Aqua tests to the bottom --- Project.toml | 13 ++++++++++++- test/runtests.jl | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index d5c32444..f3c9e954 100644 --- a/Project.toml +++ b/Project.toml @@ -25,16 +25,27 @@ StructArraysStaticArraysExt = "StaticArrays" [compat] Adapt = "3.4, 4" +Aqua = "0.8" ConstructionBase = "1" DataAPI = "1" +Documenter = "1" GPUArraysCore = "0.1.2" InfiniteArrays = "0.13" +JLArrays = "0.1" +LinearAlgebra = "1" +OffsetArrays = "1" +PooledArrays = "1" +SparseArrays = "1" StaticArrays = "1.5.6" Tables = "1" +Test = "1" +TypedTables = "1" +WeakRefStrings = "1" julia = "1.6" [extras] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527" InfiniteArrays = "4858937d-0d70-526a-a4dd-2d5cb5dd786c" @@ -49,4 +60,4 @@ TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9" WeakRefStrings = "ea10d353-3f73-51f8-a26c-33c1cb351aa5" [targets] -test = ["Adapt", "Documenter", "GPUArraysCore", "InfiniteArrays", "JLArrays", "LinearAlgebra", "OffsetArrays", "PooledArrays", "SparseArrays", "StaticArrays", "Test", "TypedTables", "WeakRefStrings"] +test = ["Adapt", "Aqua", "Documenter", "GPUArraysCore", "InfiniteArrays", "JLArrays", "LinearAlgebra", "OffsetArrays", "PooledArrays", "SparseArrays", "StaticArrays", "Test", "TypedTables", "WeakRefStrings"] diff --git a/test/runtests.jl b/test/runtests.jl index 9f4c95ac..29ff3efb 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -12,6 +12,7 @@ using LinearAlgebra using Test using SparseArrays using InfiniteArrays +import Aqua using Documenter: doctest if Base.VERSION == v"1.6" && Int === Int64 @@ -1540,3 +1541,7 @@ end S = StructArray{Complex{Int}}((1:∞, 1:∞)) @test Base.IteratorSize(S) == Base.IsInfinite() end + +@testset "project quality" begin + Aqua.test_all(StructArrays, ambiguities=(; broken=true)) +end From e52b3cc89184de29f11df5002733524621052619 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Sat, 6 Apr 2024 09:59:09 +0200 Subject: [PATCH 16/18] resolve ambiguities with StaticArrays (#304) --- ext/StructArraysStaticArraysExt.jl | 6 +++++- test/runtests.jl | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ext/StructArraysStaticArraysExt.jl b/ext/StructArraysStaticArraysExt.jl index 14df4325..6e87707d 100644 --- a/ext/StructArraysStaticArraysExt.jl +++ b/ext/StructArraysStaticArraysExt.jl @@ -1,7 +1,7 @@ module StructArraysStaticArraysExt using StructArrays -using StaticArrays: StaticArray, FieldArray, tuple_prod, SVector, MVector +using StaticArrays: StaticArray, FieldArray, tuple_prod, SVector, MVector, SOneTo """ StructArrays.staticschema(::Type{<:StaticArray{S, T}}) where {S, T} @@ -40,6 +40,10 @@ end StructArrays.component(s::FieldArray, i) = invoke(StructArrays.component, Tuple{Any, Any}, s, i) StructArrays.createinstance(T::Type{<:FieldArray}, args...) = invoke(StructArrays.createinstance, Tuple{Type{<:Any}, Vararg}, T, args...) +# disambiguation +Base.similar(s::StructArray, S::Type, sz::Tuple{Union{Integer, Base.OneTo, SOneTo}, Vararg{Union{Union{Integer, Base.OneTo, SOneTo}}}}) = StructArrays._similar(s, S, sz) +Base.reshape(s::StructArray{T}, d::Tuple{SOneTo, Vararg{SOneTo}}) where {T} = StructArray{T}(map(x -> reshape(x, d), StructArrays.components(s))) + # Broadcast overload using StaticArrays: StaticArrayStyle, similar_type, Size, SOneTo using StaticArrays: broadcast_flatten, broadcast_sizes, first_statictype diff --git a/test/runtests.jl b/test/runtests.jl index 29ff3efb..47c15645 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1444,6 +1444,14 @@ end @test x .+ y == StructArray([StaticArrayType{Tuple{1,2}}(3*ones(1,2) .+ 2*i) for i = 0:1]) end + let + # potential ambiguities + x = StructArray((SA[1,2], SA[1,2])) + @test eltype(similar(x)::StructArray) == eltype(x) + @test map(x->x, x)::StructArray == x + @test size(reshape(x, (SOneTo(2), SOneTo(1)))::StructArray) == (2, 1) + end + # test FieldVector constructor (see https://github.com/JuliaArrays/StructArrays.jl/issues/205) struct FlippedVec2D <: FieldVector{2,Float64} x::Float64 From 181cccf009156744c5c198d3927ff87ac8b0f9d3 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Sat, 6 Apr 2024 13:29:55 +0530 Subject: [PATCH 17/18] Update TagBot.yml with lookback and permissions (#299) * Update TagBot.yml with lookback and permissions Following the latest instructions from https://github.com/marketplace/actions/julia-tagbot * Remove comment --- .github/workflows/TagBot.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml index 623860f7..2bacdb87 100644 --- a/.github/workflows/TagBot.yml +++ b/.github/workflows/TagBot.yml @@ -4,6 +4,22 @@ on: types: - created workflow_dispatch: + inputs: + lookback: + default: 3 +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read jobs: TagBot: if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' @@ -12,4 +28,4 @@ jobs: - uses: JuliaRegistries/TagBot@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - ssh: ${{ secrets.DOCUMENTER_KEY }} \ No newline at end of file + ssh: ${{ secrets.DOCUMENTER_KEY }} From 95d458463cbeba4ff516161242941e4ea345e23d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jun 2024 16:48:00 +0530 Subject: [PATCH 18/18] Bump julia-actions/setup-julia from 1 to 2 (#309) Bumps [julia-actions/setup-julia](https://github.com/julia-actions/setup-julia) from 1 to 2. - [Release notes](https://github.com/julia-actions/setup-julia/releases) - [Commits](https://github.com/julia-actions/setup-julia/compare/v1...v2) --- updated-dependencies: - dependency-name: julia-actions/setup-julia dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/CI.yml | 2 +- .github/workflows/Documenter.yml | 2 +- .github/workflows/Invalidations.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c9c8aeda..d534fd99 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -24,7 +24,7 @@ jobs: - x64 steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} diff --git a/.github/workflows/Documenter.yml b/.github/workflows/Documenter.yml index 779e0082..a789f056 100644 --- a/.github/workflows/Documenter.yml +++ b/.github/workflows/Documenter.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: '1' - name: Install dependencies diff --git a/.github/workflows/Invalidations.yml b/.github/workflows/Invalidations.yml index 28b9ce2f..66c86a36 100644 --- a/.github/workflows/Invalidations.yml +++ b/.github/workflows/Invalidations.yml @@ -16,7 +16,7 @@ jobs: if: github.base_ref == github.event.repository.default_branch runs-on: ubuntu-latest steps: - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: '1' - uses: actions/checkout@v4