Implement new Notebook for the WSCC_9bus system with decoupling line #2492
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Test Fedora | |
on: | |
push: | |
## Build ## | |
jobs: | |
linux-fedora-dpsimpy: | |
name: Build dpsimpy and tests examples on Fedora Linux | |
runs-on: ubuntu-latest | |
container: sogno/dpsim:dev | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Create Build Environment | |
run: mkdir build | |
- name: Setup build directory cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/build | |
key: build-fedora-dir-cache-${{ github.ref }} | |
- name: Configure CMake | |
shell: bash | |
working-directory: ${{ github.workspace }}/build | |
run: cmake -DCIM_VERSION=CGMES_2.4.15_16FEB2016 $GITHUB_WORKSPACE | |
- name: Build dpsimpy and test examples | |
shell: bash | |
working-directory: ${{ github.workspace }}/build | |
run: cmake --build . --target dpsimpy --target tests --target dpsimpyvillas --parallel $(nproc) | |
- name: Archive build directory | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ github.workspace }}/build | |
name: build-fedora-examples-cache-${{ github.sha }} | |
retention-days: 1 | |
linux-fedora-examples: | |
name: Build Cxx examples on Fedora Linux | |
runs-on: ubuntu-latest | |
container: sogno/dpsim:dev | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Create Build Environment | |
run: mkdir build | |
- name: Setup build directory cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/build | |
key: build-fedora-dir-example-cache-${{ github.ref }} | |
- name: Configure CMake | |
shell: bash | |
working-directory: ${{ github.workspace }}/build | |
run: cmake -DCIM_VERSION=CGMES_2.4.15_16FEB2016 $GITHUB_WORKSPACE | |
- name: Build every target | |
shell: bash | |
working-directory: ${{ github.workspace }}/build | |
run: cmake --build . --parallel $(nproc) | |
- name: Archive build directory | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ github.workspace }}/build | |
name: build-cache-examples-cpp-${{ github.sha }} | |
retention-days: 1 | |
## Tests ## | |
test-jupyter-notebooks: | |
name: Run pytest over all notebooks | |
runs-on: ubuntu-latest | |
needs: [linux-fedora-dpsimpy] | |
container: sogno/dpsim:dev | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Restore build archive | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-fedora-examples-cache-${{ github.sha }} | |
path: ${{ github.workspace }}/build | |
- name: Prepare binary permissions | |
shell: bash | |
working-directory: ${{ github.workspace }} | |
run: | | |
chmod -R +x ./build/dpsim/examples/cxx | |
- name: Work around permission issue | |
run: git config --global --add safe.directory /__w/dpsim/dpsim | |
- name: Check for test binaries | |
shell: bash | |
working-directory: ${{ github.workspace }} | |
run: ls -l ./build/dpsim/examples/cxx/ | |
- name: Install parallel testing | |
shell: bash | |
run: pip install pytest-xdist | |
- name: Run pytest | |
shell: bash | |
working-directory: ${{ github.workspace }} | |
env: | |
PYTHONPATH: "${{ github.workspace }}/build" | |
run: | | |
cp -r python/src/dpsim build/ | |
pytest -v examples/Notebooks -n auto | |
- name: Archive notebook outputs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-output-${{ github.sha }} | |
path: outputs/ | |
compare-notebook-results: | |
name: Compare Notebook results | |
runs-on: ubuntu-latest | |
needs: [test-jupyter-notebooks] | |
steps: | |
- name: Download new notebook results | |
uses: actions/download-artifact@v4 | |
with: | |
name: pytest-output-${{ github.sha }} | |
path: ${{ github.workspace }}/notebooks-new | |
- name: Download master notebook results | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/notebooks-master | |
key: notebook-output-cache-master-${{ github.sha }} | |
restore-keys: | | |
notebook-output-cache-master- | |
- name: Download previous commit notebook results | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/notebooks-previous | |
key: notebook-output-cache-commit-${{ github.ref }}-${{ github.sha }} | |
restore-keys: | | |
notebook-output-cache-commit-${{ github.ref }}- | |
- name: Compare current results with master | |
shell: bash | |
run: diff --color -r ${{ github.workspace }}/notebooks-new ${{ github.workspace }}/notebooks-master | |
continue-on-error: true | |
- name: Compare current results with previous commit | |
shell: bash | |
run: diff --color -r ${{ github.workspace }}/notebooks-new ${{ github.workspace }}/notebooks-previous | |
continue-on-error: true | |
- name: Cache new notebook results 1/2 | |
shell: bash | |
run: | | |
rm -rf ${{ github.workspace }}/notebooks-previous | |
cp -R ${{ github.workspace }}/notebooks-new ${{ github.workspace }}/notebooks-previous | |
- name: Cache new notebook results 2/2 | |
if: github.ref_name == 'master' | |
shell: bash | |
run: | | |
rm -rf ${{ github.workspace }}/notebooks-master | |
cp -R ${{ github.workspace }}/notebooks-new ${{ github.workspace }}/notebooks-master | |
test-binaries: | |
name: Execute WSCC 9 bus example | |
runs-on: ubuntu-latest | |
container: sogno/dpsim:dev | |
needs: [linux-fedora-examples] | |
steps: | |
- name: Restore build archive | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-cache-examples-cpp-${{ github.sha }} | |
path: ${{ github.workspace }}/build | |
- name: Prepare binary permissions | |
shell: bash | |
run: | | |
chmod -R +x ./build/dpsim/examples/cxx | |
- name: Run Binaries 1/2 | |
run: ./build/dpsim/examples/cxx/WSCC_9bus_mult_coupled | |
- name: Run Binaries 2/2 | |
run: ./build/dpsim/examples/cxx/WSCC_9bus_mult_decoupled | |
- name: Run Binaries 2/2 | |
run: ./build/dpsim/examples/cxx/WSCC_9bus_split_decoupled | |
- name: Run Binaries 2/2 | |
run: ./build/dpsim/examples/cxx/WSCC_9bus_split_decoupled_EMT | |
cpp-check: | |
name: Scan Sourcecode with Cppcheck | |
runs-on: ubuntu-latest | |
container: sogno/dpsim:dev | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run cppcheck | |
working-directory: ${{ github.workspace }} | |
shell: bash | |
id: cppcheck | |
run: | | |
set -o pipefail | |
cppcheck --max-configs=32 -j $(nproc) --inline-suppr --error-exitcode=1 -q --enable=warning,performance,portability,information,missingInclude --std=c++17 -I dpsim/include/ -I dpsim-models/include/ -I dpsim-villas/include dpsim/src/ dpsim-models/src/ dpsim-villas/src/ 2>&1 | tee cppcheck-output.log | |
continue-on-error: true | |
- name: Print cppcheck errors | |
if: ${{ always() && steps.cppcheck.outcome == 'failure' }} | |
working-directory: ${{ github.workspace }} | |
shell: bash | |
run: (! cat cppcheck-output.log | grep -A 2 "error:") | |
- name: Print cppcheck warnings | |
if: ${{ always() && steps.cppcheck.outcome == 'failure' }} | |
working-directory: ${{ github.workspace }} | |
shell: bash | |
run: (! cat cppcheck-output.log | grep -A 2 "warning:") | |
continue-on-error: true | |
- name: Print cppcheck performance | |
if: ${{ always() && steps.cppcheck.outcome == 'failure' }} | |
working-directory: ${{ github.workspace }} | |
shell: bash | |
run: (! cat cppcheck-output.log | grep -A 2 "performance:") | |
continue-on-error: true | |
- name: Print cppcheck portability | |
if: ${{ always() && steps.cppcheck.outcome == 'failure' }} | |
working-directory: ${{ github.workspace }} | |
shell: bash | |
run: (! cat cppcheck-output.log | grep -A 2 "portability:") | |
continue-on-error: true | |
- name: Print cppcheck missingInclude | |
if: ${{ always() && steps.cppcheck.outcome == 'failure' }} | |
working-directory: ${{ github.workspace }} | |
shell: bash | |
run: (! cat cppcheck-output.log | grep -A 2 "missingInclude:") | |
continue-on-error: true | |
- name: Print cppcheck information | |
if: ${{ always() && steps.cppcheck.outcome == 'failure' }} | |
working-directory: ${{ github.workspace }} | |
shell: bash | |
run: (! cat cppcheck-output.log | grep -A 2 "information:") | |
continue-on-error: true | |
- name: Print cppcheck notes | |
if: ${{ always() && steps.cppcheck.outcome == 'failure' }} | |
working-directory: ${{ github.workspace }} | |
shell: bash | |
run: (! cat cppcheck-output.log | grep -A 2 "note:") | |
continue-on-error: true | |
- name: Archive cppcheck output | |
uses: actions/upload-artifact@v3 | |
if: ${{ always() && steps.cppcheck.outcome == 'failure' }} | |
with: | |
name: cppcheck-output | |
path: cppcheck-output.log | |
test-villas-examples-1: | |
name: Run dpsim-mqtt VILLASnode example | |
needs: [linux-fedora-examples] | |
uses: ./.github/workflows/run_villas_example.yaml | |
with: | |
compose_file_path: examples/villas/docker-compose-tests | |
container_commands: | | |
docker exec dpsim-compose-dpsim-1 /bin/bash -c "pip install paho-mqtt" | |
docker exec dpsim-compose-mqtt-1 mosquitto_sub -t "/dpsim-mqtt" -u wildcard -v& | |
docker exec dpsim-compose-dpsim-1 /bin/bash -c "cd /dpsim && python3 /dpsim/examples/villas/dpsim-mqtt-producer.py"& | |
docker exec dpsim-compose-dpsim-1 /bin/bash -c "cd /dpsim && python3 /dpsim/examples/villas/dpsim-mqtt.py" | |
test-villas-examples-2: | |
name: Run dpsim-mqtt-import-export VILLASnode example | |
needs: [linux-fedora-examples] | |
uses: ./.github/workflows/run_villas_example.yaml | |
with: | |
compose_file_path: examples/villas/docker-compose-tests | |
container_commands: | | |
docker exec dpsim-compose-mqtt-1 mosquitto_sub -t "#" -u wildcard -v& | |
docker exec dpsim-compose-dpsim-1 /bin/bash -c "cd /dpsim && python3 /dpsim/examples/villas/dpsim-mqtt-import-export.py" | |
test-villas-examples-3: | |
name: Run dpsim-mqtt-import-export-MIMO VILLASnode example | |
needs: [linux-fedora-examples] | |
uses: ./.github/workflows/run_villas_example.yaml | |
with: | |
compose_file_path: examples/villas/docker-compose-tests | |
continue_on_error: true | |
container_commands: | | |
docker exec dpsim-compose-mqtt-1 mosquitto_sub -t "#" -u wildcard -v& | |
docker exec dpsim-compose-dpsim-1 /bin/bash -c "cd /dpsim && python3 /dpsim/examples/villas/dpsim-mqtt-import-export-MIMO.py" | |
test-villas-examples-4: | |
name: Run dpsim-file VILLASnode example | |
needs: [linux-fedora-examples] | |
uses: ./.github/workflows/run_villas_example.yaml | |
with: | |
compose_file_path: examples/villas/docker-compose-tests | |
continue_on_error: true | |
container_commands: | | |
docker exec dpsim-compose-dpsim-1 /bin/bash -c "sleep 3 && tail -f /dpsim/logs/output.csv"& | |
docker exec dpsim-compose-dpsim-1 /bin/bash -c "cd /dpsim && python3 /dpsim/examples/villas/dpsim-file.py" | |
test-villas-examples-5: | |
name: Run mqtt-cigre-mv-pf-profiles VILLASnode example | |
needs: [linux-fedora-examples] | |
uses: ./.github/workflows/run_villas_example.yaml | |
with: | |
compose_file_path: examples/villas/docker-compose-tests | |
container_commands: | | |
docker exec dpsim-compose-mqtt-1 mosquitto_sub -t "#" -u wildcard -v& | |
docker exec dpsim-compose-dpsim-1 /bin/bash -c "cd /dpsim && python3 /dpsim/examples/villas/dpsim-mqtt-cigre-mv-pf-profiles.py" |