From 0b05a63519e7c24aa2c90fa0c9b284aee261b72d Mon Sep 17 00:00:00 2001 From: Oliver Schulz Date: Fri, 16 Nov 2018 14:04:50 +0100 Subject: [PATCH] Port to Julia v1.0 --- .appveyor.yml | 38 +++++++++++++++++++++++++++++++++++++ .codecov.yml | 2 +- .gitignore | 1 + .travis.yml | 28 ++++++++++----------------- REQUIRE | 3 +-- appveyor.yml | 42 ----------------------------------------- src/H3DPolaris.jl | 2 ++ src/polaris_data.jl | 4 ++-- src/polaris_detector.jl | 4 ++-- test/runtests.jl | 3 ++- 10 files changed, 59 insertions(+), 68 deletions(-) create mode 100644 .appveyor.yml delete mode 100644 appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..5709e80 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,38 @@ +# Documentation: https://github.com/JuliaCI/Appveyor.jl + +environment: + matrix: + - julia_version: 1.0 + - julia_version: nightly + +platform: + - x86 # 32-bit + - x64 # 64-bit + +## uncomment the following lines to allow failures on nightly julia +## (tests will run but not make your overall status red) +#matrix: +# allow_failures: +# - julia_version: nightly + +#branches: +# only: +# - master +# - /release-.*/ + +notifications: + - provider: Email + on_build_success: false + on_build_failure: false + on_build_status_changed: false + +install: + - ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1")) + +build_script: + - echo "%JL_BUILD_SCRIPT%" + - C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%" + +test_script: + - echo "%JL_TEST_SCRIPT%" + - C:\julia\bin\julia -e "%JL_TEST_SCRIPT%" diff --git a/.codecov.yml b/.codecov.yml index 69cb760..ac54655 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1 +1 @@ -comment: false +# comment: false diff --git a/.gitignore b/.gitignore index 8c960ec..19a1bd1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store *.jl.cov *.jl.*.cov *.jl.mem diff --git a/.travis.yml b/.travis.yml index 0de13d1..e8f189d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,35 +1,27 @@ ## Documentation: http://docs.travis-ci.com/user/languages/julia/ + language: julia + os: - linux - osx + julia: - - 0.6 + - 1.0 - nightly -notifications: - email: false -git: - depth: 99999999 ## uncomment the following lines to allow failures on nightly julia ## (tests will run but not make your overall status red) #matrix: # allow_failures: # - julia: nightly +# fast_finish: true -## uncomment and modify the following lines to manually install system packages -#addons: -# apt: # apt-get for linux -# packages: -# - gfortran -#before_script: # homebrew for mac -# - if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi +notifications: + email: false -## uncomment the following lines to override the default test script -#script: -# - julia -e 'Pkg.clone(pwd()); Pkg.build("H3DPolaris"); Pkg.test("H3DPolaris"; coverage=true)' after_success: - # push coverage results to Coveralls - - julia -e 'cd(Pkg.dir("H3DPolaris")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())' # push coverage results to Codecov - - julia -e 'cd(Pkg.dir("H3DPolaris")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' + - julia -e 'import Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' + # push coverage results to Coveralls + - julia -e 'import Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())' diff --git a/REQUIRE b/REQUIRE index 9ae10c3..7f39dc2 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,5 +1,4 @@ -julia 0.6 -Compat 0.33 +julia 0.7 ArraysOfArrays BufferedStreams CompressedStreams diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 495c419..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,42 +0,0 @@ -environment: - matrix: - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" - -## uncomment the following lines to allow failures on nightly julia -## (tests will run but not make your overall status red) -#matrix: -# allow_failures: -# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" -# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" - -notifications: - - provider: Email - on_build_success: false - on_build_failure: false - on_build_status_changed: false - -install: - - ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12" -# If there's a newer build queued for the same PR, cancel this one - - ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` - https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` - Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` - throw "There are newer queued builds for this pull request, failing early." } -# Download most recent Julia Windows binary - - ps: (new-object net.webclient).DownloadFile( - $env:JULIA_URL, - "C:\projects\julia-binary.exe") -# Run installer silently, output to C:\projects\julia - - C:\projects\julia-binary.exe /S /D=C:\projects\julia - -build_script: -# Need to convert from shallow to complete for Pkg.clone to work - - IF EXIST .git\shallow (git fetch --unshallow) - - C:\projects\julia\bin\julia -e "versioninfo(); - Pkg.clone(pwd(), \"H3DPolaris\"); Pkg.build(\"H3DPolaris\")" - -test_script: - - C:\projects\julia\bin\julia -e "Pkg.test(\"H3DPolaris\")" diff --git a/src/H3DPolaris.jl b/src/H3DPolaris.jl index 02ab6da..d4272a5 100644 --- a/src/H3DPolaris.jl +++ b/src/H3DPolaris.jl @@ -4,6 +4,8 @@ __precompile__(true) module H3DPolaris +using Sockets + using ArraysOfArrays using BufferedStreams using CompressedStreams diff --git a/src/polaris_data.jl b/src/polaris_data.jl index f5020d8..bc07d60 100644 --- a/src/polaris_data.jl +++ b/src/polaris_data.jl @@ -108,14 +108,14 @@ function Base.read!( if nhits_tmp == 122 issync = true synchdr = read(input, PolarisSyncHeader) - (synchdr.n < 2) && error("Invalid sync event in data stream, missing timestamp") + (synchdr.n < 2) && @error "Invalid sync event in data stream, missing timestamp" for i in 1:synchdr.n syncvalue = read(input, PolarisSyncValue) if i == 2 t = time_in_s(syncvalue.x) end end - assert(t >= 0) + @assert t >= 0 else nhits = Int(nhits_tmp) evthdr = read(input, PolarisEventHeader) diff --git a/src/polaris_detector.jl b/src/polaris_detector.jl index d67b862..7620bbe 100644 --- a/src/polaris_detector.jl +++ b/src/polaris_detector.jl @@ -37,10 +37,10 @@ end function exec_dev_cmd(device::PolarisDetectorInstance, cmd::AbstractString, expected_response::AbstractString) - info("Sending command \"$cmd\".") + @info "Sending command \"$cmd\"." println(device.control_io, cmd) resp = readline(device.control_io) - info("Received response \"$resp\".") + @info "Received response \"$resp\"." resp != expected_response && throw(ErrorException("Device command \"cmd\" resulted in invalid/unexpected response")) nothing end diff --git a/test/runtests.jl b/test/runtests.jl index 5b9b5d4..b07c1c6 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,6 @@ # This file is a part of H3DPolaris.jl, licensed under the MIT License (MIT). -import Compat.Test +import Test + Test.@testset "Package H3DPolaris" begin end