From b28b99f3277246592ec8a51c979c6568050c9d80 Mon Sep 17 00:00:00 2001 From: richardreeve Date: Thu, 4 Jan 2024 21:16:18 +0000 Subject: [PATCH 1/6] Trying new workflow --- .github/workflows/testing.yaml | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml index 0c8771ff..71ec0b25 100644 --- a/.github/workflows/testing.yaml +++ b/.github/workflows/testing.yaml @@ -11,22 +11,37 @@ on: jobs: phylo-tests: runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.experimental }} + continue-on-error: false strategy: matrix: julia-version: - '1.6' + - '1.9' - '1' os: - ubuntu-latest - macOS-latest - windows-latest - R-version: - - 'release' arch: - x64 - experimental: - - false + - arm64 + r-testing: + - ${{ true }} + - ${{ false }} + exclude: + - os: ubuntu-latest + arch: arm64 + - os: windows-latest + arch: arm64 + - os: macOS-latest + arch: x64 + - os: ubuntu-latest + r-testing: ${{ true }} + - os: windows-latest + r-testing: ${{ true }} + - os: macOS-latest + r-testing: ${{ false }} + arch: x64 fail-fast: false steps: - name: Checkout code @@ -37,12 +52,10 @@ jobs: version: ${{ matrix.julia-version }} arch: ${{ matrix.arch }} - name: Install R - if: matrix.os == 'macOS-latest' + if: ${{ matrix.r-testing }} uses: r-lib/actions/setup-r@v2 - with: - r-version: ${{ matrix.R-version }} - name: Install ape - if: matrix.os == 'macOS-latest' + if: ${{ matrix.r-testing }} run: | install.packages("ape", repos="http://cran.r-project.org") shell: R --vanilla --file={0} From 81abefd28bc67983d618947923118f9918642861 Mon Sep 17 00:00:00 2001 From: richardreeve Date: Thu, 4 Jan 2024 21:19:47 +0000 Subject: [PATCH 2/6] Fix typo --- .github/workflows/testing.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml index 71ec0b25..c7df4f00 100644 --- a/.github/workflows/testing.yaml +++ b/.github/workflows/testing.yaml @@ -41,7 +41,6 @@ jobs: r-testing: ${{ true }} - os: macOS-latest r-testing: ${{ false }} - arch: x64 fail-fast: false steps: - name: Checkout code From 3dbc443a2b6752592ed7406f48f2883fd30d7d95 Mon Sep 17 00:00:00 2001 From: richardreeve Date: Thu, 4 Jan 2024 21:35:31 +0000 Subject: [PATCH 3/6] Abandon macos aarch64 testing, as only self-hosted --- .github/workflows/testing.yaml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml index c7df4f00..1f38f501 100644 --- a/.github/workflows/testing.yaml +++ b/.github/workflows/testing.yaml @@ -20,21 +20,14 @@ jobs: - '1' os: - ubuntu-latest - - macOS-latest + - macos-latest - windows-latest arch: - x64 - - arm64 r-testing: - ${{ true }} - ${{ false }} exclude: - - os: ubuntu-latest - arch: arm64 - - os: windows-latest - arch: arm64 - - os: macOS-latest - arch: x64 - os: ubuntu-latest r-testing: ${{ true }} - os: windows-latest From d0e6f66fe7f2995b9f4936e5e9b4b2f4c873db0a Mon Sep 17 00:00:00 2001 From: richardreeve Date: Thu, 4 Jan 2024 22:47:45 +0000 Subject: [PATCH 4/6] Remove irrelevant code in constructor --- src/RecursiveTree.jl | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/RecursiveTree.jl b/src/RecursiveTree.jl index 20e8665c..dcfe35a1 100644 --- a/src/RecursiveTree.jl +++ b/src/RecursiveTree.jl @@ -39,10 +39,10 @@ RecursiveNode{RT, NL, NodeData, BranchData, BT, LenUnits}(name::NL, data::NodeDa data, missing) """ - struct RecoursiveTree <: AbstractTree + struct RecursiveTree <: AbstractTree A phylogenetic tree type containing RecursiveElts as both nodes and branches, -allowing navigation of the tree using only the node and branch elements. +allowing navigation of the tree using only the node and branch elements. """ mutable struct RecursiveTree{RT, NL, NodeData, BranchData, BT <: BranchingType, LenUnits, TD} <: AbstractTree{OneTree, RT, NL, @@ -67,8 +67,7 @@ mutable struct RecursiveTree{RT, NL, NodeData, BranchData, BT <: BranchingType, BT, LenUnits, TD}(tipnames::AbstractVector{NL} = NL[]; name::String = TREENAME, tipdata::TD = _emptydata(TD), - rootheight::Union{LenUnits, Missing} = missing, - validate::Bool = false) where + rootheight::Union{LenUnits, Missing} = missing) where {RT, NL, NodeData, BranchData, BT, LenUnits, TD} NT = RecursiveNode{RT, NL, NodeData, BranchData, BT, LenUnits} BrT = RecursiveBranch{RT, NL, NodeData, BranchData, BT, LenUnits} @@ -81,15 +80,9 @@ mutable struct RecursiveTree{RT, NL, NodeData, BranchData, BT <: BranchingType, if !isempty(tipnames) createnodes!(tree, tipnames) - elseif !isnothing(tree.tipdata) && !isempty(tree.tipdata) - createnodes!(tree, unique(keys(tree.tipdata))) end - if validate - validate!(tree) - else - tree.isvalid = missing - end + tree.isvalid = missing return tree end From 77df78da9c24e22a9851758504a92c73590f3781 Mon Sep 17 00:00:00 2001 From: richardreeve Date: Thu, 4 Jan 2024 23:46:29 +0000 Subject: [PATCH 5/6] Fix testing --- src/API.jl | 1 - src/Interface.jl | 3 +-- test/test_API.jl | 9 ++++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/API.jl b/src/API.jl index 0fcc0046..a7c4e6c5 100644 --- a/src/API.jl +++ b/src/API.jl @@ -208,7 +208,6 @@ Returns a vector of nodes for a OneTree tree. Either _getnodes() must be implemented for any OneTree tree type. """ function _getnodes end -_getnodes(::T) where T <: AbstractTree = error("No _getnodes() method for tree type $T") _getnodes(tree::AbstractTree{OneTree}, order::TraversalOrder) = _traversal(tree, order) diff --git a/src/Interface.jl b/src/Interface.jl index c3d1c5ca..b3fbcb98 100644 --- a/src/Interface.jl +++ b/src/Interface.jl @@ -160,8 +160,7 @@ subtrees) will return the number of subtrees. ManyTrees types will return a Dict of counts of the number of roots for each tree in the set. """ function nroots end -nroots(::AbstractTree{OneTree, Unrooted}) = 0 -nroots(tree::AbstractTree{OneTree, <: Rooted}) = _nroots(tree) +nroots(tree::AbstractTree{OneTree}) = _nroots(tree) nroots(trees::AbstractTree{ManyTrees}, name) = nroots(gettree(trees, name)) nroots(trees::AbstractTree{ManyTrees}) = Dict(name => nroots(gettree(trees, name)) for name in _gettreenames(trees)) diff --git a/test/test_API.jl b/test/test_API.jl index 3e90606a..cf803999 100644 --- a/test/test_API.jl +++ b/test/test_API.jl @@ -18,10 +18,13 @@ end tn = TestNode(); tb = TestBranch(); - @test_throws ErrorException _getnodes(tt) + @test_throws MethodError _getnodes(tt, preorder) @test_throws ErrorException _getnodenames(tt) - @test_throws ErrorException _getbranches(tb) - @test_throws ErrorException _getnodes(tt) + @test_throws MethodError _nnodes(tt) + @test_throws ErrorException _getbranches(tt) + @test_throws ErrorException _nbranches(tt) + @test_throws MethodError _hasnode(tt, tn) + @test_throws MethodError _hasbranch(tt, tb) @test_throws ErrorException _hasinbound(tt, tn) @test_throws ErrorException _getinbound(tt, tn) @test_throws ErrorException _getoutbounds(tt, tn) From 8b8b42077441db2c52b396baa6508224d33587a7 Mon Sep 17 00:00:00 2001 From: richardreeve Date: Fri, 5 Jan 2024 00:00:52 +0000 Subject: [PATCH 6/6] Extra tests --- test/test_API.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test_API.jl b/test/test_API.jl index cf803999..a6c45b35 100644 --- a/test/test_API.jl +++ b/test/test_API.jl @@ -13,6 +13,9 @@ end struct TestTree <: Phylo.AbstractTree{OneTree, OneRoot, String, TestNode, TestBranch} end +import Phylo.API: _preferbranchobjects +_preferbranchobjects(::Type{<: TestTree}) = false + @testset "Check errors" begin tt = TestTree(); tn = TestNode(); @@ -22,9 +25,12 @@ end @test_throws ErrorException _getnodenames(tt) @test_throws MethodError _nnodes(tt) @test_throws ErrorException _getbranches(tt) + @test_throws ErrorException _getbranchnames(tt) @test_throws ErrorException _nbranches(tt) @test_throws MethodError _hasnode(tt, tn) + @test_throws ErrorException _hasnode(tt, "test") @test_throws MethodError _hasbranch(tt, tb) + @test_throws ErrorException _hasbranch(tt, 1) @test_throws ErrorException _hasinbound(tt, tn) @test_throws ErrorException _getinbound(tt, tn) @test_throws ErrorException _getoutbounds(tt, tn)