diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b29803f69..e2662045c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,16 +1,21 @@ name: CI on: - # push: - # branches: [ master] + push: + branches: [master] pull_request: types: - opened - reopened - synchronize +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: test: name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + continue-on-error: ${{ matrix.experimental }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -18,23 +23,33 @@ jobs: version: - '1.6' - '1' # latest 1.X + experimental: + - false os: - ubuntu-latest - windows-latest - macOS-latest - arch: - - x64 + arch: [x64] + include: + - os: ubuntu-latest + experimental: true + version: '~1.11.0-0' # upcoming julia version, next `rc` + arch: x64 + - os: ubuntu-latest + experimental: true + version: 'nightly' + arch: x64 steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v3 + - uses: julia-actions/setup-julia@latest with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - uses: julia-actions/cache@v1 - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-runtest@v1 - - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v1 + - uses: julia-actions/julia-buildpkg@latest + - uses: julia-actions/julia-runtest@latest + - uses: julia-actions/julia-processcoverage@latest + - uses: codecov/codecov-action@v3 with: file: lcov.info @@ -44,7 +59,7 @@ jobs: - uses: julia-actions/setup-julia@latest with: version: '1' # latest 1.X - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Install JuliaFormatter and format # This will use the latest version by default but you can set the version like so: # diff --git a/Project.toml b/Project.toml index 6a192b9e7..8b13de947 100644 --- a/Project.toml +++ b/Project.toml @@ -14,9 +14,9 @@ Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" MyterialColors = "1c23619d-4212-4747-83aa-717207fae70f" OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a" +PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" ProgressLogging = "33c8b6b6-d38a-422a-b730-caa89a2f386c" REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" -PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" @@ -25,13 +25,20 @@ UnicodeFun = "1cfade01-22cf-5700-b092-accc4b62d6e1" [compat] AbstractTrees = "0.4" CodeTracking = "1" +Dates = "1" Highlights = "0.5" +InteractiveUtils = "1" +Logging = "1" +Markdown = "1" MyterialColors = "0.3" OrderedCollections = "1" Parameters = "0.12" -ProgressLogging = "0.1" PrecompileTools = "1" +ProgressLogging = "0.1" +REPL = "1" Tables = "1" +UUIDs = "1" +Unicode = "1" UnicodeFun = "0.4" julia = "1.6" @@ -41,7 +48,6 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" -UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [targets] test = ["Random", "StableRNGs", "Suppressor", "Test", "TimerOutputs"] diff --git a/README.md b/README.md index 012101138..1be804a0f 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![codecov](https://codecov.io/gh/FedeClaudi/Term.jl/branch/master/graph/badge.svg?token=SZM70KS8PK)](https://codecov.io/gh/FedeClaudi/Term.jl) [![Dev docs](https://img.shields.io/badge/docs-stable-blue.svg)](https://fedeclaudi.github.io/Term.jl/dev/) [![JuliaHub deps](https://juliahub.com/docs/Term/deps.svg)](https://juliahub.com/ui/Packages/Term/Ctj9q?t=2) +[![PkgEval](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/T/Term.named.svg)](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/T/Term.html) [![Term.jl Downloads](https://shields.io/endpoint?url=https://pkgs.genieframework.com/api/v1/badge/Term)](https://pkgs.genieframework.com?packages=Term) ![](readme.png) diff --git a/src/Live/live.jl b/src/Live/live.jl index c9ed7ccc8..efeef6f26 100644 --- a/src/Live/live.jl +++ b/src/Live/live.jl @@ -1,6 +1,13 @@ module LiveWidgets -using REPL.TerminalMenus: readkey, terminal -using REPL.Terminals: raw!, AbstractTerminal +import REPL +import REPL.Terminals: raw!, AbstractTerminal +import REPL.TerminalMenus: readkey +const terminal = @static if isdefined(REPL.TerminalMenus, :default_terminal) + REPL.TerminalMenus.default_terminal() +else + REPL.TerminalMenus.terminal +end + using Dates import Base.Docs: doc as getdocs using Markdown diff --git a/src/highlight.jl b/src/highlight.jl index 51cf4a178..4b705dec3 100644 --- a/src/highlight.jl +++ b/src/highlight.jl @@ -116,7 +116,7 @@ function load_code_and_highlight(path::AbstractString, lineno::Int; δ::Int = 3) code = split(join(code), "\n") # clean - clean(line) = replace(line, " {/ }" => "", '\r' => "") + clean(line) = replace(replace(line, " {/ }" => ""), '\r' => "") # NOTE: julia `1.6` compat codelines = clean.(code) # [10-δ:10+δ] linenos = linenos # [10-δ:10+δ] diff --git a/test/10_test_inspect.jl b/test/10_test_inspect.jl index 29e98c791..d295b8abd 100644 --- a/test/10_test_inspect.jl +++ b/test/10_test_inspect.jl @@ -13,11 +13,15 @@ e7 = :(2x + 3 * √(3x^2)) e8 = :(print(lstrip("test"))) expressions = (e1, e2, e3, e4, e5, e6, e7, e8) +bool_env(key, default = "false") = tryparse(Bool, get(ENV, key, default)) + # save expressions to file (for later comparisons) -for (i, e) in enumerate(expressions) - tofile(string(Dendogram(e)), "./txtfiles/dendo_expr_$i.txt") - tofile(string(Tree(e)), "./txtfiles/tree_expr_$i.txt") - tofile(sprint(expressiontree, e), "./txtfiles/exptree_expr_$i.txt") +if !(bool_env("CI") || bool_env("PKGEVAL") || bool_env("JULIA_PKGEVAL")) + for (i, e) in enumerate(expressions) + tofile(string(Dendogram(e)), "./txtfiles/dendo_expr_$i.txt") + tofile(string(Tree(e)), "./txtfiles/tree_expr_$i.txt") + tofile(sprint(expressiontree, e), "./txtfiles/exptree_expr_$i.txt") + end end @testset "Inspect: expressions" begin diff --git a/test/15_test_progress.jl b/test/15_test_progress.jl index cedc2a81a..50d942d29 100644 --- a/test/15_test_progress.jl +++ b/test/15_test_progress.jl @@ -87,7 +87,7 @@ end end start!(pbar) - (IS_WIN || colinfo ∉ (:detailed, :spinner)) || + (!IS_WIN && colinfo ∈ [:spinner]) && @compare_to_string render(job) "pbar_cols_style_$i" end diff --git a/test/19_test_repr.jl b/test/19_test_repr.jl index fabcd7465..0ca1c8bae 100644 --- a/test/19_test_repr.jl +++ b/test/19_test_repr.jl @@ -24,12 +24,13 @@ end obj = Rocket(10, 50, 5000, "NASA") @with_repr struct T end - VERSION ≥ v"1.7" && begin + if VERSION ≥ v"1.7" IS_WIN || @compare_to_string sprint(termshow, obj) "repr_rocket" - IS_WIN || @compare_to_string sprint(termshow, Rocket) "repr_rocket_struct" IS_WIN || @compare_to_string sprint(termshow, T()) "repr_T_struct" + if VERSION ≤ v"1.10" + IS_WIN || @compare_to_string sprint(termshow, Rocket) "repr_rocket_struct" + end end - @with_repr struct MyTestStruct3 x::String y::Array @@ -40,7 +41,7 @@ end mts = MyTestStruct3("aa aa"^100, zeros(100, 100), 3, Panel(), "b b b"^100) - VERSION ≥ v"1.7" && begin + if VERSION ≥ v"1.7" IS_WIN || @compare_to_string sprint(termshow, mts) "mts_repr" end end @@ -89,14 +90,14 @@ else ) end -@testset "TERMSHOW for types" begin +v"1.7" ≤ VERSION ≤ v"1.10" && @testset "TERMSHOW for types" begin for (i, t) in objs t = sprint(sprint_termshow, t) IS_WIN || @compare_to_string(t, "termshow_$i") end end -@testset "Term automatic repr" begin +v"1.7" ≤ VERSION ≤ v"1.10" && @testset "Term automatic repr" begin repr_show(io, x) = show(io, MIME("text/plain"), x) @test sprint(repr_show, 1) == "\e[38;2;144;202;249m1\e[39m" @@ -104,7 +105,7 @@ end IS_WIN || @compare_to_string(sprint(repr_show, :(x + y)), "automatic_repr_2") end -@testset "@showme" begin +v"1.7" ≤ VERSION ≤ v"1.10" && @testset "@showme" begin # fix for different path on remote CI loc = "\e[2m/Users/federicoclaudi/Documents/Github/Term.jl/src/" rem = " \e[2m/home/runner/work/Term.jl/Term.jl/src/"