|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main, master, develop] |
| 6 | + push: |
| 7 | + branches: [main, master, develop] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + build-type: [Release, Debug] |
| 16 | + mpi: [ON, OFF] # Enable or disable MPI |
| 17 | + cuda: [ON, OFF] # Enable or disable CUDA |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Install system dependencies |
| 24 | + run: | |
| 25 | + sudo apt-get update |
| 26 | + sudo apt-get install -y \ |
| 27 | + build-essential \ |
| 28 | + cmake \ |
| 29 | + libomp-dev \ |
| 30 | + libopenmpi-dev \ |
| 31 | + openmpi-bin \ |
| 32 | + openmpi-common \ |
| 33 | + libopenmpi-dev |
| 34 | +
|
| 35 | + - name: Setup Python |
| 36 | + uses: actions/setup-python@v4 |
| 37 | + with: |
| 38 | + python-version: "3.12" |
| 39 | + |
| 40 | + - name: Install Python dependencies |
| 41 | + run: | |
| 42 | + python -m pip install --upgrade pip |
| 43 | + pip install numpy==2.2.6 mpi4py==4.0.3 |
| 44 | +
|
| 45 | + - name: Create build directory |
| 46 | + run: mkdir build |
| 47 | + |
| 48 | + - name: Configure CMake |
| 49 | + run: | |
| 50 | + cd build |
| 51 | + cmake .. \ |
| 52 | + -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \ |
| 53 | + -DODYSSEY_MPI=${{ matrix.mpi }} \ |
| 54 | + -DSING_CUDA=${{ matrix.cuda }} \ |
| 55 | + -DBUILD_PYTHON=ON \ |
| 56 | + -DBUILD_BENCHMARK=ON \ |
| 57 | + -DBUILD_DEMO=ON \ |
| 58 | + -DDEBUG_MSG=ON |
| 59 | +
|
| 60 | + - name: Build project |
| 61 | + run: | |
| 62 | + cd build |
| 63 | + make -j$(nproc) |
| 64 | +
|
| 65 | + - name: Run tests |
| 66 | + run: | |
| 67 | + cd build |
| 68 | + ctest --output-on-failure --verbose |
| 69 | +
|
| 70 | + - name: Run individual test executables (fallback) |
| 71 | + if: failure() |
| 72 | + run: | |
| 73 | + cd build |
| 74 | + # List all test executables and run them individually |
| 75 | + find . -name "test_*" -type f -executable | while read test_exe; do |
| 76 | + echo "Running $test_exe" |
| 77 | + if ! $test_exe --gtest_output=xml:${test_exe##*/}_results.xml; then |
| 78 | + echo "Test $test_exe failed" |
| 79 | + exit 1 |
| 80 | + fi |
| 81 | + done |
0 commit comments