From 98ec8aa6da03e35cf6eac72c9e512765312db7aa Mon Sep 17 00:00:00 2001 From: Sebastian Pfitzner Date: Tue, 1 Dec 2020 17:52:35 +0100 Subject: [PATCH] compat with Julia 1.x (#445) * compat with Julia 1.x * work around compiler error on 1.2 * rm travis/appveyor --- .github/workflows/CI.yml | 43 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 40 ------------------------------------- Project.toml | 2 +- appveyor.yml | 37 ---------------------------------- src/utils.jl | 20 ++++++++++++++++++- test/toplevel.jl | 2 +- 6 files changed, 64 insertions(+), 80 deletions(-) create mode 100644 .github/workflows/CI.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000000000..f0bfd897bf185 --- /dev/null +++ b/.github/workflows/CI.yml @@ -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.0' + - '1.1' + - '1.2' + - '1.3' + - '1.4' + - '1.5' + - 'nightly' + os: + - ubuntu-latest + - macOS-latest + - windows-latest + 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 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f31e14fd0d205..0000000000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -language: julia - -os: - - linux - - windows - - osx - -julia: - - 1.0 - - 1 - - nightly - -arch: - - x86 - - x64 - -branches: - only: - - master - - /^v\d+\.\d+(\.\d+)?(-\S*)?$/ - -notifications: - email: false - -codecov: true - -jobs: - include: - - stage: "Documentation" - julia: 1 - os: linux - arch: x64 - script: - - julia --project=docs/ -e 'using Pkg; Pkg.instantiate(); Pkg.build()' - - julia --project=docs/ docs/make.jl - name: "HTML" - after_success: skip - exclude: - - os: osx - arch: x86 diff --git a/Project.toml b/Project.toml index 9d1ea50c3d0c0..5f36bdadd425b 100644 --- a/Project.toml +++ b/Project.toml @@ -10,7 +10,7 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [compat] CodeTracking = "0.5.9, 1" -julia = "~1.0, 1.5" +julia = "1" [extras] DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index a97fb3853352e..0000000000000 --- a/appveyor.yml +++ /dev/null @@ -1,37 +0,0 @@ -environment: - matrix: - - julia_version: 1.0 - - julia_version: 1 - - julia_version: nightly - -platform: - - x86 # 32-bit - - x64 # 64-bit - -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%" - -# # Uncomment to support code coverage upload. Should only be enabled for packages -# # which would have coverage gaps without running on Windows -# on_success: -# - echo "%JL_CODECOV_SCRIPT%" -# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%" diff --git a/src/utils.jl b/src/utils.jl index 9485c2fcb3f01..826c12dda524b 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -296,7 +296,25 @@ function lineoffset(framecode::FrameCode) end getline(ln) = Int(isexpr(ln, :line) ? ln.args[1] : ln.line)::Int -getfile(ln) = CodeTracking.maybe_fixup_stdlib_path(String(isexpr(ln, :line) ? ln.args[2] : ln.file)::String) +# work around compiler error on 1.2 +@static if v"1.2.0" <= VERSION < v"1.3" + getfile(ln) = begin + path = if isexpr(ln, :line) + String(ln.args[2]) + else + try + file = String(ln.file) + isfile(file) + file + catch err + "" + end + end + CodeTracking.maybe_fixup_stdlib_path(path) + end +else + getfile(ln) = CodeTracking.maybe_fixup_stdlib_path(String(isexpr(ln, :line) ? ln.args[2] : ln.file)::String) +end function firstline(ex::Expr) for a in ex.args diff --git a/test/toplevel.jl b/test/toplevel.jl index 4265aaf285f8d..8fdd6c6d947d7 100644 --- a/test/toplevel.jl +++ b/test/toplevel.jl @@ -244,7 +244,7 @@ module Namespace end JuliaInterpreter.through_methoddef_or_done!(frame) === nothing && break end @test Namespace.sin(0) == 10 - if Base.VERSION >= v"1.5" + if Base.VERSION >= v"1.1" @test Base.sin(0) == 0 else @test_broken Base.sin(0) == 0