From a20a3aa1e7b99286049d6433fd6dad3d52d3c7ce Mon Sep 17 00:00:00 2001 From: t-bltg Date: Tue, 26 Mar 2024 14:06:52 +0100 Subject: [PATCH 1/9] fix `using Term` on nightly - julia `1.12` --- Project.toml | 8 +++++++- src/Live/live.jl | 11 +++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 6a192b9e7..eb6c93a27 100644 --- a/Project.toml +++ b/Project.toml @@ -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" +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/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 From e6d97a19fe00804a43c2e8fb8fd51b92f6c4e40b Mon Sep 17 00:00:00 2001 From: t-bltg Date: Tue, 26 Mar 2024 14:24:27 +0100 Subject: [PATCH 2/9] fix tests --- test/15_test_progress.jl | 2 +- test/19_test_repr.jl | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) 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..ed6c33859 100644 --- a/test/19_test_repr.jl +++ b/test/19_test_repr.jl @@ -26,10 +26,11 @@ end VERSION ≥ v"1.7" && begin 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.11" + IS_WIN || @compare_to_string sprint(termshow, Rocket) "repr_rocket_struct" + end end - @with_repr struct MyTestStruct3 x::String y::Array @@ -89,14 +90,14 @@ else ) end -@testset "TERMSHOW for types" begin +VERSION ≤ v"1.11" && @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 +VERSION ≤ v"1.11" && @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 +VERSION ≤ v"1.11" && @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/" From 3eb6f32f9c0732869329889375752d4ccbe91420 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Tue, 26 Mar 2024 14:29:00 +0100 Subject: [PATCH 3/9] restore CI on `master` and test upcoming `1.11.0` --- .github/workflows/CI.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b29803f69..b964e479e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,7 +1,7 @@ name: CI on: - # push: - # branches: [ master] + push: + branches: [ master] pull_request: types: - opened @@ -18,6 +18,7 @@ jobs: version: - '1.6' - '1' # latest 1.X + - '~1.11.0-0' # upcoming julia version, next `rc` os: - ubuntu-latest - windows-latest @@ -25,16 +26,16 @@ jobs: 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 +45,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: # From 378f73b5da8c5950cb4127ec7f44ba252796548b Mon Sep 17 00:00:00 2001 From: t-bltg Date: Tue, 26 Mar 2024 14:32:00 +0100 Subject: [PATCH 4/9] add `nightly` to CI (mark as experimental) --- .github/workflows/CI.yml | 11 +++++++++-- test/19_test_repr.jl | 8 ++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b964e479e..085fe4b67 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,6 +11,7 @@ on: 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 @@ -19,12 +20,18 @@ jobs: - '1.6' - '1' # latest 1.X - '~1.11.0-0' # upcoming julia version, next `rc` + experimental: + - false os: - ubuntu-latest - windows-latest - macOS-latest - arch: - - x64 + arch: [x64] + include: + - os: ubuntu-latest + experimental: true + version: 'nightly' + arch: x64 steps: - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@latest diff --git a/test/19_test_repr.jl b/test/19_test_repr.jl index ed6c33859..564f688ee 100644 --- a/test/19_test_repr.jl +++ b/test/19_test_repr.jl @@ -27,7 +27,7 @@ end VERSION ≥ v"1.7" && begin IS_WIN || @compare_to_string sprint(termshow, obj) "repr_rocket" IS_WIN || @compare_to_string sprint(termshow, T()) "repr_T_struct" - if VERSION ≤ v"1.11" + if VERSION ≤ v"1.10" IS_WIN || @compare_to_string sprint(termshow, Rocket) "repr_rocket_struct" end end @@ -90,14 +90,14 @@ else ) end -VERSION ≤ v"1.11" && @testset "TERMSHOW for types" begin +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 -VERSION ≤ v"1.11" && @testset "Term automatic repr" begin +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" @@ -105,7 +105,7 @@ VERSION ≤ v"1.11" && @testset "Term automatic repr" begin IS_WIN || @compare_to_string(sprint(repr_show, :(x + y)), "automatic_repr_2") end -VERSION ≤ v"1.11" && @testset "@showme" begin +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/" From 2a1b3bc81ed526e8b6aff63231b795aaf0dd1420 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Tue, 26 Mar 2024 14:35:00 +0100 Subject: [PATCH 5/9] add `cancel-in-progress` to CI --- .github/workflows/CI.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 085fe4b67..e1a286fcb 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -8,6 +8,10 @@ on: - 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 }} From 03d06a76ebf9e81ca04970bec92baaa98c06e4e4 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Tue, 26 Mar 2024 14:52:43 +0100 Subject: [PATCH 6/9] fix test on `1.6` --- Project.toml | 4 ++-- src/highlight.jl | 2 +- test/19_test_repr.jl | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Project.toml b/Project.toml index eb6c93a27..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" @@ -33,8 +33,8 @@ Markdown = "1" MyterialColors = "0.3" OrderedCollections = "1" Parameters = "0.12" -ProgressLogging = "0.1" PrecompileTools = "1" +ProgressLogging = "0.1" REPL = "1" Tables = "1" UUIDs = "1" 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/19_test_repr.jl b/test/19_test_repr.jl index 564f688ee..0ca1c8bae 100644 --- a/test/19_test_repr.jl +++ b/test/19_test_repr.jl @@ -24,7 +24,7 @@ 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, T()) "repr_T_struct" if VERSION ≤ v"1.10" @@ -41,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 @@ -90,14 +90,14 @@ else ) end -VERSION ≤ v"1.10" && @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 -VERSION ≤ v"1.10" && @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" @@ -105,7 +105,7 @@ VERSION ≤ v"1.10" && @testset "Term automatic repr" begin IS_WIN || @compare_to_string(sprint(repr_show, :(x + y)), "automatic_repr_2") end -VERSION ≤ v"1.10" && @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/" From f5ad368fe90c15358373d8588b7ea7a00c9dc551 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Tue, 26 Mar 2024 15:17:32 +0100 Subject: [PATCH 7/9] fix NanoSoldier blacklist - add PkgEval badge --- README.md | 1 + test/10_test_inspect.jl | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) 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/test/10_test_inspect.jl b/test/10_test_inspect.jl index 29e98c791..9d55f938f 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 From 04da77aaf18cc790ff5b587cbdb806ce5458882b Mon Sep 17 00:00:00 2001 From: t-bltg Date: Tue, 26 Mar 2024 15:19:34 +0100 Subject: [PATCH 8/9] format --- test/10_test_inspect.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/10_test_inspect.jl b/test/10_test_inspect.jl index 9d55f938f..d295b8abd 100644 --- a/test/10_test_inspect.jl +++ b/test/10_test_inspect.jl @@ -13,7 +13,7 @@ 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)) +bool_env(key, default = "false") = tryparse(Bool, get(ENV, key, default)) # save expressions to file (for later comparisons) if !(bool_env("CI") || bool_env("PKGEVAL") || bool_env("JULIA_PKGEVAL")) From 440ce2c9ede230bc238c16fc3095420bcd9db8a3 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Tue, 26 Mar 2024 15:21:58 +0100 Subject: [PATCH 9/9] spare CI credits --- .github/workflows/CI.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e1a286fcb..e2662045c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,7 +1,7 @@ name: CI on: push: - branches: [ master] + branches: [master] pull_request: types: - opened @@ -23,7 +23,6 @@ jobs: version: - '1.6' - '1' # latest 1.X - - '~1.11.0-0' # upcoming julia version, next `rc` experimental: - false os: @@ -32,6 +31,10 @@ jobs: - macOS-latest 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'