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

Bring back CI and upgrade to Julia 1.6 #136

Merged
merged 32 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e6f0f8e
Set up github actions CI and update test environment
IanButterworth May 16, 2021
335a5d4
update reference tests
IanButterworth May 16, 2021
f353306
fix local var in tests
IanButterworth May 17, 2021
5226d33
force some canvas test references to read as raw txt
IanButterworth May 17, 2021
7bba5db
merge upstream/master
t-bltg Aug 16, 2021
13f9c37
use a stable rng for testing
t-bltg Aug 16, 2021
705d018
Merge pull request #1 from t-bltg/ib/fix_testing
IanButterworth Aug 16, 2021
4428f03
Force txt format
t-bltg Aug 16, 2021
e4734c8
fix type inference issue
t-bltg Aug 16, 2021
74b3e26
force text format
t-bltg Aug 16, 2021
6c6a7bf
fix deprecation test
t-bltg Aug 16, 2021
a82b08f
fix deprecation message
t-bltg Aug 16, 2021
13e21e2
Update histogram.jl
t-bltg Aug 16, 2021
cdbcb73
fix typo
t-bltg Aug 16, 2021
40de65d
another typo
t-bltg Aug 16, 2021
61ebbaa
update ref images
t-bltg Aug 16, 2021
d841158
drop 1.0 and 1.1
t-bltg Aug 16, 2021
8798397
force txt format
t-bltg Aug 17, 2021
b05fb68
restore depwarn - add message in test file
t-bltg Aug 17, 2021
e1e8098
change CI strategy matrix
t-bltg Aug 17, 2021
9646a75
Merge branch 'ib/fix_testing' of github.com:IanButterworth/UnicodePlo…
t-bltg Aug 17, 2021
9a64885
spare windows/macos CI credits
t-bltg Aug 17, 2021
1b8d9d9
default KW for test_reference macro
t-bltg Aug 17, 2021
755ad76
fix broken macro kwargs
t-bltg Aug 17, 2021
ac97e9a
replace infix `⊻` by `xor`
t-bltg Aug 17, 2021
a46fe6d
fix ASCII table lookup for different julia versions 1.0 vs 1.6
t-bltg Aug 17, 2021
d358e30
restore LTS 1.0 version
t-bltg Aug 17, 2021
4a562fc
generate new images for ascii canvas
t-bltg Aug 17, 2021
f909fd9
sort dicts based on keys
t-bltg Aug 17, 2021
8cdd9d0
make sprand stable (rng)
t-bltg Aug 17, 2021
2cc6ccc
update tst_spy ref images
t-bltg Aug 17, 2021
3b2e79d
inplace sort
t-bltg Aug 18, 2021
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
1 change: 0 additions & 1 deletion .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
ssh: ${{ secrets.TAGBOT }}

50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
tags: '*'
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version: ['1.0', '1', 'nightly']
os: [ubuntu-latest]
arch: [x64]
include: # spare windows/macos CI credits
- os: windows-latest
version: '1'
arch: x64
- os: macOS-latest
version: '1'
arch: x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
env:
JULIA_DEBUG: 'Main,UnicodePlots'
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
file: lcov.info
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
*.jl.cov
*.jl.mem
/Manifest.toml
/test/Manifest.toml
.DS_Store
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ julia = "1"

[extras]
ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "ReferenceTests"]
test = ["ReferenceTests", "StableRNGs", "Random", "Test"]
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# UnicodePlots

[![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE.md)
[![Build Status](https://travis-ci.org/Evizero/UnicodePlots.jl.svg?branch=master)](https://travis-ci.org/Evizero/UnicodePlots.jl)
[![Coverage Status](https://coveralls.io/repos/Evizero/UnicodePlots.jl/badge.svg?branch=master&service=github)](https://coveralls.io/github/Evizero/UnicodePlots.jl?branch=master)

| Julia | CI |
| ------- | -- |
| v1 | [![CI](https://github.com/Evizero/UnicodePlots.jl/actions/workflows/ci.yml/badge.svg)](https://github.com/Evizero/UnicodePlots.jl/actions/workflows/ci.yml) |
| nightly | [![CI (Julia nightly)](https://github.com/Evizero/UnicodePlots.jl/actions/workflows/ci_julia_nightly.yml/badge.svg)](https://github.com/Evizero/UnicodePlots.jl/actions/workflows/ci_julia_nightly.yml) |

Advanced Unicode plotting library designed for use in Julia's REPL.

## High-level Interface
Expand Down
10 changes: 2 additions & 8 deletions src/canvas/asciicanvas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,17 @@ ascii_lookup[0b100_100_100] = '|'
ascii_lookup[0b001_001_001] = '|'
ascii_lookup[0b110_011_110] = '}'

# julia #18977
if !isdefined(Base, :⊻)
const ⊻ = $
end

ascii_decode[0b1] = ' '
for i in 1:511
min_dist = typemax(Int)
min_char = ' '
for (k, v) in ascii_lookup
cur_dist = count_ones(UInt16(i) ⊻ k)
for (k, v) in sort_by_keys(ascii_lookup)
cur_dist = count_ones(xor(UInt16(i), k))
if cur_dist < min_dist
min_dist = cur_dist
min_char = v
end
end
min_char
ascii_decode[i + 1] = min_char
end

Expand Down
13 changes: 13 additions & 0 deletions src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ function extend_limits(vec, limits)
(limits == (0.,0.) || limits == [0.,0.]) ? plotting_range_narrow(mi, ma) : (mi, ma)
end

sort_by_keys(dict::Dict) = sort!(collect(dict), by=x->x[1])

function sorted_keys_values(dict::Dict; k2s=true)
if k2s # check and force key type to be of AbstractString type if necessary
kt, vt = eltype(dict).types
if !(kt <: AbstractString)
dict = Dict(string(k) => v for (k, v) in pairs(dict))
end
end
keys_vals = sort_by_keys(dict)
first.(keys_vals), last.(keys_vals)
end

const bordermap = Dict{Symbol,Dict{Symbol,String}}()
const border_solid = Dict{Symbol,String}()
const border_corners = Dict{Symbol,String}()
Expand Down
4 changes: 2 additions & 2 deletions src/interface/barplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function barplot(
end

function barplot(dict::Dict{T,N}; kw...) where {T, N <: Number}
barplot(collect(keys(dict)), collect(values(dict)); kw...)
barplot(sorted_keys_values(dict)...; kw...)
end

function barplot(text::AbstractVector, heights::AbstractVector{<:Number}; kw...)
Expand Down Expand Up @@ -128,7 +128,7 @@ end
function barplot!(
plot::Plot{<:BarplotGraphics},
dict::Dict{T,N}) where {T, N <: Number}
barplot!(plot, collect(keys(dict)), collect(values(dict)))
barplot!(plot, sorted_keys_values(dict)...)
end

function barplot!(
Expand Down
2 changes: 1 addition & 1 deletion src/interface/boxplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,5 @@ function boxplot(text::AbstractString, data::AbstractVector{<:Number}; kw...)
end

function boxplot(dict::Dict; kw...)
boxplot(collect(keys(dict)), collect(values(dict)); kw...)
boxplot(sorted_keys_values(dict)...; kw...)
end
2 changes: 1 addition & 1 deletion src/interface/histogram.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function histogram(
end

function histogram(x; bins = nothing, closed = :left, kw...)
if bins != nothing
if bins !== nothing
Base.depwarn("The keyword parameter `bins` is deprecated, use `nbins` instead", :histogram)
hist = fit(Histogram, x; nbins = bins, closed = closed)
else
Expand Down
2 changes: 1 addition & 1 deletion test/references/barplot/default_mixed.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
 ┌ ┐
bar ┤■■■■■■■■■■■■■■■■■■■■■ 23.0  
2.1 ┤■■■■■■■■■ 10  
bar ┤■■■■■■■■■■■■■■■■■■■■■ 23.0  
foo ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 37.0  
 └ ┘
20 changes: 10 additions & 10 deletions test/references/canvas/ascii_print.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
|.  '         *   .  "   .  *      `.v-"
| \.               .        \   ..-"`  
|   \.   " | `      v    `  ..-"`   '  
|   ""\="=""""\---------vvr=________"' 
|\ "    \{          ..-"`   .   *\  `  
|   /    /\.   \..-T` \       /   .**  
|      .    lv-/`   '      \     .     .
| ` .   ..-"` \.    .        \.        
|  ...-"`      `\.   *.         .\    "
L,-""  .          \..  `*.        . .  
^.            .        '    `  ,  . ..-"
| \.          ,.          *    ...-"`  
|   \(    '.  `.  "   .     ,.-"`  .   .
|   ""\{T"T"""\---------v_r=________ "`
|  .   `\.     .    ..-"`       "   `. 
|    .    \.    ..-"` *    '     *     
|           )_-"'                    , 
| `     ..-"` \. ,        ,.     . '.  .
|   .)-"`  *  ` \.  ,  .`         .  ' 
L.-\`         .   \..                 .
20 changes: 10 additions & 10 deletions test/references/canvas/ascii_print_nocolor.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
|. ' * . " . * `.v-"
| \. . \ ..-"`
| \. " | ` v ` ..-"` '
| ""\="=""""\---------vvr=________"'
|\ " \{ ..-"` . *\ `
| / /\. \..-T` \ / .**
| . lv-/` ' \ . .
| ` . ..-"` \. . \.
| ...-"` `\. *. .\ "
L,-"" . \.. `*. . .
^. . ' ` , . ..-"
| \. ,. * ...-"`
| \( '. `. " . ,.-"` . .
| ""\{T"T"""\---------v_r=________ "`
| . `\. . ..-"` " `.
| . \. ..-"` * ' *
| )_-"' ,
| ` ..-"` \. , ,. . '. .
| .)-"` * ` \. , .` . '
L.-\` . \.. .
2 changes: 1 addition & 1 deletion test/references/canvas/ascii_printrow.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
|   \.   " | `      v    `  ..-"`   '  
|   \(    '.  `.  "   .     ,.-"`  .   .
Loading