From 565f0b837283dca73abb957222f00246614614db Mon Sep 17 00:00:00 2001 From: Simon Exner <43469235+0815Creeper@users.noreply.github.com> Date: Sun, 8 Sep 2024 10:08:44 +0200 Subject: [PATCH 1/4] pluto implementation for CI --- .github/workflows/Example.yml | 52 ++++++++++++++++++++++++++++++++-- docs/make.jl | 1 + docs/src/examples/overview.md | 7 ++++- docs/src/examples/workshops.md | 4 +++ 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 docs/src/examples/workshops.md diff --git a/.github/workflows/Example.yml b/.github/workflows/Example.yml index 74e30508..ac2153b7 100644 --- a/.github/workflows/Example.yml +++ b/.github/workflows/Example.yml @@ -8,7 +8,7 @@ on: - main paths: - 'src/**' - - 'examples/src/**' + - 'examples/**' - '.github/workflows/Example.yml' - 'Project.toml' @@ -81,9 +81,55 @@ jobs: git add ${{ env.EXAMPLES_PATH }} git commit -m "${{ env.CI_COMMIT_MESSAGE }}" git push origin examples || (git reset --soft HEAD~1 && (exit 1)) - + + pluto: + runs-on: ubuntu-latest + steps: + - name: "Check out repository" + uses: actions/checkout@v3 + + - name: "Set up Julia" + uses: julia-actions/setup-julia@v1 + with: + version: '1.10' + + - run: julia -e 'using Pkg; Pkg.add("PlutoSliderServer"); Pkg.add("FMI")' + - run: julia -e 'using PlutoSliderServer; PlutoSliderServer.export_directory("examples/pluto-src")' + + - name: "auto-commit (retry on merge)" + if: success() && github.event_name != 'pull_request' && github.branch == 'main' + uses: nick-fields/retry@v3 + env: + CI_COMMIT_MESSAGE: examples-pluto[${{ github.ref }}] + CI_COMMIT_AUTHOR: github-actions[bot] + EXAMPLES_PATH: examples + # Fetch all and clear the stash list. Include all files from the examples folder to the stash and switch the branch. + # Reset the branch and remove all current files in the examples folder. + # Checkout the last stash to restore the new notebooks and apply the stash index to restore all other new files in the folder. + with: + timeout_minutes: 999 + max_attempts: 10 + warning_on_retry: false + shell: bash + command: | + git fetch --all + git stash clear + git stash --include-untracked -- ${{ env.EXAMPLES_PATH }} + git switch examples + git reset --hard origin/examples + git checkout stash -f -- ${{ env.EXAMPLES_PATH }} + git stash apply --index + git stash drop + git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" + git config --global user.email "${{ env.CI_COMMIT_AUTHOR }}@users.noreply.github.com" + git config --global core.autocrlf false + git pull + git add ${{ env.EXAMPLES_PATH }} + git commit -m "${{ env.CI_COMMIT_MESSAGE }}" + git push origin examples || (git reset --soft HEAD~1 && (exit 1)) + call-docu: - needs: jupyter + needs: [jupyter, pluto] if: github.event_name != 'pull_request' && github.branch == 'main' runs-on: ubuntu-latest steps: diff --git a/docs/make.jl b/docs/make.jl index 6bbaed0f..cf590d9d 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -18,6 +18,7 @@ example_pages = [ "Manipulation" => "examples/manipulation.md", "Multithreading" => "examples/multithreading.md", "Multiprocessing" => "examples/multiprocessing.md", + "Pluto Workshops" => "examples/workshops.md", ] makedocs( diff --git a/docs/src/examples/overview.md b/docs/src/examples/overview.md index e9443e33..c081daac 100644 --- a/docs/src/examples/overview.md +++ b/docs/src/examples/overview.md @@ -3,7 +3,7 @@ This section discusses the included examples of the FMI.jl library. If you require further information about the function calls, see the function sections of the [library](https://thummeto.github.io/FMI.jl/dev/library/). -Examples are subdevided into *Basics*, *Advanced* and *Publication appendices*. +Examples are subdevided into *Basics*, *Advanced*, *Pluto workshops* and *Publication appendices*. **Basic examples:** @@ -22,6 +22,11 @@ Examples are subdevided into *Basics*, *Advanced* and *Publication appendices*. - [__Multiprocessing__](https://thummeto.github.io/FMI.jl/dev/examples/multiprocessing/): Shows how to use multiprocessing to simulate multiple FMUs. +**Pluto workshops:** + +- [__Pluto workshops__](https://thummeto.github.io/FMI.jl/dev/examples/workshops/): [Pluto](https://plutojl.org/) based notebooks, that can easyly be executed on your own Pluto-Setup. + + **Publication appendices:** - [__Modelica conference 2021__](https://thummeto.github.io/FMI.jl/dev/examples/modelica_conference_2021/): Showing the different variants of simulating an FMU. \ No newline at end of file diff --git a/docs/src/examples/workshops.md b/docs/src/examples/workshops.md new file mode 100644 index 00000000..6994fee9 --- /dev/null +++ b/docs/src/examples/workshops.md @@ -0,0 +1,4 @@ +[Pluto](https://plutojl.org/) based notebooks, that can easyly be executed on your own Pluto-Setup. +```@raw html + +``` \ No newline at end of file From 0cbf8c924f6974e502a8bfc98883ec077c6d1726 Mon Sep 17 00:00:00 2001 From: Simon Exner <43469235+0815Creeper@users.noreply.github.com> Date: Sun, 8 Sep 2024 19:50:29 +0200 Subject: [PATCH 2/4] fixes for documentation building --- docs/Project.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Project.toml b/docs/Project.toml index 59b3f82f..212806db 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -2,6 +2,7 @@ CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +FMIBase = "900ee838-d029-460e-b485-d98a826ceef2" FMICore = "8af89139-c281-408e-bce2-3005eb87462f" FMIImport = "9fcbc62e-52a0-44e9-a616-1359a0008194" JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" From 1f1f3dbe13ff6aae96ac6eef3dc0621b34b8ba79 Mon Sep 17 00:00:00 2001 From: Simon Exner <43469235+0815Creeper@users.noreply.github.com> Date: Mon, 9 Sep 2024 17:52:20 +0200 Subject: [PATCH 3/4] fix make.jl --- docs/make.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index cf590d9d..6bd147ae 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -55,7 +55,6 @@ makedocs( ], ], "FMI3 specific content"=>Any[ - "fmi3_lowlevel_library_types.md", "fmi3_lowlevel_library_constants.md", "FMI3 Functions in FMI Import/Core .jl"=>Any[ "fmi3_lowlevel_modeldescription_functions.md", From ac1d071badf32813c8c3df9cd52273ba8b45ef7b Mon Sep 17 00:00:00 2001 From: Simon Exner <43469235+0815Creeper@users.noreply.github.com> Date: Wed, 11 Sep 2024 18:17:13 +0200 Subject: [PATCH 4/4] fixes for Example.yml --- .github/workflows/Example.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Example.yml b/.github/workflows/Example.yml index ac2153b7..1c9a88c4 100644 --- a/.github/workflows/Example.yml +++ b/.github/workflows/Example.yml @@ -52,7 +52,7 @@ jobs: run: julia --project=examples/ examples/src/${{ matrix.file-name }}.jl - name: "auto-commit (retry on merge)" - if: success() && github.event_name != 'pull_request' && github.branch == 'main' + if: success() && github.event_name != 'pull_request' && github.ref_name == 'main' uses: nick-fields/retry@v3 env: CI_COMMIT_MESSAGE: example-${{ matrix.os }}-${{ matrix.file-name }}-${{ matrix.julia-version }}-${{ matrix.julia-arch }}-${{ matrix.experimental }}[${{ github.ref }}] @@ -97,7 +97,7 @@ jobs: - run: julia -e 'using PlutoSliderServer; PlutoSliderServer.export_directory("examples/pluto-src")' - name: "auto-commit (retry on merge)" - if: success() && github.event_name != 'pull_request' && github.branch == 'main' + if: success() && github.event_name != 'pull_request' && github.ref_name == 'main' uses: nick-fields/retry@v3 env: CI_COMMIT_MESSAGE: examples-pluto[${{ github.ref }}] @@ -130,7 +130,7 @@ jobs: call-docu: needs: [jupyter, pluto] - if: github.event_name != 'pull_request' && github.branch == 'main' + if: github.event_name != 'pull_request' && github.ref_name == 'main' runs-on: ubuntu-latest steps: # Trigger an repoisitory dispath event