Skip to content

Commit

Permalink
Merge pull request #3 from JuliaString/spj/updateci
Browse files Browse the repository at this point in the history
Change to use GitHub Actions
  • Loading branch information
ScottPJones authored May 14, 2021
2 parents 02540e9 + b1e1834 commit 0d614be
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 85 deletions.
41 changes: 0 additions & 41 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,3 @@
---
kind: pipeline
name: linux - arm - Julia 1.0

platform:
os: linux
arch: arm

steps:
- name: build
image: julia:1.0
commands:
- "julia --project=. --check-bounds=yes --color=yes -e 'using InteractiveUtils; versioninfo(verbose=true); using Pkg; Pkg.build(); Pkg.test(coverage=true)'"

---
kind: pipeline
name: linux - arm - Julia 1.5
platform:
os: linux
arch: arm

steps:
- name: build
image: julia:1.5
commands:
- "julia --project=. --check-bounds=yes --color=yes -e 'using InteractiveUtils; versioninfo(verbose=true); using Pkg; Pkg.build(); Pkg.test(coverage=true)'"

---
kind: pipeline
name: linux - arm64 - Julia 1.0

platform:
os: linux
arch: arm64

steps:
- name: build
image: julia:1.0
commands:
- "julia --project=. --check-bounds=yes --color=yes -e 'using InteractiveUtils; versioninfo(verbose=true); using Pkg; Pkg.build(); Pkg.test(coverage=true)'"

---
kind: pipeline
name: linux - arm64 - Julia 1.5
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI
on:
- push
- pull_request
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.5'
- '1.6'
- 'nightly'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
- x86
exclude:
- os: macOS-latest
arch: x86
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
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors = ["ScottPJones <[email protected]>"]
keywords = ["Strings", "Literals", "printf", "Format"]
license = "MIT"
uuid = "b5087856-efa9-5a6d-8e6f-97303a7af894"
version = "1.0.0"
version = "1.0.1"

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

[compat]
julia = "^1.0.0"
ModuleInterfaceTools = "≥ 1.0.0"
Format = "≥ 1.0.0"
StrLiterals = "≥ 1.0.0"
julia = "1"
ModuleInterfaceTools = "1"
Format = "^1.3.1"
StrLiterals = "1"
18 changes: 10 additions & 8 deletions src/StrFormat.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
__precompile__(true)
""""
Add C, Python and type-based formatting to Str string literals
Copyright 2016-2018 Gandalf Software, Inc., Scott P. Jones
Copyright 2016-2020 Gandalf Software, Inc., Scott P. Jones
Licensed under MIT License, see LICENSE.md
"""
module StrFormat
Expand All @@ -11,6 +10,9 @@ using ModuleInterfaceTools

@api extend! Format, StrLiterals

# Export from here as well so that people can do just `using StrFormat`
export @f_str, @pr_str, @F_str, @PR_str, @sym_str

function _parse_format(str, pos, fun)
ex, j = parse(Expr, str, pos; greedy=false)
check_expr(ex)
Expand All @@ -24,7 +26,7 @@ end
function _parse_fmt(sx::Vector{Any}, s::AbstractString, unescape::Function,
i::Integer, j::Integer, k::Integer)
# Move past \\, k should point to '%'
c, k = str_next(s, k)
c, k = iterate(s, k)
check_done(s, k, "Incomplete % expression")
# Handle interpolation
isempty(s[i:j-1]) || push!(sx, unescape(s[i:j-1]))
Expand All @@ -35,7 +37,7 @@ function _parse_fmt(sx::Vector{Any}, s::AbstractString, unescape::Function,
# Move past %, c should point to letter
beg = k
while true
c, k = str_next(s, k)
c, k = iterate(s, k)
check_done(s, k, "Incomplete % expression")
s[k] == '(' && break
end
Expand All @@ -49,18 +51,18 @@ end
function _parse_pyfmt(sx::Vector{Any}, s::AbstractString, unescape::Function,
i::Integer, j::Integer, k::Integer)
# Move past \\, k should point to '{'
c, k = str_next(s, k)
c, k = iterate(s, k)
check_done(s, k, "Incomplete {...} Python format expression")
# Handle interpolation
isempty(s[i:j-1]) || push!(sx, unescape(s[i:j-1]))
beg = k # start location
c, k = str_next(s, k)
c, k = iterate(s, k)
while c != '}'
check_done(s, k, string("\\{ missing closing } in ", c))
c, k = str_next(s, k)
c, k = iterate(s, k)
end
check_done(s, k, "Missing (expr) in Python format expression")
c, k = str_next(s, k)
c, k = iterate(s, k)
c == '(' || parse_error(string("Missing (expr) in Python format expression: ", c))
# Need to find end to parse to
ex, j = _parse_format(s, k-1, Format.pyfmt)
Expand Down
24 changes: 18 additions & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ using ModuleInterfaceTools, Format
@testset "C Formatting" begin
@testset "int" begin
@test f"\%d(typemax(Int64))" == "9223372036854775807"
@test f"\%a(typemax(Int64))" == "0x7.fffffffffffffffp+60"
@test f"\%A(typemax(Int64))" == "0X7.FFFFFFFFFFFFFFFP+60"
@static if VERSION < v"1.5"
@test f"\%a(typemax(Int64))" == "0x7.fffffffffffffffp+60"
@test f"\%A(typemax(Int64))" == "0X7.FFFFFFFFFFFFFFFP+60"
else
@test f"\%a(typemax(Int64))" == "0x1p+63"
@test f"\%A(typemax(Int64))" == "0X1P+63"
end
end
@testset "printing an int value" begin
for num in (UInt16(42), UInt32(42), UInt64(42), UInt128(42),
Expand All @@ -24,10 +29,17 @@ using ModuleInterfaceTools, Format
@test f"\%+i(num)" == "+42"
@test f"\%4i(num)" == " 42"
@test f"\%-4i(num)" == "42 "
@test f"\%a(num)" == "0x2.ap+4"
@test f"\%A(num)" == "0X2.AP+4"
@test f"\%20a(num)" == " 0x2.ap+4"
@test f"\%-20a(num)" == "0x2.ap+4 "
@static if VERSION < v"1.5"
@test f"\%a(num)" == "0x2.ap+4"
@test f"\%A(num)" == "0X2.AP+4"
@test f"\%20a(num)" == " 0x2.ap+4"
@test f"\%-20a(num)" == "0x2.ap+4 "
else
@test f"\%a(num)" == "0x1.5p+5"
@test f"\%A(num)" == "0X1.5P+5"
@test f"\%20a(num)" == " 0x1.5p+5"
@test f"\%-20a(num)" == "0x1.5p+5 "
end
@test f"\%f(num)" == "42.000000"
@test f"\%g(num)" == "42"
end
Expand Down

2 comments on commit 0d614be

@ScottPJones
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/36716

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.1 -m "<description of version>" 0d614bebdc5af97bd2d7441d5a3094ace7f20260
git push origin v1.0.1

Please sign in to comment.