Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix using Term on nightly - julia 1.12 #245

Merged
merged 9 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,55 @@
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
matrix:
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

Expand All @@ -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:
#
Expand Down
12 changes: 9 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"

Expand All @@ -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"]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 9 additions & 2 deletions src/Live/live.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/highlight.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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+δ]

Expand Down
12 changes: 8 additions & 4 deletions test/10_test_inspect.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/15_test_progress.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 8 additions & 7 deletions test/19_test_repr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -89,22 +90,22 @@ 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"

IS_WIN || @compare_to_string(sprint(repr_show, Dict(1 => :x)), "automatic_repr_1")
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/"
Expand Down
Loading