Skip to content

Commit

Permalink
Update pipeline (#5)
Browse files Browse the repository at this point in the history
* Update pipeline

Signed-off-by: ClemensLinnhoff <[email protected]>

* Update readme badge

Signed-off-by: ClemensLinnhoff <[email protected]>

* Fix unit and integration tests

Signed-off-by: ClemensLinnhoff <[email protected]>

---------

Signed-off-by: ClemensLinnhoff <[email protected]>
  • Loading branch information
ClemensLinnhoff authored Jul 12, 2023
1 parent 59c8b08 commit 442b574
Show file tree
Hide file tree
Showing 23 changed files with 515 additions and 72 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ name: Build
on:
workflow_call:

env:
FMU_FILE_NAME: OSMPCameraSensor.fmu #TODO: Adjust to file name of your FMU

jobs:
build:
name: Build FMU
Expand All @@ -31,7 +28,7 @@ jobs:
- name: Build ProtoBuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
working-directory: protobuf-21.12
run: ./configure DIST_LANG=cpp --disable-shared CXXFLAGS="-fPIC" && make
run: ./configure DIST_LANG=cpp --disable-shared CXXFLAGS="-fPIC" && make -j4

- name: Install ProtoBuf
working-directory: protobuf-21.12
Expand All @@ -46,19 +43,24 @@ jobs:

- name: Build C++
working-directory: build
run: cmake --build .
run: cmake --build . -j4 --config Release

- name: Create FMU Directory
working-directory: build
run: mkdir /tmp/model_fmu

- name: Copy Model FMU
working-directory: build
run: cp $FMU_FILE_NAME /tmp/model_fmu/SensorModel.fmu
run: cp ${{ github.event.repository.name }}.fmu /tmp/model_fmu/${{ github.event.repository.name }}.fmu

- name: Cache Model FMU
id: cache-model-fmu
uses: actions/cache@v3
with:
path: /tmp/model_fmu
key: ${{ runner.os }}-model-fmu
key: ${{ runner.os }}-model-fmu

- name: Commit ID
run: |
echo "Commit ID: "
echo $(git rev-parse --short HEAD)
77 changes: 77 additions & 0 deletions .github/workflows/build_esmini.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build esmini FMU

on:
workflow_call:

jobs:
build_esmini:
name: Build esmini FMU
runs-on: ubuntu-latest

steps:
- name: Cache esmini FMU
id: cache-esmini-fmu
uses: actions/cache@v3
with:
path: /tmp/esmini_fmu
key: ${{ runner.os }}-esmini-fmu

- name: Get esmini
if: steps.cache-esmini-fmu.outputs.cache-hit != 'true'
run: git clone https://github.com/esmini/esmini.git

- name: Checkout dev Branch
if: steps.cache-esmini-fmu.outputs.cache-hit != 'true'
working-directory: esmini
run: git checkout dev

- name: Update Submodules
if: steps.cache-esmini-fmu.outputs.cache-hit != 'true'
working-directory: esmini
run: git submodule update --init

- name: Fetch Dependencies
if: steps.cache-esmini-fmu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y build-essential gdb ninja-build git pkg-config libgl1-mesa-dev libpthread-stubs0-dev libjpeg-dev libxml2-dev libpng-dev libtiff5-dev libgdal-dev libpoppler-dev libdcmtk-dev libgtk2.0-dev libcairo2-dev libpoppler-glib-dev libxrandr-dev libxinerama-dev curl cmake
- name: Build esmini
if: steps.cache-esmini-fmu.outputs.cache-hit != 'true'
working-directory: esmini
run: |
mkdir build
cd build
cmake ..
cmake --build . --config Release --target install -j4
- name: Build esmini FMU
if: steps.cache-esmini-fmu.outputs.cache-hit != 'true'
working-directory: esmini/OSMP_FMU
run: |
mkdir build
cd build
cmake ..
cmake --build . --config Release
- name: Create esmini FMU Directory
if: steps.cache-esmini-fmu.outputs.cache-hit != 'true'
run: mkdir /tmp/esmini_fmu

- name: Copy Commit ID to Cache
if: steps.cache-esmini-fmu.outputs.cache-hit != 'true'
working-directory: esmini
run: |
git rev-parse --short HEAD > commit-id.txt
cp commit-id.txt /tmp/esmini_fmu/commit-id.txt
- name: Copy esmini FMU
if: steps.cache-esmini-fmu.outputs.cache-hit != 'true'
working-directory: esmini/OSMP_FMU/build
run: cp EsminiOsiSource.fmu /tmp/esmini_fmu/EsminiOsiSource.fmu

- name: Commit ID
working-directory: /tmp/esmini_fmu
run: |
echo "Commit ID: "
echo $(cat commit-id.txt)
13 changes: 12 additions & 1 deletion .github/workflows/build_openmcx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,18 @@ jobs:
if: steps.cache-openmcx.outputs.cache-hit != 'true'
run: git clone https://github.com/eclipse/openmcx.git

- name: Copy Commit ID to Cache
if: steps.cache-openmcx.outputs.cache-hit != 'true'
working-directory: openmcx
run: git rev-parse --short HEAD > commit-id.txt

- name: Build OpenMCx
if: steps.cache-openmcx.outputs.cache-hit != 'true'
working-directory: openmcx
run: ./build.sh
run: ./build.sh

- name: Commit ID
working-directory: openmcx
run: |
echo "Commit ID: "
echo $(cat commit-id.txt)
19 changes: 16 additions & 3 deletions .github/workflows/build_osi_field_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Build ProtoBuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
working-directory: protobuf-21.12
run: ./configure DIST_LANG=cpp --disable-shared CXXFLAGS="-fPIC" && make
run: ./configure DIST_LANG=cpp --disable-shared CXXFLAGS="-fPIC" && make -j4

- name: Install ProtoBuf
working-directory: protobuf-21.12
Expand Down Expand Up @@ -53,14 +53,27 @@ jobs:
- name: Build C++
if: steps.cache-osi-field-checker.outputs.cache-hit != 'true'
working-directory: sl-1-5-sensor-model-testing/build
run: cmake --build .
run: cmake --build . -j4

- name: Create FMU Directory
if: steps.cache-osi-field-checker.outputs.cache-hit != 'true'
working-directory: sl-1-5-sensor-model-testing/build
run: mkdir /tmp/osi-field-checker

- name: Copy Commit ID to Cache
if: steps.cache-osi-field-checker.outputs.cache-hit != 'true'
working-directory: sl-1-5-sensor-model-testing
run: |
git rev-parse --short HEAD > commit-id.txt
cp commit-id.txt /tmp/osi-field-checker/commit-id.txt
- name: Copy OSI Field Checker FMU
if: steps.cache-osi-field-checker.outputs.cache-hit != 'true'
working-directory: sl-1-5-sensor-model-testing/build
run: cp OSIFieldChecker.fmu /tmp/osi-field-checker/OSIFieldChecker.fmu
run: cp OSIFieldChecker.fmu /tmp/osi-field-checker/OSIFieldChecker.fmu

- name: Commit ID
working-directory: /tmp/osi-field-checker
run: |
echo "Commit ID: "
echo $(cat commit-id.txt)
37 changes: 25 additions & 12 deletions .github/workflows/build_tracefile_player.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,51 @@ jobs:
working-directory: protobuf-21.12
run: sudo make install && sudo ldconfig

- name: Cache Tracefile FMU
id: cache-tracefile-fmu
- name: Cache Tracefile Player FMU
id: cache-tracefile-player-fmu
uses: actions/cache@v3
with:
path: /tmp/tracefile_fmu
key: ${{ runner.os }}-tracefile-fmu
path: /tmp/tracefile_player_fmu
key: ${{ runner.os }}-tracefile-player-fmu

- name: Get Tracefile Player
if: steps.cache-tracefile-fmu.outputs.cache-hit != 'true'
if: steps.cache-tracefile-player-fmu.outputs.cache-hit != 'true'
run: git clone https://gitlab.com/persival-open-source/open-simulation-interface/osi-trace-file-player.git

- name: Prepare C++ Build
if: steps.cache-tracefile-fmu.outputs.cache-hit != 'true'
if: steps.cache-tracefile-player-fmu.outputs.cache-hit != 'true'
working-directory: osi-trace-file-player
run: git submodule update --init && mkdir build

- name: Configure CMake
if: steps.cache-tracefile-fmu.outputs.cache-hit != 'true'
if: steps.cache-tracefile-player-fmu.outputs.cache-hit != 'true'
working-directory: osi-trace-file-player/build
run: cmake -DCMAKE_PREFIX_PATH:PATH=${DEPS_DIR}/protobuf/install ..

- name: Build C++
if: steps.cache-tracefile-fmu.outputs.cache-hit != 'true'
if: steps.cache-tracefile-player-fmu.outputs.cache-hit != 'true'
working-directory: osi-trace-file-player/build
run: cmake --build .

- name: Create FMU Directory
if: steps.cache-tracefile-fmu.outputs.cache-hit != 'true'
if: steps.cache-tracefile-player-fmu.outputs.cache-hit != 'true'
working-directory: osi-trace-file-player/build
run: mkdir /tmp/tracefile_fmu
run: mkdir /tmp/tracefile_player_fmu

- name: Copy Commit ID to Cache
if: steps.cache-tracefile-player-fmu.outputs.cache-hit != 'true'
working-directory: osi-trace-file-player
run: |
git rev-parse --short HEAD > commit-id.txt
cp commit-id.txt /tmp/tracefile_player_fmu/commit-id.txt
- name: Copy Tracefile FMU
if: steps.cache-tracefile-fmu.outputs.cache-hit != 'true'
if: steps.cache-tracefile-player-fmu.outputs.cache-hit != 'true'
working-directory: osi-trace-file-player/build
run: cp src/OSMPTraceFilePlayer.fmu /tmp/tracefile_fmu/OSMPTraceFilePlayer.fmu
run: cp src/OSMPTraceFilePlayer.fmu /tmp/tracefile_player_fmu/OSMPTraceFilePlayer.fmu

- name: Commit ID
working-directory: /tmp/tracefile_player_fmu
run: |
echo "Commit ID: "
echo $(cat commit-id.txt)
78 changes: 78 additions & 0 deletions .github/workflows/build_tracefile_writer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build Tracefile Writer

on:
workflow_call:

jobs:
build_tracefile_player:
name: Build Tracefile Writer FMU
runs-on: ubuntu-latest

steps:
- name: Cache Protobuf
id: cache-protobuf
uses: actions/cache@v3
with:
path: protobuf-21.12
key: ${{ runner.os }}-protobuf

- name: Download ProtoBuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
run: curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protobuf-all-21.12.tar.gz && tar xzvf protobuf-all-21.12.tar.gz

- name: Build ProtoBuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
working-directory: protobuf-21.12
run: ./configure DIST_LANG=cpp --disable-shared CXXFLAGS="-fPIC" && make

- name: Install ProtoBuf
working-directory: protobuf-21.12
run: sudo make install && sudo ldconfig

- name: Cache Tracefile Writer FMU
id: cache-tracefile-writer-fmu
uses: actions/cache@v3
with:
path: /tmp/tracefile_writer_fmu
key: ${{ runner.os }}-tracefile-writer-fmu

- name: Get Tracefile Player
if: steps.cache-tracefile-writer-fmu.outputs.cache-hit != 'true'
run: git clone https://github.com/Persival-GmbH/osi-sensordata-trace-file-writer.git

- name: Prepare C++ Build
if: steps.cache-tracefile-writer-fmu.outputs.cache-hit != 'true'
working-directory: osi-sensordata-trace-file-writer
run: git submodule update --init && mkdir build

- name: Configure CMake
if: steps.cache-tracefile-writer-fmu.outputs.cache-hit != 'true'
working-directory: osi-sensordata-trace-file-writer/build
run: cmake -DCMAKE_PREFIX_PATH:PATH=${DEPS_DIR}/protobuf/install ..

- name: Build C++
if: steps.cache-tracefile-writer-fmu.outputs.cache-hit != 'true'
working-directory: osi-sensordata-trace-file-writer/build
run: cmake --build .

- name: Create FMU Directory
if: steps.cache-tracefile-writer-fmu.outputs.cache-hit != 'true'
run: mkdir /tmp/tracefile_writer_fmu

- name: Copy Commit ID to Cache
if: steps.cache-tracefile-writer-fmu.outputs.cache-hit != 'true'
working-directory: osi-sensordata-trace-file-writer
run: |
git rev-parse --short HEAD > commit-id.txt
cp commit-id.txt /tmp/tracefile_writer_fmu/commit-id.txt
- name: Copy Tracefile Writer FMU
if: steps.cache-tracefile-writer-fmu.outputs.cache-hit != 'true'
working-directory: osi-sensordata-trace-file-writer/build
run: cp osi-sensordata-trace-file-writer.fmu /tmp/tracefile_writer_fmu/osi-sensordata-trace-file-writer.fmu

- name: Commit ID
working-directory: /tmp/tracefile_writer_fmu
run: |
echo "Commit ID: "
echo $(cat commit-id.txt)
5 changes: 1 addition & 4 deletions .github/workflows/cl0.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: Credibility Assessment Level 0

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_call:

jobs:
check-spdx-headers:
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/cl1.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
name: Credibility Assessment Level 1

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_call:

jobs:
build_model:
name: Build Model
uses: ./.github/workflows/build.yml

fmu-artifact:
needs: build_model
name: FMU Artifact
uses: ./.github/workflows/fmu_artifact.yml

fmu-checker:
needs: build_model
name: FMU Compliance Checker
uses: ./.github/workflows/fmu_checker.yml

cpp-linter:
name: C++ Linter
uses: ./.github/workflows/cpp-linter.yml
Expand All @@ -19,6 +26,10 @@ jobs:
name: Markdown Linter
uses: ./.github/workflows/markdown.yml

srmd-validator:
name: SRMD Validator
uses: ./.github/workflows/srmd-validator.yml

unit-tests:
name: Unit Tests
uses: ./.github/workflows/unit-tests.yml
Loading

0 comments on commit 442b574

Please sign in to comment.