Skip to content

Commit

Permalink
Update Julia to 1.9 and LocalCoverage to 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
goerz committed Oct 6, 2023
1 parent acb23df commit fe42a8f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 27 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ env:
JULIA_PKG_PRECOMPILE_AUTO: false
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
name: Test ${{ matrix.title }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.6'
os:
- ubuntu-latest
arch:
- x64
include:
- title: 'Linux - latest'
os: ubuntu-latest
version: '1'
arch: x64
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
Expand All @@ -46,7 +45,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: '1'
Expand All @@ -71,7 +70,7 @@ jobs:
name: Codestyle
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: '1'
Expand Down
6 changes: 4 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Coverage = "a2441757-f6aa-5fb2-8edb-039e3f45d037"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LocalCoverage = "5f6e1e16-694c-5876-87ef-16b5274f298e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
QuantumControl = "8a270532-f23f-47a8-83a9-b33d10cad486"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand All @@ -17,6 +18,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
[compat]
BenchmarkTools = "1.3"
Coverage = "^1.4"
LocalCoverage = "0.4"
LocalCoverage = "0.6"
PrettyTables = "0.12, 1.0, 2"
QuantumControl = ">=0.8"
julia = "1.6"
julia = "1.9"
2 changes: 1 addition & 1 deletion src/dummy_problem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Sets up a control problem with random (sparse) Hermitian matrices.
* `rng=Random.GLOBAL_RNG`: The random number generator to use. See
[`random_matrix`](@ref) and [`random_state_vector`](@ref).
* `kwargs`: All other keyword arguments are passed on to
[`ControlProblem`](@ref)
`QuantumControl.ControlProblem`
"""
function dummy_control_problem(;
N=10,
Expand Down
11 changes: 7 additions & 4 deletions src/runner.jl
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
using Printf
using Logging
using Coverage
using LocalCoverage.PrettyTables
using LocalCoverage:
LocalCoverage,
eval_coverage_metrics,
PackageCoverage,
FileCoverageSummary,
CoverageTools
using PrettyTables: Highlighter, pretty_table

function _coverage(metric::Union{PackageCoverage,FileCoverageSummary})
return 100.0 * (float(metric.lines_hit) / metric.lines_tracked)
end

function format_line(metric::Union{PackageCoverage,FileCoverageSummary})
name = (metric isa PackageCoverage ? "TOTAL" : relpath(metric.filename))
lines_hit = @sprintf("%3d", metric.lines_hit)
lines_tracked = @sprintf("%3d", metric.lines_tracked)
lines_missing = @sprintf("%3d", metric.lines_tracked - metric.lines_hit)
coverage = (isnan(metric.coverage) ? "-" : @sprintf("%3.0f%%", metric.coverage))
coverage = isnan(_coverage(metric)) ? "-" : @sprintf("%3.0f%%", _coverage(metric))
return hcat(name, lines_tracked, lines_hit, lines_missing, coverage)
end

Expand Down Expand Up @@ -53,7 +56,7 @@ function show_coverage(metrics::PackageCoverage; sort_by=nothing)
:Total => (m -> m.lines_tracked),
:Hit => (m -> m.lines_hit),
:Missed => (m -> (m.lines_tracked - m.lines_hit)),
:Coverage => (m -> m.coverage),
:Coverage => (m -> _coverage(m)),
)
if !isnothing(sort_by)
if sort_by keys(sorter)
Expand All @@ -65,7 +68,7 @@ function show_coverage(metrics::PackageCoverage; sort_by=nothing)

table = reduce(vcat, map(format_line, [file_metrics..., metrics]))

row_coverage = [getfield.(file_metrics, :coverage)... metrics.coverage]
row_coverage = [[_coverage(m) for m in file_metrics]... _coverage(metrics)]

highlighters = (
Highlighter(
Expand Down
12 changes: 2 additions & 10 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,16 @@
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Coverage = "a2441757-f6aa-5fb2-8edb-039e3f45d037"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterTools = "35a29f4d-8980-5a13-9543-d66fff28ecb8"
GRAPE = "6b52fcaf-80fe-489a-93e9-9f92080510be"
GRAPELinesearchAnalysis = "290eba36-e2d8-4488-81b6-f66cc44f2186"
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
Krotov = "b05dcdc7-62f6-4360-bf2c-0898bba419de"
LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589"
LocalCoverage = "5f6e1e16-694c-5876-87ef-16b5274f298e"
QuantumCitations = "259add83-af3e-4603-9706-50e341d5574e"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
QuantumControl = "8a270532-f23f-47a8-83a9-b33d10cad486"
QuantumControlBase = "f10a33bc-5a64-497c-be7b-6f86b4f0c2aa"
QuantumControlTestUtils = "d3fd27c9-1dfb-4e67-b0c0-90d0d87a1e48"
QuantumGradientGenerators = "a563f35e-61db-434d-8c01-8b9e3ccdfd85"
QuantumPropagators = "7bf12567-5742-4b91-a078-644e72a65fc1"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TwoQubitWeylChamber = "cad078a0-0012-46f4-b55e-a945d44e115b"
UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"

[compat]
Documenter = "1.1"
julia = "1.6"

0 comments on commit fe42a8f

Please sign in to comment.