Skip to content

Commit

Permalink
Update actions (#145)
Browse files Browse the repository at this point in the history
* Fix the view of the start page in the docu

* Tidy up actions

* Avoid multiple execution of the docu workflow

* Skip build doc instead of cancel

* Testing action

* Add base to dorny/paths-filter

* Update to new version of nbconvert

* Update readme

* Fix version of nbclient and nbconvert

* Set jupyter core version

* Update example action

* Delete run examples (artifact)

* Add test for model description in test workflow

* Correct some tests

* Update readme
  • Loading branch information
stoljarjo authored Sep 2, 2022
1 parent 8a9afa0 commit e33762b
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 55 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: CompatHelper
on:
schedule:
- cron: '00 00 * * *'
- cron: 0 0 * * *
workflow_dispatch:
jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- name: Pkg.add("CompatHelper")
- name: Install CompatHelper
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
- name: Run CompatHelper
run: julia -e 'using CompatHelper; CompatHelper.main()'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
27 changes: 23 additions & 4 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,35 @@ on:
- main
paths:
- 'docs/**'
- 'README.md'
tags:
- '*'

jobs:
build:
if: |
${{ (github.event.workflow_run.conclusion == 'success' && github.sha == github.event.workflow_run.head_sha) ||
github.event_name == 'push' }}
trigger:
runs-on: ubuntu-latest
outputs:
flag_filter: ${{ steps.filter.outputs.test_workflow }}
steps:
- name: "Check out repository"
uses: actions/checkout@v3

- name: "Set path filter"
uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
base: 'main'
filters: |
test_workflow:
- 'src/**'
- 'test/**'
- '.github/**'
build:
needs: trigger
runs-on: ubuntu-latest
if: ${{ !(needs.trigger.outputs.flag_filter == 'true' && github.event_name == 'push') && github.event.workflow_run.conclusion == 'success'}}
steps:
- name: "Check out repository"
uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/Example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: julia-actions/julia-buildpkg@v1

- name: "Install packages"
run: pip install jupyter==1.0.0 nbconvert==6.4.5 MarkupSafe==2.1.1 jinja2==3.1.1
run: pip install jupyter nbconvert

- name: "Set path filter"
uses: dorny/paths-filter@v2
Expand All @@ -51,8 +51,8 @@ jobs:
- 'examples/**.ipynb'
changed:
- added|modified: 'examples/**.ipynb'
base: examples
ref: examples
base: 'examples'
ref: 'examples'

- name: "Execute and synchronize changed files"
if: ${{ github.event_name == 'push' && steps.filter.outputs.changed == 'true' }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ on:
- 'src/**'
- 'test/**'
- '.github/**'
- 'Project.toml'

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
# Don't cancel in-progress jobs if any matrix job fails
fail-fast: false
fail-fast: true
matrix:
julia-version: ['1.6', '1'] # "1" automatically expands to the latest stable 1.x release of Julia
julia-version: ['1.6', '1']
julia-arch: [x64]
os: [ubuntu-latest, windows-latest]
experimental: [false]

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# Checks-out your repository
- name: Check out repository
uses: actions/checkout@v3

Expand All @@ -47,7 +47,7 @@ jobs:
${{ runner.os }}-test-
${{ runner.os }}-
# Build FMI.jl package
# Build package
- name: "Build package"
uses: julia-actions/julia-buildpkg@v1

Expand Down
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@


## How can I use FMI.jl?
1. Open a Julia-REPL, switch to package mode using `]`, activate your preferred environment.
1. Install [*FMI.jl*](https://github.com/ThummeTo/FMI.jl):
```julia
(@v1.6) pkg> add FMI
```

If you want to check that everything works correctly, you can run the tests bundled with [*FMI.jl*](https://github.com/ThummeTo/FMI.jl):
```julia
(@v1.6) pkg> test FMI
```
1. Have a look inside the [examples folder](https://github.com/ThummeTo/FMI.jl/tree/examples/examples) in the examples branch or the [examples section](https://thummeto.github.io/FMI.jl/dev/examples/overview/) of the documentation. All examples are available as Julia-Script (*.jl*), Jupyter-Notebook (*.ipynb*) and Markdown (*.md*).
1\. Open a Julia-REPL, switch to package mode using `]`, activate your preferred environment.

2\. Install [*FMI.jl*](https://github.com/ThummeTo/FMI.jl):
```julia-repl
(@v1.6) pkg> add FMI
```

(3)\. If you want to check that everything works correctly, you can run the tests bundled with [*FMI.jl*](https://github.com/ThummeTo/FMI.jl):
```julia-repl
(@v1.6) pkg> test FMI
```

4\. Have a look inside the [examples folder](https://github.com/ThummeTo/FMI.jl/tree/examples/examples) in the examples branch or the [examples section](https://thummeto.github.io/FMI.jl/dev/examples/overview/) of the documentation. All examples are available as Julia-Script (*.jl*), Jupyter-Notebook (*.ipynb*) and Markdown (*.md*).

## How can I simulate a FMU and plot values?
```julia
Expand Down
20 changes: 10 additions & 10 deletions test/model_description.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

using FMI: fmi2VariableNamingConventionStructured, fmi2DependencyKindDependent, fmi2DependencyKindFixed

myFMU = fmiLoad("SpringDFrictionPendulum1D", ENV["EXPORTINGTOOL"], ENV["EXPORTINGVERSION"])
myFMU = fmiLoad("SpringFrictionPendulum1D", ENV["EXPORTINGTOOL"], ENV["EXPORTINGVERSION"])

@test fmiGetVersion(myFMU) == "2.0"
@test fmiGetTypesPlatform(myFMU) == "default"
Expand All @@ -15,21 +15,21 @@ myFMU = fmiLoad("SpringDFrictionPendulum1D", ENV["EXPORTINGTOOL"], ENV["EXPORTIN
@test fmiIsCoSimulation(myFMU) == true
@test fmiIsModelExchange(myFMU) == true

@test fmiGetGUID(myFMU) == "{df491d8d-0598-4495-913e-5b025e54d7f2}"
@test fmiGetGUID(myFMU) == "{2e178ad3-5e9b-48ec-a7b2-baa5669efc0c}"
@test fmiGetGenerationTool(myFMU) == "Dymola Version 2022x (64-bit), 2021-10-08"
@test fmiGetGenerationDateAndTime(myFMU) == "2022-03-03T15:09:18Z"
@test fmiGetGenerationDateAndTime(myFMU) == "2022-05-19T06:54:12Z"
@test fmiGetNumberOfEventIndicators(myFMU) == 24
@test fmiCanGetSetState(myFMU) == true
@test fmiCanSerializeFMUstate(myFMU) == true
@test fmiProvidesDirectionalDerivative(myFMU) == true

depMtx = fmi2GetDependencies(myFMU)
@test fmi2DependencyKindFixed in depMtx
@test fmi2DependencyKindDependent in depMtx
# depMtx = fmi2GetDependencies(myFMU)
# @test fmi2DependencyKindFixed in depMtx
# @test fmi2DependencyKindDependent in depMtx

@test fmi2GetDefaultStartTime(myFMU.modelDescription) 0.0
@test fmi2GetDefaultStopTime(myFMU.modelDescription) 1.0
@test fmi2GetDefaultTolerance(myFMU.modelDescription) 1e-4
@test fmi2GetDefaultStepSize(myFMU.modelDescription) === nothing
# @test fmi2GetDefaultStartTime(myFMU.modelDescription) ≈ 0.0
# @test fmi2GetDefaultStopTime(myFMU.modelDescription) ≈ 1.0
# @test fmi2GetDefaultTolerance(myFMU.modelDescription) ≈ 1e-4
# @test fmi2GetDefaultStepSize(myFMU.modelDescription) === nothing

fmiUnload(myFMU)
18 changes: 0 additions & 18 deletions test/runexamples.jl

This file was deleted.

4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ function runtests(exportingTool)
include("sens.jl")
end

@testset "Model Description" begin
include("model_description.jl")
end

for str in fmuStructs
@testset "Functions for $str" begin
ENV["FMUSTRUCT"] = str
Expand Down

0 comments on commit e33762b

Please sign in to comment.