Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxd3 committed Mar 25, 2024
1 parent dc6f92a commit a0cc28b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 44 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,33 @@ jobs:
${{ runner.os }}-julia-${{ matrix.version }}-
- uses: julia-actions/julia-buildpkg@v1
- name: Running elementary tests
run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"--elementary\"]);"
uses: julia-actions/julia-runtest@v1
env:
TEST_GROUP: "elementary"
- name: Running compilation tests
run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"--compilation\"]);"
uses: julia-actions/julia-runtest@v1
env:
TEST_GROUP: "compilation"
- name: Profile compiler passes
run: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=[\"--profile\"]);"
uses: julia-actions/julia-runtest@v1
env:
TEST_GROUP: "profile"
- name: Running `gibbs` tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["--gibbs"]);"
command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true);"
env:
TEST_GROUP: "gibbs"
- name: Running `mcmchains` tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true, test_args=["--mcmchains"]);"
command: julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.test(coverage=true);"
env:
TEST_GROUP: "mcmchains"
- uses: julia-actions/julia-processcoverage@v1
if: matrix.coverage
- uses: codecov/codecov-action@v4
Expand Down
54 changes: 15 additions & 39 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ using ReverseDiff
AbstractMCMC.setprogress!(false)

const Tests = (
"--elementary",
"--compilation",
"--profile",
"--gibbs",
"--mcmchains",
"elementary",
"compilation",
"profile",
"gibbs",
"mcmchains",
"all"
)

for arg in ARGS
if arg Tests
error("Unknown test group: $arg")
end
const test_group = get(ENV, TEST_GROUP, "all")
if test_group Tests
error("Unknown test group: $test_group")
end

@info "Running tests for groups: $(ARGS)"
@info "Running tests for groups: $test_group"

if "--elementary" in ARGS
if test_group == "elementary" || test_group == "all"
@testset "Unit Tests" begin
Documenter.doctest(JuliaBUGS; manual=false)
include("utils.jl")
Expand All @@ -49,7 +49,7 @@ if "--elementary" in ARGS
include("graphs.jl")
end

if "--compilation" in ARGS
if test_group == "compilation" || test_group == "all"
@testset "BUGS examples volume 1" begin
@testset "$m" for m in keys(JuliaBUGS.BUGSExamples.VOLUME_1)
m = JuliaBUGS.BUGSExamples.VOLUME_1[m]
Expand All @@ -64,38 +64,14 @@ if "--compilation" in ARGS
include("logp_tests/test_logp.jl")
end

if "--profile" in ARGS
if test_group == "profile" || test_group == "all"
include("profile.jl")
end

if "--gibbs" in ARGS
if test_group == "gibbs" || test_group == "all"
include("gibbs.jl")
end

if "--mcmchains" in ARGS
include("ext/mcmchains.jl")
end

if isempty(ARGS) # run all
@testset "Unit Tests" begin
Documenter.doctest(JuliaBUGS; manual=false)
include("utils.jl")
end
include("parser/test_parser.jl")
include("passes.jl")
@testset "BUGS examples volume 1" begin
@testset "$m" for m in keys(JuliaBUGS.BUGSExamples.VOLUME_1)
m = JuliaBUGS.BUGSExamples.VOLUME_1[m]
model = compile(m.model_def, m.data, m.inits[1])
end
end
@testset "Some corner cases" begin
include("bugs_primitives.jl")
include("compile.jl")
include("cumulative_density.jl")
end
include("graphs.jl")
include("logp_tests/test_logp.jl")
include("gibbs.jl")
if test_group == "mcmchains" || test_group == "all"
include("ext/mcmchains.jl")
end

0 comments on commit a0cc28b

Please sign in to comment.