diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1093bb1..9677a5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,17 +1,28 @@ 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 }} runs-on: ${{ matrix.os }} + env: + PYTHON: "" strategy: fail-fast: false matrix: version: - - '1.3' - - '1.5' + - '1.6' - 'nightly' os: - ubuntu-latest @@ -25,6 +36,10 @@ jobs: with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} + - run: | + using Pkg + 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 @@ -44,11 +59,17 @@ jobs: docs: name: Documentation runs-on: ubuntu-latest + env: + PYTHON: "" steps: - uses: actions/checkout@v2 - 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 diff --git a/test/runtests.jl b/test/runtests.jl index 077659f..5f8ffbc 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,18 +1,40 @@ using SDFResultViewer using Unitful +using SDFResults 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) + 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) + + 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 + end