Skip to content

Commit 31a3ed7

Browse files
committed
try updating omnetpp workflow
1 parent 1d36da5 commit 31a3ed7

10 files changed

Lines changed: 147 additions & 131 deletions

File tree

.github/workflows/omnetpp_generation.yml

Lines changed: 64 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ jobs:
246246
247247
compile-omnetpp-examples:
248248
name: Compile & Test OMNeT++ Examples
249-
# Note: macOS builds are disabled due to system Python install restrictions with opp_env
250249
runs-on: ubuntu-latest
250+
needs: test-generation
251251
strategy:
252252
fail-fast: false
253253
matrix:
@@ -257,68 +257,74 @@ jobs:
257257

258258
steps:
259259
- uses: actions/checkout@v4
260-
261-
- name: Install OMNeT++ dependencies
262-
run: |
263-
sudo apt-get update
264-
sudo apt-get install -y \
265-
build-essential gcc g++ bison flex perl python3 python3-pip python3-venv python3-dev \
266-
libxml2-dev zlib1g-dev cmake
267260

268-
- name: Cache OMNeT++
269-
id: cache-omnetpp
270-
uses: actions/cache@v4
261+
- name: Download generated code artifacts
262+
uses: actions/download-artifact@v4
271263
with:
272-
path: ~/omnetpp-6.2.0
273-
key: omnetpp-6.2.0-${{ runner.os }}-v2
264+
pattern: omnetpp-generated-code-*
265+
merge-multiple: true
274266

275-
- name: Download and build OMNeT++ 6.2
276-
if: steps.cache-omnetpp.outputs.cache-hit != 'true'
267+
- name: Verify generated code exists
277268
run: |
278-
cd ~
279-
wget https://github.com/omnetpp/omnetpp/releases/download/omnetpp-6.2.0/omnetpp-6.2.0-linux-x86_64.tgz
280-
tar xzf omnetpp-6.2.0-linux-x86_64.tgz
281-
cd omnetpp-6.2.0
282-
export PATH=$HOME/omnetpp-6.2.0/bin:$PATH
283-
. setenv
284-
# Create virtual environment and install Python dependencies
285-
python3 -m venv .venv
286-
source .venv/bin/activate
287-
pip install --upgrade pip
288-
pip install -r python/requirements.txt
289-
# Configure: command-line only, no GUI
290-
./configure WITH_QTENV=no WITH_OSG=no WITH_OSGEARTH=no MODE=release
291-
# Build
292-
make MODE=release -j$(nproc)
269+
echo "Checking for generated OMNeT++ examples..."
270+
ls -la examples/
271+
if [ ! -d "examples/${{ matrix.example }}" ]; then
272+
echo "ERROR: examples/${{ matrix.example }} not found"
273+
exit 1
274+
fi
275+
echo "✅ Found examples/${{ matrix.example }}"
293276
294-
- name: Build OMNeT++ project
295-
working-directory: examples/${{ matrix.example }}
277+
- name: Build and run simulation in OMNeT++ Docker container
296278
run: |
297-
export PATH=$HOME/omnetpp-6.2.0/bin:$PATH
298-
export OMNETPP_ROOT=$HOME/omnetpp-6.2.0
299-
source ~/omnetpp-6.2.0/setenv
300-
if [ -d ~/omnetpp-6.2.0/.venv ]; then source ~/omnetpp-6.2.0/.venv/bin/activate; fi
301-
mkdir -p build
302-
cd build
303-
cmake .. -DCMAKE_BUILD_TYPE=Release
304-
cmake --build . --config Release
279+
docker run --rm \
280+
-v "$(pwd):/workspace" \
281+
-w /workspace/examples/${{ matrix.example }} \
282+
-e OMNETPP_ROOT=/root/omnetpp \
283+
ghcr.io/omnetpp/omnetpp:u24.04-6.2.0 \
284+
/bin/bash -c "
285+
set -e
286+
echo 'Installing cmake...'
287+
apt-get update -qq && apt-get install -y -qq cmake > /dev/null 2>&1
288+
289+
echo 'Configuring build environment...'
290+
export PATH=\$OMNETPP_ROOT/bin:\$PATH
291+
export LD_LIBRARY_PATH=\$OMNETPP_ROOT/lib:\$LD_LIBRARY_PATH
292+
293+
echo 'Building simulation...'
294+
mkdir -p build && cd build
295+
cmake .. -DCMAKE_BUILD_TYPE=Release 2>&1 | grep -v 'CMake Warning' || true
296+
cmake --build . --config Release
297+
298+
echo 'Verifying executable...'
299+
EXECUTABLE=\$(find . -name '*.omnetpp.linux' -type f | head -1)
300+
if [ -z \"\$EXECUTABLE\" ]; then
301+
echo 'ERROR: Could not find OMNeT++ executable'
302+
echo 'Files in build directory:'
303+
ls -la
304+
echo 'Files matching pattern:'
305+
find . -name '*.omnetpp.*' -o -name '*omnetpp*'
306+
exit 1
307+
fi
308+
309+
echo \"✅ Found executable: \$EXECUTABLE\"
310+
echo ''
311+
echo '🚀 Running simulation...'
312+
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
313+
314+
cd ..
315+
EXECUTABLE=\$(find build -name '*.omnetpp.linux' -type f | head -1)
316+
cp \$EXECUTABLE .
317+
EXECUTABLE_NAME=\$(basename \$EXECUTABLE)
318+
./\$EXECUTABLE_NAME -f omnetpp.ini 2>&1 || EXIT_CODE=\$?
319+
320+
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
321+
322+
if [ -z \"\$EXIT_CODE\" ] || [ \"\$EXIT_CODE\" -eq 0 ]; then
323+
echo '✅ Simulation completed successfully!'
324+
else
325+
echo \"⚠️ Simulation exited with code: \$EXIT_CODE\"
326+
exit \$EXIT_CODE
327+
fi
328+
"
305329
306-
- name: Run simulation
307-
working-directory: examples/${{ matrix.example }}/build
308-
shell: bash
309-
run: |
310-
export PATH=$HOME/omnetpp-6.2.0/bin:$PATH
311-
export OMNETPP_ROOT=$HOME/omnetpp-6.2.0
312-
source ~/omnetpp-6.2.0/setenv
313-
if [ -d ~/omnetpp-6.2.0/.venv ]; then source ~/omnetpp-6.2.0/.venv/bin/activate; fi
314-
# Find the executable (it's named NetworkName.omnetpp.linux)
315-
EXECUTABLE=$(find . -name "*.omnetpp.linux" -type f | head -1)
316-
if [ -z "$EXECUTABLE" ]; then
317-
echo "ERROR: Could not find OMNeT++ executable"
318-
ls -la
319-
exit 1
320-
fi
321-
echo "Found executable: $EXECUTABLE"
322-
# Run short simulation with timeout
323-
timeout 10 $EXECUTABLE -u Cmdenv -c General || true
324330

examples/omnetpp_burst/BurstNetwork.ned

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
// Generated from ActorSimulation DSL
22

33
simple BurstGenerator {
4-
gates:
5-
input in;
6-
output out[1];
7-
}
4+
gates:
5+
output out[1];}
86

97

108
simple Processor {
11-
gates:
12-
input in;
13-
}
9+
gates:
10+
input in;}
1411

1512

1613
network BurstNetwork {

examples/omnetpp_burst/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ if(TARGET OmnetPP::main)
7575
# Use modern CMake targets if available
7676
target_link_libraries(BurstNetwork PRIVATE
7777
OmnetPP::main
78+
OmnetPP::cmdenv
7879
OmnetPP::envir
7980
OmnetPP::sim
8081
)
@@ -89,4 +90,8 @@ else()
8990
${OMNETPP_INCLUDE_DIRS}
9091
${CMAKE_CURRENT_SOURCE_DIR}
9192
)
93+
# Ensure shared libraries are linked properly
94+
target_link_options(BurstNetwork PRIVATE
95+
-Wl,--no-as-needed
96+
)
9297
endif()

examples/omnetpp_loadbalanced/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ if(TARGET OmnetPP::main)
7878
# Use modern CMake targets if available
7979
target_link_libraries(LoadBalancedSystem PRIVATE
8080
OmnetPP::main
81+
OmnetPP::cmdenv
8182
OmnetPP::envir
8283
OmnetPP::sim
8384
)
@@ -92,4 +93,8 @@ else()
9293
${OMNETPP_INCLUDE_DIRS}
9394
${CMAKE_CURRENT_SOURCE_DIR}
9495
)
96+
# Ensure shared libraries are linked properly
97+
target_link_options(LoadBalancedSystem PRIVATE
98+
-Wl,--no-as-needed
99+
)
95100
endif()

examples/omnetpp_loadbalanced/LoadBalancedSystem.ned

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,31 @@
11
// Generated from ActorSimulation DSL
22

33
simple Database {
4-
gates:
5-
input in;
6-
}
4+
gates:
5+
input in;}
76

87

98
simple LoadBalancer {
10-
gates:
11-
input in;
12-
output out[3];
13-
}
9+
gates:
10+
output out[3];}
1411

1512

1613
simple Server1 {
17-
gates:
18-
input in;
19-
output out[1];
20-
}
14+
gates:
15+
input in;
16+
output out[1];}
2117

2218

2319
simple Server2 {
24-
gates:
25-
input in;
26-
output out[1];
27-
}
20+
gates:
21+
input in;
22+
output out[1];}
2823

2924

3025
simple Server3 {
31-
gates:
32-
input in;
33-
output out[1];
34-
}
26+
gates:
27+
input in;
28+
output out[1];}
3529

3630

3731
network LoadBalancedSystem {

examples/omnetpp_pipeline/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ if(TARGET OmnetPP::main)
7878
# Use modern CMake targets if available
7979
target_link_libraries(PipelineNetwork PRIVATE
8080
OmnetPP::main
81+
OmnetPP::cmdenv
8182
OmnetPP::envir
8283
OmnetPP::sim
8384
)
@@ -92,4 +93,8 @@ else()
9293
${OMNETPP_INCLUDE_DIRS}
9394
${CMAKE_CURRENT_SOURCE_DIR}
9495
)
96+
# Ensure shared libraries are linked properly
97+
target_link_options(PipelineNetwork PRIVATE
98+
-Wl,--no-as-needed
99+
)
95100
endif()

examples/omnetpp_pipeline/PipelineNetwork.ned

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,31 @@
11
// Generated from ActorSimulation DSL
22

33
simple Sink {
4-
gates:
5-
input in;
6-
}
4+
gates:
5+
input in;}
76

87

98
simple Source {
10-
gates:
11-
input in;
12-
output out[1];
13-
}
9+
gates:
10+
output out[1];}
1411

1512

1613
simple Stage1 {
17-
gates:
18-
input in;
19-
output out[1];
20-
}
14+
gates:
15+
input in;
16+
output out[1];}
2117

2218

2319
simple Stage2 {
24-
gates:
25-
input in;
26-
output out[1];
27-
}
20+
gates:
21+
input in;
22+
output out[1];}
2823

2924

3025
simple Stage3 {
31-
gates:
32-
input in;
33-
output out[1];
34-
}
26+
gates:
27+
input in;
28+
output out[1];}
3529

3630

3731
network PipelineNetwork {

examples/omnetpp_pubsub/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ if(TARGET OmnetPP::main)
7777
# Use modern CMake targets if available
7878
target_link_libraries(PubSubNetwork PRIVATE
7979
OmnetPP::main
80+
OmnetPP::cmdenv
8081
OmnetPP::envir
8182
OmnetPP::sim
8283
)
@@ -91,4 +92,8 @@ else()
9192
${OMNETPP_INCLUDE_DIRS}
9293
${CMAKE_CURRENT_SOURCE_DIR}
9394
)
95+
# Ensure shared libraries are linked properly
96+
target_link_options(PubSubNetwork PRIVATE
97+
-Wl,--no-as-needed
98+
)
9499
endif()

examples/omnetpp_pubsub/PubSubNetwork.ned

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
11
// Generated from ActorSimulation DSL
22

33
simple Publisher {
4-
gates:
5-
input in;
6-
output out[3];
7-
}
4+
gates:
5+
output out[3];}
86

97

108
simple Subscriber1 {
11-
gates:
12-
input in;
13-
}
9+
gates:
10+
input in;}
1411

1512

1613
simple Subscriber2 {
17-
gates:
18-
input in;
19-
}
14+
gates:
15+
input in;}
2016

2117

2218
simple Subscriber3 {
23-
gates:
24-
input in;
25-
}
19+
gates:
20+
input in;}
2621

2722

2823
network PubSubNetwork {

0 commit comments

Comments
 (0)