Skip to content

Commit

Permalink
Update metadata and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
richardreeve committed Oct 23, 2024
1 parent 1c94999 commit 6f5f201
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 19 deletions.
48 changes: 37 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,46 @@ jobs:
strategy:
fail-fast: false
matrix:
version:
- '1.10'
julia-version:
- '1.6'
- 'pre'
- '1'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
- arm64
exclude:
- os: macOS-latest
julia-version: '1.6'
arch: arm64
- os: macOS-latest
julia-version: '1'
arch: x64
- os: ubuntu-latest
arch: arm64
- os: windows-latest
arch: arm64
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- name: Checkout code
uses: actions/checkout@v4
- name: Set up julia
uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
arch: ${{ matrix.arch }}
- name: Cache
uses: julia-actions/cache@v2
- name: Build package
uses: julia-actions/julia-buildpkg@v1
- name: Running
uses: julia-actions/julia-runtest@v1
- name: Process coverage
uses: julia-actions/julia-processcoverage@v1
- name: Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
15 changes: 13 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ XLSX = "fdbf4ff8-1666-58a4-91e7-1b58723a45e0"
[compat]
CSV = "0.10"
DataFrames = "1"
Git = "1"
JuliaFormatter = "1"
Logging = "1.6"
Missings = "1"
Phylo = "0.5"
PhyloNetworks = "0.16"
Statistics = "1"
Pkg = "1.6"
ResearchSoftwareMetadata = "0.1.1"
Statistics = "1.6"
Test = "1.6"
Unitful = "1"
XLSX = "0.10"
julia = "1.6.7"
Expand All @@ -34,7 +40,12 @@ email = "[email protected]"
ror = "00vtgdb53"

[extras]
Git = "d7ba0133-e1db-5d97-8f8c-041e4b3a1eb2"
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
ResearchSoftwareMetadata = "58378933-4625-47fa-851e-05ee27d397bd"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
test = ["Git", "JuliaFormatter", "Logging", "Pkg", "ResearchSoftwareMetadata", "Test"]
12 changes: 9 additions & 3 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@
"developmentStatus": "active",
"codeRepository": "https://github.com/boydorr/TraitExtraction.jl",
"name": "TraitExtraction.jl",
"codemeta:contIntegration": {
"id": "https://github.com/boydorr/TraitExtraction.jl/actions/workflows/CI.yaml"
},
"continuousIntegration": "https://github.com/boydorr/TraitExtraction.jl/actions/workflows/CI.yaml",
"issueTracker": "https://github.com/boydorr/TraitExtraction.jl/issues",
"readme": "https://github.com/boydorr/TraitExtraction.jl/blob/main/README.md",
"dateCreated": "2024-09-29",
"operatingSystem": [
"Linux"
"Linux",
"Windows",
"macOS"
],
"version": "v0.1.0",
"dateModified": "2024-10-16",
"datePublished": "2024-10-16",
"dateModified": "2024-10-23",
"datePublished": "2024-10-23",
"downloadUrl": "https://github.com/boydorr/TraitExtraction.jl/archive/refs/tags/v0.1.0.tar.gz",
"license": "https://spdx.org/licenses/BSD-2-Clause",
"author": [
Expand Down
3 changes: 3 additions & 0 deletions src/TraitExtraction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

module TraitExtraction

# Path into package
path(path...; dir::String = "test") = joinpath(@__DIR__, "..", dir, path...)

using XLSX, CSV
using DataFrames, Unitful, Statistics, Phylo

Expand Down
156 changes: 153 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,158 @@
# SPDX-License-Identifier: BSD-2-Clause

using TraitExtraction
using Test
using TraitExtraction
using Pkg

rsmd = get(ENV, "RSMD_CROSSWALK", "FALSE")

if rsmd == "FALSE"
# Normal testing

# Identify files in test/ that are testing matching files in src/
# - src/Source.jl will be matched by test/test_Source.jl
filebase = String[]
for (root, dirs, files) in walkdir("../src")
append!(filebase,
map(file -> replace(file, r"(.*).jl" => s"\1"),
filter(file -> occursin(r".*\.jl", file), files)))
end

testbase = map(file -> replace(file, r"test_(.*).jl" => s"\1"),
filter(str -> occursin(r"^test_.*\.jl$", str), readdir()))

# Identify tests with no matching file
superfluous = filter(f -> f filebase, testbase)
if length(superfluous) > 0
println()
@info "Potentially superfluous tests:"
for f in superfluous
println(" + $f.jl")
end
println()
end

# Identify files with no matching test
notest = filter(f -> f testbase, filebase)
if length(notest) > 0
println()
@info "Potentially missing tests:"
for f in notest
println(" - $f.jl")
end
println()
end

# Identify files in test/ that are testing matching files in ext/
# - ext/SourceExt.jl will be matched by test/ext_SourceExt.jl
filebase = String[]
for (root, dirs, files) in walkdir("../ext")
append!(filebase,
map(file -> replace(file, r"(.*).jl" => s"\1"),
filter(file -> occursin(r".*\.jl", file), files)))
end

extbase = map(file -> replace(file, r"ext_(.*).jl" => s"\1"),
filter(str -> occursin(r"^ext_.*\.jl$", str), readdir()))

# Identify tests with no matching file
superfluous = filter(f -> f filebase, extbase)
if length(superfluous) > 0
println()
@info "Potentially superfluous extension tests:"
for f in superfluous
println(" + $f.jl")
end
println()
end

# Identify files with no matching test
notest = filter(f -> f extbase, filebase)
if length(notest) > 0
println()
@info "Potentially missing extension tests:"
for f in notest
println(" - $f.jl")
end
println()
end

@testset "TraitExtraction.jl" begin
@test isfile(TraitExtraction.path("runtests.jl"))
println()
@info "Running tests for files:"
for t in testbase
println(" = $t.jl")
end
println()

@info "Running tests..."
@testset for t in testbase
fn = "test_$t.jl"
println(" * Testing $t.jl ...")
include(fn)
end

println()
@info "Running tests for extensions:"
for t in extbase
println(" = $t.jl")
end
println()

@info "Running extension tests..."
@testset for t in extbase
fn = "ext_$t.jl"
println(" * Testing $t.jl extension...")
include(fn)
end
end

# Identify files that are cross-validating results against other packages
# test/pkg_Package.jl should validate results against the Package package

pkgbase = map(file -> replace(file, r"pkg_(.*).jl$" => s"\1"),
filter(str -> occursin(r"^pkg_.*\.jl$", str),
readdir()))

if length(pkgbase) > 0
@info "Cross validation packages:"
@testset begin
for p in pkgbase
println(" = $p")
end
println()

@testset for p in pkgbase
fn = "pkg_$p.jl"
println(" * Validating $p.jl ...")
include(fn)
end
end
end
end

if rsmd == "TRUE" || !haskey(ENV, "RUNNER_OS") # Crosswalk runner or local testing
# Test RSMD crosswalk and other hygene issues

# Identify files that are checking package hygene
cleanbase = map(file -> replace(file, r"clean_(.*).jl$" => s"\1"),
filter(str -> occursin(r"^clean_.*\.jl$", str),
readdir()))

if length(cleanbase) > 0
@info "Crosswalk and clean testing:"
@testset begin
for c in cleanbase
println(" = $c")
end
println()

@testset "TraitExtraction.jl" begin
# Write your tests here.
@testset for c in cleanbase
fn = "clean_$c.jl"
println(" * Verifying $c.jl ...")
include(fn)
end
end
end
end

0 comments on commit 6f5f201

Please sign in to comment.