@@ -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
0 commit comments