Skip to content

Commit

Permalink
Added testing workflow + coverage reports (#14)
Browse files Browse the repository at this point in the history
* added testing workflow + coverage reports

* comment out lines related to GeometricalPredicates

* removed GeometricalPredicates

* updated tests for new tolerances / exports

* removed GeometricalPredicates

* up the atol in isapprox
  • Loading branch information
fjebaker authored Apr 22, 2022
1 parent 591a998 commit 6a988a1
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 10 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Smoke test

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:

smoke-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: ['1.7']
julia-arch: [x86]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
arch: ${{ matrix.julia-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
- uses: julia-actions/julia-processcoverage@v1
with:
directories: src
- uses: codecov/codecov-action@v2
with:
files: lcov.info
1 change: 0 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
GeometricalPredicates = "fd0ad045-b25c-564e-8f9c-8ef5c5f21267"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Expand Down
2 changes: 0 additions & 2 deletions src/DiscProfiles/DiscProfiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import ..GradusBase: AbstractMetricParams, vector_to_local_sky
import ..GeodesicTracer: tracegeodesics
import ..AccretionGeometry: AbstractAccretionGeometry

import GeometricalPredicates: Point2D, getx, gety, geta, getb, getc

include("sky-geometry.jl")
include("corona-models.jl")

Expand Down
4 changes: 2 additions & 2 deletions src/DiscProfiles/disc-profiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ struct WeightedPoint{T} <: Point2D
_y::Float64
_weight::T
end
GeometricalPredicates.getx(p::WeightedPoint{T}) where {T} = p._x
GeometricalPredicates.gety(p::WeightedPoint{T}) where {T} = p._y
#GeometricalPredicates.getx(p::WeightedPoint{T}) where {T} = p._x
#GeometricalPredicates.gety(p::WeightedPoint{T}) where {T} = p._y
getw(p::WeightedPoint{T}) where {T} = p._weight

struct DelaunayDiscProfile{T} <: AbstractDelaunayProfile
Expand Down
2 changes: 1 addition & 1 deletion test/smoke-tests/pointfunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ using Test, Gradus, StaticArrays
@testset "redshift" begin
# only implemented for the BoyerLindquist metrics at the moment
for m in [BoyerLindquistAD(), BoyerLindquistFO()]
run_pointfunction(m, redshift)
run_pointfunction(m, Gradus.redshift)
end
# smoke test passed
@test true
Expand Down
8 changes: 4 additions & 4 deletions test/smoke-tests/rendergeodesics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using Test, Gradus, StaticArrays
image_fingerprint = sum(filter(!isnan, img))
# have to be really coarse cus the first order method is so variable???
# the rest are very resolute
@test isapprox(expectation, image_fingerprint; atol = 2.0, rtol = 0.0)
@test isapprox(expectation, image_fingerprint; atol = 3.0, rtol = 0.0)
end
end

Expand All @@ -33,8 +33,8 @@ using Test, Gradus, StaticArrays
for (m, expectation) in zip(
[BoyerLindquistAD(), JohannsenAD(), BoyerLindquistFO(), MorrisThorneAD()],
# expectation values for the sum of the image
# last computed 20/04/2022: v0.1.0
[86795.10968236077, 86796.73210488849, 81959.05505753662, 36803.48713530963],
# last computed 22/04/2022: after default tolerance change
[87034.280913570287, 87046.00747461354, 81491.03246385315, 36218.59567455362],
)
img = rendergeodesics(
m,
Expand All @@ -47,7 +47,7 @@ using Test, Gradus, StaticArrays
verbose = false,
)
image_fingerprint = sum(filter(!isnan, img))
@test isapprox(expectation, image_fingerprint; atol = 2.0, rtol = 0.0)
@test isapprox(expectation, image_fingerprint; atol = 3.0, rtol = 0.0)
end
end

Expand Down

0 comments on commit 6a988a1

Please sign in to comment.