Skip to content

Commit

Permalink
Merge pull request #36 from alyst/fix_ci
Browse files Browse the repository at this point in the history
Fix CI
  • Loading branch information
CarloLucibello authored Jul 10, 2021
2 parents cf60b5e + 9ac7df8 commit 9f1e5a7
Show file tree
Hide file tree
Showing 24 changed files with 36 additions and 85 deletions.
13 changes: 3 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
arch:
- x64
- x86
exclude:
- os: macOS-latest
arch: x86
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
Expand All @@ -44,13 +47,3 @@ jobs:
- uses: codecov/codecov-action@v1
with:
file: lcov.info
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-docdeploy@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
[![Build status](https://github.com/andrewcooke/ParserCombinator.jl/workflows/CI/badge.svg)](https://github.com/andrewcooke/ParserCombinator.jl/actions?query=workflow%3ACI+branch%3Amaster)
[![Codecov](https://codecov.io/gh/andrewcooke/ParserCombinator.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/andrewcooke/ParserCombinator.jl)

[![ParserCombinator](http://pkg.julialang.org/badges/ParserCombinator_0.3.svg)](http://pkg.julialang.org/?pkg=ParserCombinator&ver=0.3)
[![ParserCombinator](http://pkg.julialang.org/badges/ParserCombinator_0.4.svg)](http://pkg.julialang.org/?pkg=ParserCombinator&ver=0.4)
[![ParserCombinator](http://pkg.julialang.org/badges/ParserCombinator_0.5.svg)](http://pkg.julialang.org/?pkg=ParserCombinator&ver=0.5)


# ParserCombinator

Expand Down
10 changes: 2 additions & 8 deletions src/core/debug.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,7 @@ MAX_RES = 50
MAX_SRC = 10
MAX_IND = 10

if VERSION < v"0.4-"
shorten(s) = s
else
# shorten(s) = replace(s, r"(?:[a-zA-Z]+\.)+([a-zA-Z]+)", s"\1")
shorten(s) = replace(s, r"(?:[a-zA-Z]+\.)+([a-zA-Z]+)" =>
Base.SubstitutionString("\1"))
end
shorten(s) = replace(s, r"(?:[a-zA-Z]+\.)+([a-zA-Z]+)" => s"\1")

function truncate(s::AbstractString, n=10)
if length(s) <= n
Expand Down Expand Up @@ -135,7 +129,7 @@ function src(s::LineAt, i::LineIter; max=MAX_SRC)
end
end
end

function debug(k::Debug{S}, e::Execute) where {S<:LineAt}
@printf("%3d,%-3d:%s %02d %s%s->%s\n",
e.iter.line, e.iter.column, src(k.source, e.iter), k.depth[end], indent(k), e.parent.name, e.child.name)
Expand Down
17 changes: 13 additions & 4 deletions src/core/parsers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function producer(c::Channel, k::Config, m::Matcher; debug=false)
end
end
end

catch x
if (debug)
println("debug was set, so showing error from inside task")
Expand All @@ -165,7 +165,7 @@ end

# helper functions to generate the parsers from the above

# these assume that any config construct takes a single source argument
# these assume that any config construct takes a single source argument
# plus optional keyword args

function make(config, source::S, matcher; debug=false, kargs...) where {S}
Expand All @@ -181,8 +181,17 @@ function make_all(config; kargs_make...)
end

function once(channel)
for result in channel
return result
try
for result in channel
return result
end
catch ex
# unwrap exception
if VERSION >= v"1.1"
ex isa TaskFailedException ? throw(first(first(Base.catch_stack(ex.task)))) : rethrow()
else
rethrow()
end
end
throw(ParserException("cannot parse"))
end
Expand Down
Empty file removed test/REQUIRE
Empty file.
3 changes: 0 additions & 3 deletions test/core/calc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ for (src, val) in [
]
# @test_approx_eq calc(parse_dbg(src, Trace(all))[1]) val
@test calc(parse_one(src, Trace(all))[1]) val
println("$src = $val")
end

for (src, ast, val) in
Expand Down Expand Up @@ -168,6 +167,4 @@ for i in 1:20
end
end

println("calc ok")

end
2 changes: 0 additions & 2 deletions test/core/case.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,4 @@ end
# and we can see that Case calls Pattern, as expected; that the Pattern
# returns foo; and that Case transforms that to Foo.

println("case ok")

end
2 changes: 0 additions & 2 deletions test/core/debug.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@ debug, task = make(Debug, "123abc", grammar; delegate=NoCache)
@test_throws ParserException once(task)
@test debug.max_iter == 4

println("debug ok")

end
4 changes: 0 additions & 4 deletions test/core/fix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ for (src, v) in [
]
# @test calc(parse_dbg(src, Trace(all))[1]) ≈ v
@test calc(parse_one(src, Trace(all))[1]) v
println("$src = $v")
end


println("fix ok")

end
2 changes: 0 additions & 2 deletions test/core/names.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ end
@test a.name == :a
@test b.name == :b

println("names ok")

end
2 changes: 0 additions & 2 deletions test/core/print.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
println(Seq())
println(e"a" + E"b" | p"c" > tuple)

println("print ok")

end
2 changes: 0 additions & 2 deletions test/core/slow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,4 @@ end
slow(3)
#slow(7) # not for travis!

println("slow ok")

end
2 changes: 0 additions & 2 deletions test/core/sources.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,4 @@ line = Trace(p"(.|\n)+"[0:end] + Eos())
@test parse_one("abc\n", line) == ["abc\n"]
@test parse_one(LineSource("abc\n"), line) == ["abc\n"]

println("sources ok")

end
4 changes: 2 additions & 2 deletions test/core/speed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ function run_type(n)
println("types: $count")
end

type A end
type B end
struct A end
struct B end

function random_type()
if rand(1:2) == 1
Expand Down
10 changes: 5 additions & 5 deletions test/core/stack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ stack(0, 10)
@time println(stack(0, 100_000))
# stack limit is somewhere around 100,000 (certainly less than 200,000)

abstract Msg
abstract type Msg end

type Call<:Msg
struct Call <: Msg
before::Function
after::Function
value::Int
end

type Return<:Msg
struct Return <: Msg
value::Int
end

function inc(n, m)
if n > m
Return(n)
Expand Down Expand Up @@ -55,7 +55,7 @@ function trampoline(n, m)
end
n
end


trampoline(0, 10)
@time println(trampoline(0, 100_000))
Expand Down
3 changes: 0 additions & 3 deletions test/core/tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ for i in 1:10
n = rand(0:4)
s = repeat("a", n)
m = match(r, s)
println("$lo $hi $s $r")
if m === nothing
@test_throws ParserException parse_one(s, Repeat(Equal("a"), lo, hi; greedy=greedy))
else
Expand Down Expand Up @@ -104,6 +103,4 @@ for backtrack in (true, false)
[3,0]]
end

println("tests ok")

end
5 changes: 0 additions & 5 deletions test/core/try.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,14 @@ for parse in (parse_try, parse_try_cache, parse_try_dbg, parse_try_cache_dbg)
end
open("core/test1.txt", "r") do io
result = parse(io, Try(p"[a-z]"[0:end] + e"m" > string))
println(result)
@test result == Any["abcdefghijklm"]
end
open("core/test1.txt", "r") do io
# multiple lines
result = parse(io, Try(p"(.|\n)"[0:end] + e"5" > string))
println(result)
@test result == Any["abcdefghijklmnopqrstuvwxyz\n012345"]
end
@test_throws ParserError{LineIter} parse("?", Alt!(p"[a-z]", p"\d", Error("not letter or number")))
end


println("try ok")

end
2 changes: 0 additions & 2 deletions test/dot/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,4 @@ d1, d2 = d
@test nodes(d2) == Set(["a", "b", "c", "d", "e"])
@test edges(d2) == Set([("a","e"),("c","d"),("c","e"),("b","c"),("a","c"),("a","b")])

println("examples ok")

end
22 changes: 10 additions & 12 deletions test/dot/fragments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,28 @@ str_one = D.str_one > D.unesc_join
@test parse_one(":n", D.port)[1] == Port("n")
@test parse_one(":A", D.port)[1] == Port(StringID("A"))

@test parse_one("[a=b]", D.attr_list)[1] ==
@test parse_one("[a=b]", D.attr_list)[1] ==
Attribute[Attribute(StringID("a"), StringID("b"))]
@test parse_one("[a=b c = d]", D.attr_list)[1] ==
Attribute[Attribute(StringID("a"), StringID("b")),
@test parse_one("[a=b c = d]", D.attr_list)[1] ==
Attribute[Attribute(StringID("a"), StringID("b")),
Attribute(StringID("c"), StringID("d"))]
@test parse_one("[a=b; c = d]", D.attr_list)[1] ==
Attribute[Attribute(StringID("a"), StringID("b")),
@test parse_one("[a=b; c = d]", D.attr_list)[1] ==
Attribute[Attribute(StringID("a"), StringID("b")),
Attribute(StringID("c"), StringID("d"))]
@test parse_one("[a=b,c=d][e=f]", D.attr_list)[1] ==
Attribute[Attribute(StringID("a"), StringID("b")),
@test parse_one("[a=b,c=d][e=f]", D.attr_list)[1] ==
Attribute[Attribute(StringID("a"), StringID("b")),
Attribute(StringID("c"), StringID("d")),
Attribute(StringID("e"), StringID("f"))]

@test parse_one("a:b:c[d=e]", D.node_stmt)[1] ==
Node(NodeID(StringID("a"), Port(StringID("b"), "c")),
@test parse_one("a:b:c[d=e]", D.node_stmt)[1] ==
Node(NodeID(StringID("a"), Port(StringID("b"), "c")),
Attribute[Attribute(StringID("d"), StringID("e"))])

@test parse_one("a--b[c=d]", D.edge_stmt)[1] ==
Edge(EdgeNode[NodeID(StringID("a")), NodeID(StringID("b"))],
Edge(EdgeNode[NodeID(StringID("a")), NodeID(StringID("b"))],
Attribute[Attribute(StringID("c"), StringID("d"))])

@test parse_one("graph [a=b]", D.attr_stmt)[1] ==
GraphAttributes(Attribute[Attribute(StringID("a"), StringID("b"))])

println("fragments ok")

end
2 changes: 0 additions & 2 deletions test/dot/subgraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,4 @@ graph {
@test nodes(d) == Set(["a", "b", "c", "d"])
@test edges(d) == Set([("a","b"),("a","c"),("a","d"),("b","c"),("b","d"),("c","d")])

println("subgraphs ok")

end
1 change: 0 additions & 1 deletion test/gml/10k-49963.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

@testset "10k-49963" begin

println("10k-49963")
s = open(s -> read(s, String), "gml/10k-49963.gml")
parse_raw(s; debug=false)
@time parse_raw(s; debug=false)
Expand Down
1 change: 0 additions & 1 deletion test/gml/celegansneural.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

@testset "celegansneural" begin

println("celegansneural")
s = open(s -> read(s, String), "gml/celegansneural.gml")
parse_dict(s; debug=false)
@time x = parse_dict(s; debug=false)
Expand Down
7 changes: 1 addition & 6 deletions test/gml/errors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ for (text, msg) in [("a 1 ]", "Expected key"),
end
end

if VERSION < v"0.5-"
@test_throws ParserError parse_raw(text)
else
@test_throws ParserError{Int64} parse_raw(text)
end

@test_throws ParserError{Int} parse_raw(text)
end


Expand Down
1 change: 0 additions & 1 deletion test/gml/polblogs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#io = open("gml/polblogs.gml")
#@time parse_id_dict(io; debug=false)

println("polblogs")
s = open(s -> read(s, String), "gml/polblogs.gml")
x = parse_dict(s; debug=false)
@test length(x[:graph][1][:edge]) == 19090
Expand Down

7 comments on commit 9f1e5a7

@CarloLucibello
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alyst
Copy link
Contributor

@alyst alyst commented on 9f1e5a7 Jul 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like it's not working :(

@alyst
Copy link
Contributor

@alyst alyst commented on 9f1e5a7 Jul 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess @andrewcooke has to register the @JuliaRegistrator app for this repository.

@alyst
Copy link
Contributor

@alyst alyst commented on 9f1e5a7 Aug 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CarloLucibello There is an alternative way to trigger a package release via https://juliahub.com/ui/Registrator. Just type in the package URL, and the system will trigger a pull request to Julia Registry. Project collaborators have permission to do that.

@CarloLucibello
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mhmh, seems that https://juliahub.com/ui/Registrator is not responsive right now, I'll try again later

@CarloLucibello
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! I hope it will work

@alyst
Copy link
Contributor

@alyst alyst commented on 9f1e5a7 Aug 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CarloLucibello Looks like everything has worked including the automatic tagging of the new version by the TagBot action. Thank you!

Please sign in to comment.