Skip to content

Commit 6e762f3

Browse files
authored
action version bumps (#46)
* action-deps-version-bumps * version bump codecov action * lts label, added julia caching * reformatted * fix for PkgEval Xvfb --------- Co-authored-by: Simon Exner <0815Creeper@users.noreply.github.com>
1 parent 2a30f63 commit 6e762f3

9 files changed

+73
-26
lines changed

.github/workflows/Eval.yml

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ jobs:
1818
julia-arch: [x64]
1919

2020
steps:
21+
# Required by PkgEval.jl as xvfb runs into issues with ubuntu 24. See ci.yml workflow of PkgEval.jl repo
22+
- name: "Allow unprivileged user namespaces"
23+
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
24+
2125
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2226
- name: Check out repository
2327
uses: actions/checkout@v4

.github/workflows/TestLTS.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
julia-version: ['1.6']
21+
julia-version: ['lts']
2222
julia-arch: [x64]
2323
os: [ubuntu-latest, windows-latest]
2424
experimental: [false]
@@ -35,6 +35,10 @@ jobs:
3535
version: ${{ matrix.julia-version }}
3636
arch: ${{ matrix.julia-arch }}
3737

38+
# Set up julia-cache
39+
- name: Set up julia-cache
40+
uses: julia-actions/cache@v2
41+
3842
# Set up cache
3943
- name: "Set up cache"
4044
uses: actions/cache@v4

.github/workflows/TestLatest.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ jobs:
3535
version: ${{ matrix.julia-version }}
3636
arch: ${{ matrix.julia-arch }}
3737

38+
# Set up julia-cache
39+
- name: Set up julia-cache
40+
uses: julia-actions/cache@v2
41+
3842
# Set up cache
3943
- name: "Set up cache"
4044
uses: actions/cache@v4
@@ -62,8 +66,8 @@ jobs:
6266

6367
# Run codecov
6468
- name: "Run CodeCov"
65-
uses: codecov/codecov-action@v4
69+
uses: codecov/codecov-action@v5
6670
env:
6771
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
6872
with:
69-
file: lcov.info
73+
files: lcov.info

ext/ForwardDiffExt.jl

-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,3 @@ function FMIBase.sense_setindex!(A::Vector{Float64}, x::ForwardDiff.Dual, i::Int
3131
end
3232

3333
end # ForwardDiffExt
34-

ext/ReverseDiffExt.jl

-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,3 @@ function FMIBase.sense_setindex!(A::Vector{Float64}, x::ReverseDiff.TrackedReal,
4040
end
4141

4242
end # ReverseDiffExt
43-

src/deprecated.jl

+5-3
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ end
4545
export fmiGetSolutionState
4646

4747
function fmi2GetSolutionDerivative(solution::FMUSolution, args...; kwargs...)
48-
@warn "`fmi2GetSolutionDerivative` is deprecated, use `getStateDerivative` instead." maxlog = 3
48+
@warn "`fmi2GetSolutionDerivative` is deprecated, use `getStateDerivative` instead." maxlog =
49+
3
4950
return getStateDerivative(solution, args...; kwargs...)
5051
end
5152
export fmi2GetSolutionDerivative
5253

5354
function fmiGetSolutionDerivative(solution::FMUSolution, args...; kwargs...)
54-
@warn "`fmiGetSolutionDerivative` is deprecated, use `getStateDerivative` instead." maxlog = 3
55+
@warn "`fmiGetSolutionDerivative` is deprecated, use `getStateDerivative` instead." maxlog =
56+
3
5557
return getStateDerivative(solution, args...; kwargs...)
5658
end
5759
export fmiGetSolutionDerivative
@@ -78,4 +80,4 @@ function fmiGetSolutionTime(solution::FMUSolution)
7880
@warn "`fmiGetSolutionTime` is deprecated, use `getTime` instead." maxlog = 3
7981
return getTime(solution)
8082
end
81-
export fmiGetSolutionTime
83+
export fmiGetSolutionTime

src/printing.jl

-1
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,3 @@ function logError(fmu::FMU, message, maxlog = typemax(Int))
4747
end
4848
end
4949
export logError
50-

src/snapshot.jl

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ function snapshotDeltaTimeTolerance(sol::FMUSolution)
3333
return snapshotDeltaTimeTolerance(sol.instance)
3434
end
3535

36-
function snapshot_if_needed!(obj::Union{FMUInstance,FMUSolution}, t::Real; atol = snapshotDeltaTimeTolerance(obj))
36+
function snapshot_if_needed!(
37+
obj::Union{FMUInstance,FMUSolution},
38+
t::Real;
39+
atol = snapshotDeltaTimeTolerance(obj),
40+
)
3741
if !hasSnapshot(obj, t; atol = atol)
3842
snapshot!(obj)
3943
end

src/solution.jl

+48-16
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ More detailed: `fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1
2323
- FMISpec2.0.2 Link: [https://fmi-standard.org/](https://fmi-standard.org/)
2424
- FMISpec2.0.2[p.22]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
2525
"""
26-
function getState(solution::FMUSolution, vrs::fmi2ValueReferenceFormat; isIndex::Bool=false)
26+
function getState(
27+
solution::FMUSolution,
28+
vrs::fmi2ValueReferenceFormat;
29+
isIndex::Bool = false,
30+
)
2731

2832
indices = []
2933

@@ -40,10 +44,14 @@ function getState(solution::FMUSolution, vrs::fmi2ValueReferenceFormat; isIndex:
4044
if !isnothing(solution.states)
4145
for vr in vrs
4246
found = false
43-
for i in 1:length(solution.instance.fmu.modelDescription.stateValueReferences)
44-
if solution.instance.fmu.modelDescription.stateValueReferences[i] == vr
47+
for i =
48+
1:length(
49+
solution.instance.fmu.modelDescription.stateValueReferences,
50+
)
51+
if solution.instance.fmu.modelDescription.stateValueReferences[i] ==
52+
vr
4553
push!(indices, i)
46-
found = true
54+
found = true
4755
break
4856
end
4957
end
@@ -61,7 +69,9 @@ function getState(solution::FMUSolution, vrs::fmi2ValueReferenceFormat; isIndex:
6169
return collect(u[indices[1]] for u in solution.states.u)
6270

6371
else # multi value
64-
return collect(collect(u[indices[i]] for u in solution.states.u) for i in 1:length(indices))
72+
return collect(
73+
collect(u[indices[i]] for u in solution.states.u) for i = 1:length(indices)
74+
)
6575

6676
end
6777
end
@@ -90,7 +100,12 @@ More detailed: `fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1
90100
- FMISpec2.0.2 Link: [https://fmi-standard.org/](https://fmi-standard.org/)
91101
- FMISpec2.0.2[p.22]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
92102
"""
93-
function getStateDerivative(solution::FMUSolution, vrs::fmi2ValueReferenceFormat; isIndex::Bool=false, order::Integer=1)
103+
function getStateDerivative(
104+
solution::FMUSolution,
105+
vrs::fmi2ValueReferenceFormat;
106+
isIndex::Bool = false,
107+
order::Integer = 1,
108+
)
94109
indices = []
95110

96111
if isIndex
@@ -106,10 +121,14 @@ function getStateDerivative(solution::FMUSolution, vrs::fmi2ValueReferenceFormat
106121
if !isnothing(solution.states)
107122
for vr in vrs
108123
found = false
109-
for i in 1:length(solution.instance.fmu.modelDescription.stateValueReferences)
110-
if solution.instance.fmu.modelDescription.stateValueReferences[i] == vr
124+
for i =
125+
1:length(
126+
solution.instance.fmu.modelDescription.stateValueReferences,
127+
)
128+
if solution.instance.fmu.modelDescription.stateValueReferences[i] ==
129+
vr
111130
push!(indices, i)
112-
found = true
131+
found = true
113132
break
114133
end
115134
end
@@ -124,10 +143,16 @@ function getStateDerivative(solution::FMUSolution, vrs::fmi2ValueReferenceFormat
124143
if length(indices) == length(vrs)
125144

126145
if length(vrs) == 1 # single value
127-
return collect(solution.states(t, Val{order})[indices[1]] for t in solution.states.t)
146+
return collect(
147+
solution.states(t, Val{order})[indices[1]] for t in solution.states.t
148+
)
128149

129150
else # multi value
130-
return collect(collect(solution.states(t, Val{order})[indices[i]] for t in solution.states.t) for i in 1:length(indices))
151+
return collect(
152+
collect(
153+
solution.states(t, Val{order})[indices[i]] for t in solution.states.t
154+
) for i = 1:length(indices)
155+
)
131156
end
132157
end
133158

@@ -156,7 +181,11 @@ More detailed: `fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1
156181
- FMISpec2.0.2 Link: [https://fmi-standard.org/](https://fmi-standard.org/)
157182
- FMISpec2.0.2[p.22]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
158183
"""
159-
function getValue(solution::FMUSolution, vrs::fmi2ValueReferenceFormat; isIndex::Bool=false)
184+
function getValue(
185+
solution::FMUSolution,
186+
vrs::fmi2ValueReferenceFormat;
187+
isIndex::Bool = false,
188+
)
160189

161190
indices = []
162191

@@ -173,10 +202,10 @@ function getValue(solution::FMUSolution, vrs::fmi2ValueReferenceFormat; isIndex:
173202
if !isnothing(solution.values)
174203
for vr in vrs
175204
found = false
176-
for i in 1:length(solution.valueReferences)
205+
for i = 1:length(solution.valueReferences)
177206
if solution.valueReferences[i] == vr
178207
push!(indices, i)
179-
found = true
208+
found = true
180209
break
181210
end
182211
end
@@ -194,7 +223,10 @@ function getValue(solution::FMUSolution, vrs::fmi2ValueReferenceFormat; isIndex:
194223
return collect(u[indices[1]] for u in solution.values.saveval)
195224

196225
else # multi value
197-
return collect(collect(u[indices[i]] for u in solution.values.saveval) for i in 1:length(indices))
226+
return collect(
227+
collect(u[indices[i]] for u in solution.values.saveval) for
228+
i = 1:length(indices)
229+
)
198230

199231
end
200232
end
@@ -230,4 +262,4 @@ function getTime(solution::FMUSolution)
230262
return nothing
231263
end
232264
end
233-
export getTime
265+
export getTime

0 commit comments

Comments
 (0)