Skip to content

Commit

Permalink
cross checks (#228)
Browse files Browse the repository at this point in the history
* added dependabot

* updated cross chekc action

* removed bad tokens

* workflow fix
  • Loading branch information
ThummeTo authored Aug 20, 2024
1 parent 3cd20ee commit b4e2cce
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 19 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
labels:
- "dependencies"
- "github-actions"
1 change: 1 addition & 0 deletions .github/workflows/CrossChecks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,4 @@ jobs:
--os ${{ matrix.os }}
--ccrepo https://github.com/${{ env.CROSS_CHECK_REPO_USER }}/${{ env.CROSS_CHECK_REPO_NAME}}
--ccbranch ${{ env.CROSS_CHECK_BRANCH }}
--skipnotcompliant
1 change: 1 addition & 0 deletions cross_checks/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
FMI = "14a09403-18e3-468f-ad8a-74f8dda2d9ac"
FMICore = "8af89139-c281-408e-bce2-3005eb87462f"
FMIImport = "9fcbc62e-52a0-44e9-a616-1359a0008194"
Expand Down
6 changes: 3 additions & 3 deletions cross_checks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ optional arguments:
--os OS The operating system for which the cross
checks should be excecuted (default:
"windows-latest")
--ccrepo CCREPO The Url to the git repository that contains
--ccrepo CCREPO The URL to the git repository that contains
the cross checks. (default:
"https://github.com/modelica/fmi-cross-check")
--ccbranch CCBRANCH The name of the branch in which the results
Expand All @@ -49,9 +49,9 @@ optional arguments:
--includefatals Include FMUs that have caused the cross check
runner to fail and exit
--skipnotcompliant Reject officially not compliant FMUs and don't
excecute them
execute them
--commitrejected Also commit the result file for FMUs that
hasn't been excecuted (e.g. officially not
hasn't been executed (e.g. officially not
compliant FMUs if they are not skipped)
--commitfailed Also commit the result file for failed FMUs
-h, --help show this help message and exit
Expand Down
35 changes: 21 additions & 14 deletions cross_checks/cross_check.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,30 @@ using CSV
using DelimitedFiles
using Tables
using Statistics
using DifferentialEquations

import Base64

include("cross_check_config.jl")
include("cross_check_lib.jl")

# Main Array that holds all information about the excecuted cross checks and results
# Main Array that holds all information about the executed cross checks and results
crossChecks = []

getInputValues = function (t, u)
return nothing
end

getSolver = function()
return Tsit5() # CVODE_BDF() # Rosenbrock23(autodiff=false)
end

function parse_commandline()
s = ArgParseSettings()

@add_arg_table s begin
"--os"
help = "The operating system for which the cross checks should be excecuted"
help = "The operating system for which the cross checks should be executed"
arg_type = String
default = "windows-latest"
"--ccrepo"
Expand All @@ -53,10 +58,10 @@ function parse_commandline()
help = "Include FMUs that have caused the cross check runner to fail and exit"
action = :store_true
"--skipnotcompliant"
help = "Reject officially not compliant FMUs and don't excecute them"
help = "Reject officially not compliant FMUs and don't execute them"
action = :store_true
"--commitrejected"
help = "Also commit the result file for FMUs that hasn't been excecuted (e.g. officially not compliant FMUs if they are not skipped)"
help = "Also commit the result file for FMUs that hasn't been executed (e.g. officially not compliant FMUs if they are not skipped)"
action = :store_true
"--commitfailed"
help = "Also commit the result file for failed FMUs"
Expand Down Expand Up @@ -118,7 +123,7 @@ function runCrossCheckFmu(
getInputValues = function (t, u)
for (valIndex, val) in enumerate(inputValues)
if val.time >= t
u[:] = inputValues[valIndex][2:end]
u[:] = collect(inputValues[valIndex])[2:end]
# a = collect(inputValues[valIndex])[2:end]
# return a
break
Expand All @@ -142,6 +147,7 @@ function runCrossCheckFmu(
simData = simulateME(
fmuToCheck,
(tStart, tStop);
solver=getSolver(),
reltol = relTol,
saveat = fmuRefValues[1],
inputFunction = getInputValues,
Expand All @@ -164,6 +170,7 @@ function runCrossCheckFmu(
simData = simulateME(
fmuToCheck,
(tStart, tStop);
solver=getSolver(),
reltol = relTol,
saveat = fmuRefValues[1],
recordValues = fmuRecordValueNames,
Expand Down Expand Up @@ -241,7 +248,7 @@ function main()
println("#################### Start FMI Cross checks Run ####################")
# parsing of cli arguments and setting of configuration
parsed_args = parse_commandline()
unpackPath = parsed_args["tempdir"]
unpackPath = haskey(ENV, "crosscheck_tempdir") ? ENV["crosscheck_tempdir"] : parsed_args["tempdir"]
fmiVersion = parsed_args["fmiversion"]
crossCheckRepo = parsed_args["ccrepo"]
crossCheckBranch = parsed_args["ccbranch"]
Expand All @@ -251,7 +258,7 @@ function main()
os = "linux64"
end
includeFatals = parsed_args["includefatals"]
skipnotcompliant = parsed_args["skipnotcompliant"]
skipnotcompliant = haskey(ENV, "crosscheck_skipnotcompliant") ? true : parsed_args["skipnotcompliant"]
commitrejected = parsed_args["commitrejected"]
commitfailed = parsed_args["commitfailed"]

Expand All @@ -261,7 +268,7 @@ function main()
end

# Loading all available cross checks
fmiCrossCheckRepoPath = getFmuCrossCheckRepo(crossCheckRepo, unpackPath)
fmiCrossCheckRepoPath = getFMICrossCheckRepo(crossCheckRepo, unpackPath)

# set up the github access for the fmi-cross-checks repo and checkout the respective branch
github_token = get(ENV, "GITHUB_TOKEN", "")
Expand Down Expand Up @@ -346,21 +353,21 @@ function main()
# Write Summary of Cross Check run
println("#################### Start FMI Cross check Summary ####################")
println("\tTotal Cross checks:\t\t\t$(count(c -> (true), crossChecks))")
println("\tSuccessfull Cross checks:\t\t$(count(c -> (c.success), crossChecks))")
println("\tSuccessful Cross checks:\t\t$(count(c -> (c.success === true), crossChecks))")
println(
"\tFailed Cross checks:\t\t\t$(count(c -> (!c.success && c.error === nothing && !c.skipped), crossChecks))",
"\tFailed Cross checks:\t\t\t$(count(c -> (c.success === false && c.error === nothing && c.skipped === false), crossChecks))",
)
println(
"\tCross checks with errors:\t\t$(count(c -> (c.error !== nothing), crossChecks))",
)
println("\tSkipped Cross checks:\t\t\t$(count(c -> (c.skipped), crossChecks))")
println("\tList of successfull Cross checks")
for (index, success) in enumerate(filter(c -> (c.success), crossChecks))
println("\tSkipped Cross checks:\t\t\t$(count(c -> (c.skipped === true), crossChecks))")
println("\tList of successful Cross checks")
for (index, success) in enumerate(filter(c -> (c.success === true), crossChecks))
println("\u001B[32m\t\t$(index):\t$(success)\u001B[0m")
end
println("\tList of failed Cross checks")
for (index, success) in enumerate(
filter(c -> (!c.success && c.error === nothing && !c.skipped), crossChecks),
filter(c -> (c.success === false && c.error === nothing && c.skipped === false), crossChecks),
)
println("\u001B[33m\t\t$(index):\t$(success)\u001B[0m")
end
Expand Down
4 changes: 2 additions & 2 deletions cross_checks/cross_check_lib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"""
Returns the path where the FMU cross checks are saved locally.
This will also checkout the repository from a specified URL if they are not yet present in the specified path.
Hint: This will not check the cross check repository for integrety
Hint: This will not check the cross check repository for integrity
# Arguments
- `crossCheckRepo::String`: URL to the FMU Cross check repository that should be used. Note, if you want to push your results later, this should be a fork that you have access to
- `unpackPath::Union{String, Nothing}`: optional path that is used to checkout the the fmu cross check repository. If no path is specified, a temporary path is created
# Returns
- `repoPath::String`: The path where the repository can be found locally (including the repository name)
"""
function getFmuCrossCheckRepo(
function getFMICrossCheckRepo(
crossCheckRepo::String,
unpackPath::Union{String,Nothing} = nothing,
)::String
Expand Down

0 comments on commit b4e2cce

Please sign in to comment.