From a73df5ec2d6716bdcc24405197fa83e181c92001 Mon Sep 17 00:00:00 2001 From: Dolineanu Mircea Date: Sat, 27 Mar 2021 08:15:19 +0200 Subject: [PATCH 01/11] very rudimentary --- test/runtests.jl | 53 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 077659f..f2a4db2 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,16 +3,45 @@ using Unitful using Test @testset "SDFResultViewer.jl" begin - λ = 800u"nm" - dir = pwd() - file = "0002.sdf" - times = get_times(dir, λ) - @test length(times) == 1 - - m_Lx = mean_Lx(dir, λ) - @test length(m_Lx) == 1 - - Lx, y, z = Lx_slice(joinpath(dir, file), λ, 0) - @test length(Lx) > 0 - @test length(Lx) == length(y) == length(z) + dir = "/mnt/storage/epoch/Wang-Arefiev2020mod/12mtt_0.8w0_l0_MDO" + sim = read_simulation(dir) + + test_plot1 = SDFResultViewer.photon_energy_spectrum(sim; mark_max = true) + + test_plot21 = SDFResultViewer.photon_dens_integrated(sim; direction = :y) + test_plot22 = SDFResultViewer.photon_dens_integrated(sim; direction = :z) + + test_plot31 = SDFResultViewer.photon_en_dens_integrated(sim; direction = :y, endens_scale = 10^3) + test_plot32 = SDFResultViewer.photon_en_dens_integrated(sim; direction = :z, endens_scale = 10^3) + + test_plot4 = SDFResultViewer.energy_spectrum(sim) + + test_plot5 = SDFResultViewer.photon_solid_angle_emission(sim; angle = pi/4) + + @test typeof(test_plot1) == Plots.Plot{Plots.GRBackend} + @test typeof(test_plot21) == Plots.Plot{Plots.GRBackend} + @test typeof(test_plot22) == Plots.Plot{Plots.GRBackend} + @test typeof(test_plot32) == Plots.Plot{Plots.GRBackend} + @test typeof(test_plot31) == Plots.Plot{Plots.GRBackend} + @test typeof(test_plot4) == Plots.Plot{Plots.GRBackend} + + @test typeof(test_plot5) == PyPlot.Figure + + @test SDFResultViewer.powertostring(2, 2^BigInt(1345)) == "2¹³⁴⁵" + @test SDFResultViewer.powertostring(10, 1000) == "10³" + + @test SDFResultViewer.cell_length(sim, :x) == 15u"μm"/450 + + # λ = 800u"nm" + # dir = pwd() + # file = "0002.sdf" + # times = get_times(dir, λ) + # @test length(times) == 1 + + # m_Lx = mean_Lx(dir, λ) + # @test length(m_Lx) == 1 + + # Lx, y, z = Lx_slice(joinpath(dir, file), λ, 0) + # @test length(Lx) > 0 + # @test length(Lx) == length(y) == length(z) end From 7a9f079856cce51d1a1226bc552bfb3b9fed604e Mon Sep 17 00:00:00 2001 From: Mircea Dolineanu Date: Sat, 27 Mar 2021 12:14:26 +0200 Subject: [PATCH 02/11] remove comented section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sebastian Micluța-Câmpeanu <31181429+SebastianM-C@users.noreply.github.com> --- test/runtests.jl | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index f2a4db2..0866751 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -32,16 +32,4 @@ using Test @test SDFResultViewer.cell_length(sim, :x) == 15u"μm"/450 - # λ = 800u"nm" - # dir = pwd() - # file = "0002.sdf" - # times = get_times(dir, λ) - # @test length(times) == 1 - - # m_Lx = mean_Lx(dir, λ) - # @test length(m_Lx) == 1 - - # Lx, y, z = Lx_slice(joinpath(dir, file), λ, 0) - # @test length(Lx) > 0 - # @test length(Lx) == length(y) == length(z) end From 66c43aaa09dc2dd03f332fe9556a2e2bc650efc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Wed, 31 Mar 2021 11:22:14 +0300 Subject: [PATCH 03/11] Update ci Add ctp-fpub registry Update julia version --- .github/workflows/ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1093bb1..37d61a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,8 +10,7 @@ jobs: fail-fast: false matrix: version: - - '1.3' - - '1.5' + - '1.6' - 'nightly' os: - ubuntu-latest @@ -25,6 +24,10 @@ jobs: with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} + - run: | + julia -e ' + using Pkg + Pkg.Registry.add("https://github.com/ctp-fpub/JuliaRegistry")' - uses: actions/cache@v1 env: cache-name: cache-artifacts From 377f2769d8c4aea2b57937afec033792feaec016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Wed, 31 Mar 2021 11:28:16 +0300 Subject: [PATCH 04/11] Use RegistrySpec --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37d61a2..b5b9b14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: - run: | julia -e ' using Pkg - Pkg.Registry.add("https://github.com/ctp-fpub/JuliaRegistry")' + Pkg.Registry.add(RegistrySpec(url="https://github.com/ctp-fpub/JuliaRegistry"))' - uses: actions/cache@v1 env: cache-name: cache-artifacts From a636ff1a962c7e94287d5620c3dbd68380a7ed87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Wed, 31 Mar 2021 11:33:08 +0300 Subject: [PATCH 05/11] fix --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5b9b14..425e956 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: - run: | julia -e ' using Pkg - Pkg.Registry.add(RegistrySpec(url="https://github.com/ctp-fpub/JuliaRegistry"))' + Pkg.Registry.add(RegistrySpec(url=raw"https://github.com/ctp-fpub/JuliaRegistry"))' - uses: actions/cache@v1 env: cache-name: cache-artifacts @@ -55,6 +55,7 @@ jobs: - run: | julia --project=docs -e ' using Pkg + Pkg.Registry.add(RegistrySpec(url=raw"https://github.com/ctp-fpub/JuliaRegistry")) Pkg.develop(PackageSpec(path=pwd())) Pkg.instantiate()' - run: | From 85562cf8da16bacfe929c1fd93791709f245e220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Wed, 31 Mar 2021 11:52:53 +0300 Subject: [PATCH 06/11] Don't run ci twice --- .github/workflows/ci.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 425e956..909feed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,17 @@ name: CI + +# Controls when the action will run. on: - - push - - pull_request + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + pull_request: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: test: name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} @@ -27,7 +37,7 @@ jobs: - run: | julia -e ' using Pkg - Pkg.Registry.add(RegistrySpec(url=raw"https://github.com/ctp-fpub/JuliaRegistry"))' + Pkg.Registry.add(RegistrySpec(url="https://github.com/ctp-fpub/JuliaRegistry"))' - uses: actions/cache@v1 env: cache-name: cache-artifacts @@ -55,7 +65,6 @@ jobs: - run: | julia --project=docs -e ' using Pkg - Pkg.Registry.add(RegistrySpec(url=raw"https://github.com/ctp-fpub/JuliaRegistry")) Pkg.develop(PackageSpec(path=pwd())) Pkg.instantiate()' - run: | From ce118f2df3670f4439dc1606df3a09c8bede57cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Wed, 31 Mar 2021 12:11:15 +0300 Subject: [PATCH 07/11] Fix python --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 909feed..264650e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,8 @@ jobs: test: name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} + env: + PYTHON: "" strategy: fail-fast: false matrix: @@ -57,6 +59,8 @@ jobs: docs: name: Documentation runs-on: ubuntu-latest + env: + PYTHON: "" steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 From 8812eb658a193685469c48f26be5ec249f534d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Wed, 31 Mar 2021 13:03:39 +0300 Subject: [PATCH 08/11] Add registry to docs --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 264650e..bd84532 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,6 +66,10 @@ jobs: - uses: julia-actions/setup-julia@v1 with: version: '1' + - run: | + julia -e ' + using Pkg + Pkg.Registry.add(RegistrySpec(url="https://github.com/ctp-fpub/JuliaRegistry"))' - run: | julia --project=docs -e ' using Pkg From 6ec01034aff6b652ea7ea5b62c545821920b71dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Wed, 31 Mar 2021 13:20:22 +0300 Subject: [PATCH 09/11] Use dir differently depending on CI --- test/runtests.jl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 0866751..7426a72 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,7 +3,11 @@ using Unitful using Test @testset "SDFResultViewer.jl" begin - dir = "/mnt/storage/epoch/Wang-Arefiev2020mod/12mtt_0.8w0_l0_MDO" + if isempty(ENV["CI"]) + dir = "/mnt/storage/epoch/Wang-Arefiev2020mod/12mtt_0.8w0_l0_MDO" + else + dir = pwd() + end sim = read_simulation(dir) test_plot1 = SDFResultViewer.photon_energy_spectrum(sim; mark_max = true) @@ -29,7 +33,7 @@ using Test @test SDFResultViewer.powertostring(2, 2^BigInt(1345)) == "2¹³⁴⁵" @test SDFResultViewer.powertostring(10, 1000) == "10³" - + @test SDFResultViewer.cell_length(sim, :x) == 15u"μm"/450 - + end From 143bb865e312f745f73b8f20e09ddbc48d52d1b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Wed, 31 Mar 2021 22:35:05 +0300 Subject: [PATCH 10/11] Use julia as shell --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd84532..9677a5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,9 +37,9 @@ jobs: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - run: | - julia -e ' using Pkg - Pkg.Registry.add(RegistrySpec(url="https://github.com/ctp-fpub/JuliaRegistry"))' + Pkg.Registry.add(RegistrySpec(url="https://github.com/ctp-fpub/JuliaRegistry")) + shell: julia --color=yes --project=. {0} - uses: actions/cache@v1 env: cache-name: cache-artifacts From a6bfc3889595b17728e63ff1db6340b9b4fcf9b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= <31181429+SebastianM-C@users.noreply.github.com> Date: Mon, 12 Apr 2021 14:36:34 +0300 Subject: [PATCH 11/11] Update test/runtests.jl --- test/runtests.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/runtests.jl b/test/runtests.jl index 7426a72..5f8ffbc 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,6 @@ using SDFResultViewer using Unitful +using SDFResults using Test @testset "SDFResultViewer.jl" begin