-
Notifications
You must be signed in to change notification settings - Fork 1
180 lines (152 loc) · 5.8 KB
/
cl2.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Credibility Assessment Level 2
on:
workflow_call:
jobs:
build_tracefile_player:
name: Build Tracefile Player FMU
uses: ./.github/workflows/build_tracefile_player.yml
build_tracefile_writer:
name: Build Tracefile Writer FMU
uses: ./.github/workflows/build_tracefile_writer.yml
build_esmini:
name: Build esmini FMU
uses: ./.github/workflows/build_esmini.yml
build_osi_field_checker_fmu:
name: Build OSI Field Checker FMU
uses: ./.github/workflows/build_osi_field_checker.yml
build_openmcx:
name: Build OpenMCx
uses: ./.github/workflows/build_openmcx.yml
generate_integration_test_paths:
runs-on: ubuntu-latest
name: Generate Integration Test Paths
steps:
- uses: actions/checkout@v3
- name: Generate matrix with all integration tests
id: set-matrix
working-directory: test/integration
run: |
echo "matrix=$(ls -l | grep '^d' | awk -F ' ' '{print $9}' | grep -Po '\d{3}.*' | jq -R -s -c 'split("\n") | map(select(length > 0))')" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
run_integration_test:
needs: [build_tracefile_player, build_tracefile_writer, build_openmcx, build_osi_field_checker_fmu, build_esmini, generate_integration_test_paths]
name: Integration Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
path: ${{ fromJson(needs.generate_integration_test_paths.outputs.matrix) }}
steps:
- name: Print matrix path
run: echo ${{ github.workspace }}/${{ matrix.path }}
- name: Checkout Model
uses: actions/checkout@v3
with:
submodules: true
- name: Cache Protobuf
id: cache-protobuf
uses: actions/cache@v3
with:
path: protobuf-21.12
key: ${{ runner.os }}-protobuf
- name: Cache Model FMU
id: cache-model-fmu
uses: actions/cache@v3
with:
path: /tmp/model_fmu
key: ${{ runner.os }}-model-fmu-${{ github.sha }}
- name: Cache Tracefile Player FMU
id: cache-tracefile-player-fmu
uses: actions/cache@v3
with:
path: /tmp/tracefile_player_fmu
key: ${{ runner.os }}-tracefile-player-fmu
- 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: Cache esmini FMU
id: cache-esmini-fmu
uses: actions/cache@v3
with:
path: /tmp/esmini_fmu
key: ${{ runner.os }}-esmini-fmu
- name: Cache OSI Field Checker
id: cache-osi-field-checker
uses: actions/cache@v3
with:
path: /tmp/osi-field-checker
key: ${{ runner.os }}-osi-field-checker
- name: Cache OpenMCx
id: cache-openmcx
uses: actions/cache@v3
with:
path: openmcx
key: ${{ runner.os }}-openmcx
- name: Install dependencies
run: sudo apt install -y libxml2-dev zlib1g-dev libzip-dev
- name: Create Output Folder
working-directory: ./test/integration/${{ matrix.path }}
run: mkdir output
- name: Run OpenMCx
id: cosimulation
run: ./openmcx/install/openmcx ./test/integration/${{ matrix.path }}/SystemStructure.ssd
- name: Check For Trace Files
id: check-for-trace-files
working-directory: ./test/integration/${{ matrix.path }}/output
run: |
( count=`ls -1 *.osi 2>/dev/null | wc -l`
if [ $count == 0 ]; then
echo No trace file found.
echo "found_trace=0" >> $GITHUB_OUTPUT
elif [ $count == 1 ]; then
echo "found_trace=1" >> $GITHUB_OUTPUT
filename=$(ls -1 *.osi)
echo "trace_file_name=${filename}" >> $GITHUB_OUTPUT
else
echo More than one trace file.
echo "found_trace=0" >> $GITHUB_OUTPUT
fi
)
- name: Archive Trace File
if: steps.check-for-trace-files.outputs.found_trace == 1
uses: actions/upload-artifact@v3
with:
name: ${{ steps.check-for-trace-files.outputs.trace_file_name }}
path: ./test/integration/${{ matrix.path }}/output/${{ steps.check-for-trace-files.outputs.trace_file_name }}
- name: Check For Python Scripts
id: check-for-python-scripts
working-directory: ./test/integration/${{ matrix.path }}
run: |
( count=`ls -1 *.py 2>/dev/null | wc -l`
if [ $count == 0 ]; then
echo No python script found.
echo "found_script=0" >> $GITHUB_OUTPUT
elif [ $count == 1 ]; then
echo "found_script=1" >> $GITHUB_OUTPUT
filename=$(ls -1 *.py)
echo "python_file_name=${filename}" >> $GITHUB_OUTPUT
else
echo More than one trace file.
echo "found_script=0" >> $GITHUB_OUTPUT
fi
)
- name: Install ProtoBuf
working-directory: protobuf-21.12
run: sudo make install && sudo ldconfig
- name: Install Analysis Dependencies
if: steps.check-for-python-scripts.outputs.found_script == 1
working-directory: ./lib/open-simulation-interface
run: |
python3 -m pip install protobuf==4.21.12
python3 -m pip install .
- name: Run Trace File Analysis
if: steps.check-for-python-scripts.outputs.found_script == 1
working-directory: ./test/integration/${{ matrix.path }}
run: python3 ${{ steps.check-for-python-scripts.outputs.python_file_name }} output/${{ steps.check-for-trace-files.outputs.trace_file_name }}
- name: Failed?
if: steps.cosimulation.outputs.failed == 1
run: exit 1