Skip to content

Commit 0d614be

Browse files
authored
Merge pull request #3 from JuliaString/spj/updateci
Change to use GitHub Actions
2 parents 02540e9 + b1e1834 commit 0d614be

File tree

6 files changed

+76
-85
lines changed

6 files changed

+76
-85
lines changed

.drone.yml

-41
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,3 @@
1-
---
2-
kind: pipeline
3-
name: linux - arm - Julia 1.0
4-
5-
platform:
6-
os: linux
7-
arch: arm
8-
9-
steps:
10-
- name: build
11-
image: julia:1.0
12-
commands:
13-
- "julia --project=. --check-bounds=yes --color=yes -e 'using InteractiveUtils; versioninfo(verbose=true); using Pkg; Pkg.build(); Pkg.test(coverage=true)'"
14-
15-
---
16-
kind: pipeline
17-
name: linux - arm - Julia 1.5
18-
platform:
19-
os: linux
20-
arch: arm
21-
22-
steps:
23-
- name: build
24-
image: julia:1.5
25-
commands:
26-
- "julia --project=. --check-bounds=yes --color=yes -e 'using InteractiveUtils; versioninfo(verbose=true); using Pkg; Pkg.build(); Pkg.test(coverage=true)'"
27-
28-
---
29-
kind: pipeline
30-
name: linux - arm64 - Julia 1.0
31-
32-
platform:
33-
os: linux
34-
arch: arm64
35-
36-
steps:
37-
- name: build
38-
image: julia:1.0
39-
commands:
40-
- "julia --project=. --check-bounds=yes --color=yes -e 'using InteractiveUtils; versioninfo(verbose=true); using Pkg; Pkg.build(); Pkg.test(coverage=true)'"
41-
421
---
432
kind: pipeline
443
name: linux - arm64 - Julia 1.5

.github/workflows/ci.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI
2+
on:
3+
- push
4+
- pull_request
5+
jobs:
6+
test:
7+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
version:
13+
- '1.5'
14+
- '1.6'
15+
- 'nightly'
16+
os:
17+
- ubuntu-latest
18+
- macOS-latest
19+
- windows-latest
20+
arch:
21+
- x64
22+
- x86
23+
exclude:
24+
- os: macOS-latest
25+
arch: x86
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: julia-actions/setup-julia@v1
29+
with:
30+
version: ${{ matrix.version }}
31+
arch: ${{ matrix.arch }}
32+
- uses: actions/cache@v1
33+
env:
34+
cache-name: cache-artifacts
35+
with:
36+
path: ~/.julia/artifacts
37+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
38+
restore-keys: |
39+
${{ runner.os }}-test-${{ env.cache-name }}-
40+
${{ runner.os }}-test-
41+
${{ runner.os }}-
42+
- uses: julia-actions/julia-buildpkg@v1
43+
- uses: julia-actions/julia-runtest@v1

.travis.yml

-25
This file was deleted.

Project.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ authors = ["ScottPJones <scottjones@alum.mit.edu>"]
44
keywords = ["Strings", "Literals", "printf", "Format"]
55
license = "MIT"
66
uuid = "b5087856-efa9-5a6d-8e6f-97303a7af894"
7-
version = "1.0.0"
7+
version = "1.0.1"
88

99
[deps]
1010
ModuleInterfaceTools = "5cb8414e-7aab-5a03-a681-351269c074bf"
@@ -18,7 +18,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1818
test = ["Test"]
1919

2020
[compat]
21-
julia = "^1.0.0"
22-
ModuleInterfaceTools = "≥ 1.0.0"
23-
Format = "≥ 1.0.0"
24-
StrLiterals = "≥ 1.0.0"
21+
julia = "1"
22+
ModuleInterfaceTools = "1"
23+
Format = "^1.3.1"
24+
StrLiterals = "1"

src/StrFormat.jl

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
__precompile__(true)
21
""""
32
Add C, Python and type-based formatting to Str string literals
43
5-
Copyright 2016-2018 Gandalf Software, Inc., Scott P. Jones
4+
Copyright 2016-2020 Gandalf Software, Inc., Scott P. Jones
65
Licensed under MIT License, see LICENSE.md
76
"""
87
module StrFormat
@@ -11,6 +10,9 @@ using ModuleInterfaceTools
1110

1211
@api extend! Format, StrLiterals
1312

13+
# Export from here as well so that people can do just `using StrFormat`
14+
export @f_str, @pr_str, @F_str, @PR_str, @sym_str
15+
1416
function _parse_format(str, pos, fun)
1517
ex, j = parse(Expr, str, pos; greedy=false)
1618
check_expr(ex)
@@ -24,7 +26,7 @@ end
2426
function _parse_fmt(sx::Vector{Any}, s::AbstractString, unescape::Function,
2527
i::Integer, j::Integer, k::Integer)
2628
# Move past \\, k should point to '%'
27-
c, k = str_next(s, k)
29+
c, k = iterate(s, k)
2830
check_done(s, k, "Incomplete % expression")
2931
# Handle interpolation
3032
isempty(s[i:j-1]) || push!(sx, unescape(s[i:j-1]))
@@ -35,7 +37,7 @@ function _parse_fmt(sx::Vector{Any}, s::AbstractString, unescape::Function,
3537
# Move past %, c should point to letter
3638
beg = k
3739
while true
38-
c, k = str_next(s, k)
40+
c, k = iterate(s, k)
3941
check_done(s, k, "Incomplete % expression")
4042
s[k] == '(' && break
4143
end
@@ -49,18 +51,18 @@ end
4951
function _parse_pyfmt(sx::Vector{Any}, s::AbstractString, unescape::Function,
5052
i::Integer, j::Integer, k::Integer)
5153
# Move past \\, k should point to '{'
52-
c, k = str_next(s, k)
54+
c, k = iterate(s, k)
5355
check_done(s, k, "Incomplete {...} Python format expression")
5456
# Handle interpolation
5557
isempty(s[i:j-1]) || push!(sx, unescape(s[i:j-1]))
5658
beg = k # start location
57-
c, k = str_next(s, k)
59+
c, k = iterate(s, k)
5860
while c != '}'
5961
check_done(s, k, string("\\{ missing closing } in ", c))
60-
c, k = str_next(s, k)
62+
c, k = iterate(s, k)
6163
end
6264
check_done(s, k, "Missing (expr) in Python format expression")
63-
c, k = str_next(s, k)
65+
c, k = iterate(s, k)
6466
c == '(' || parse_error(string("Missing (expr) in Python format expression: ", c))
6567
# Need to find end to parse to
6668
ex, j = _parse_format(s, k-1, Format.pyfmt)

test/runtests.jl

+18-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ using ModuleInterfaceTools, Format
77
@testset "C Formatting" begin
88
@testset "int" begin
99
@test f"\%d(typemax(Int64))" == "9223372036854775807"
10-
@test f"\%a(typemax(Int64))" == "0x7.fffffffffffffffp+60"
11-
@test f"\%A(typemax(Int64))" == "0X7.FFFFFFFFFFFFFFFP+60"
10+
@static if VERSION < v"1.5"
11+
@test f"\%a(typemax(Int64))" == "0x7.fffffffffffffffp+60"
12+
@test f"\%A(typemax(Int64))" == "0X7.FFFFFFFFFFFFFFFP+60"
13+
else
14+
@test f"\%a(typemax(Int64))" == "0x1p+63"
15+
@test f"\%A(typemax(Int64))" == "0X1P+63"
16+
end
1217
end
1318
@testset "printing an int value" begin
1419
for num in (UInt16(42), UInt32(42), UInt64(42), UInt128(42),
@@ -24,10 +29,17 @@ using ModuleInterfaceTools, Format
2429
@test f"\%+i(num)" == "+42"
2530
@test f"\%4i(num)" == " 42"
2631
@test f"\%-4i(num)" == "42 "
27-
@test f"\%a(num)" == "0x2.ap+4"
28-
@test f"\%A(num)" == "0X2.AP+4"
29-
@test f"\%20a(num)" == " 0x2.ap+4"
30-
@test f"\%-20a(num)" == "0x2.ap+4 "
32+
@static if VERSION < v"1.5"
33+
@test f"\%a(num)" == "0x2.ap+4"
34+
@test f"\%A(num)" == "0X2.AP+4"
35+
@test f"\%20a(num)" == " 0x2.ap+4"
36+
@test f"\%-20a(num)" == "0x2.ap+4 "
37+
else
38+
@test f"\%a(num)" == "0x1.5p+5"
39+
@test f"\%A(num)" == "0X1.5P+5"
40+
@test f"\%20a(num)" == " 0x1.5p+5"
41+
@test f"\%-20a(num)" == "0x1.5p+5 "
42+
end
3143
@test f"\%f(num)" == "42.000000"
3244
@test f"\%g(num)" == "42"
3345
end

0 commit comments

Comments
 (0)