Skip to content

Move environment.yml to binder directory. #2474

Move environment.yml to binder directory.

Move environment.yml to binder directory. #2474

name: Build & Test Fedora
on:
push:
pull_request:
types: [opened, synchronize, reopened]
## Build ##
jobs:
linux-fedora-dpsimpy:
name: Build dpsimpy on Fedora Linux
runs-on: ubuntu-latest
container: sogno/dpsim:dev
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Create Build Environment
run: mkdir build
- 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
env:
MAKEFLAGS: "-j2"
- name: Archive build directory
uses: actions/upload-artifact@v2
with:
path: ${{ github.workspace }}/build
name: build-cache
retention-days: 1
linux-fedora-examples:
name: Build Cxx examples on Fedora Linux
runs-on: ubuntu-latest
needs: [linux-fedora-dpsimpy]
container: sogno/dpsim:dev
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Restore build archive
uses: actions/download-artifact@v3
with:
name: build-cache
path: ${{ github.workspace }}/build
- name: Build every target
shell: bash
working-directory: ${{ github.workspace }}/build
run: cmake --build .
env:
MAKEFLAGS: "-j2"
- name: Archive build directory
uses: actions/upload-artifact@v2
with:
path: ${{ github.workspace }}/build
name: build-cache
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@v2
- name: Restore build archive
uses: actions/download-artifact@v3
with:
name: build-cache
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: Run pytest
shell: bash
working-directory: ${{ github.workspace }}
env:
PYTHONPATH: "${{ github.workspace }}/build"
run: |
cp -r python/src/dpsim build/
pytest -v examples/Notebooks
- name: Archive notebook outputs
uses: actions/upload-artifact@v2
with:
name: pytest-output
path: outputs/examples/Notebooks/
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@v3
with:
name: pytest-output
path: ${{ github.workspace }}/notebooks-new
- name: Download master notebook results
uses: actions/cache@v2
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@v2
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 Example
runs-on: ubuntu-latest
container: sogno/dpsim:dev
needs: [linux-fedora-examples]
steps:
- name: Restore build archive
uses: actions/download-artifact@v3
with:
name: build-cache
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
cpp-check:
name: Scan Sourcecode with Cppcheck
runs-on: ubuntu-latest
container: sogno/dpsim:dev
#needs: [linux-fedora]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run cppcheck
working-directory: ${{ github.workspace }}
shell: bash
id: cppcheck
run: |
set -o pipefail
cppcheck --max-configs=32 -j 32 --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@v2
if: ${{ always() && steps.cppcheck.outcome == 'failure' }}
with:
name: cppcheck-output
path: cppcheck-output.log