more sanity checks when defining variables + extra inconsistency tests #198
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build-Linux | |
| on: | |
| push: | |
| paths-ignore: | |
| - 'doc/**' | |
| - '**.md' | |
| - '**.rst' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install system prerequisites | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libgraphviz-dev \ | |
| libboost-all-dev \ | |
| nlohmann-json3-dev \ | |
| pybind11-dev \ | |
| lcov \ | |
| gcovr \ | |
| python3-breathe \ | |
| python3-sphinx \ | |
| python3-sphinx-rtd-theme \ | |
| python3-sphinx-copybutton \ | |
| python3-sphinx-tabs \ | |
| doxygen | |
| - name: Cache SimGrid | |
| uses: actions/cache@v4 | |
| id: cache-simgrid | |
| with: | |
| path: /opt/simgrid | |
| key: ${{ runner.os }}-simgrid-python-v2 | |
| - name: Install SimGrid | |
| if: steps.cache-simgrid.outputs.cache-hit != 'true' | |
| run: | | |
| git clone --depth 1 https://framagit.org/simgrid/simgrid.git | |
| cd simgrid | |
| cmake -B build -Denable_smpi=OFF -Denable_model-checking=OFF -Denable_python=ON -DCMAKE_INSTALL_PREFIX=/opt/simgrid | |
| cmake --build build -j$(nproc) | |
| sudo cmake --install build | |
| - name: Cache FSMod | |
| uses: actions/cache@v4 | |
| id: cache-fsmod | |
| with: | |
| path: /opt/fsmod | |
| key: ${{ runner.os }}-fsmod-python-v2 | |
| - name: Install FSMod | |
| if: steps.cache-fsmod.outputs.cache-hit != 'true' | |
| run: | | |
| git clone --depth 1 https://github.com/simgrid/file-system-module.git | |
| cd file-system-module | |
| cmake -B build -Denable_lib_in_jar=OFF -Denable_sthread=OFF -Denable_python=ON -DCMAKE_INSTALL_PREFIX=/opt/fsmod -DCMAKE_PREFIX_PATH=/opt/simgrid | |
| cmake --build build -j$(nproc) | |
| sudo cmake --install build | |
| - name: Cache Google Test | |
| uses: actions/cache@v4 | |
| id: cache-gtest | |
| with: | |
| path: /opt/gtest | |
| key: ${{ runner.os }}-gtest-v1 | |
| - name: Install Google Test | |
| if: steps.cache-gtest.outputs.cache-hit != 'true' | |
| run: | | |
| wget -q https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz | |
| tar xf release-1.11.0.tar.gz | |
| cd googletest-release-1.11.0 | |
| cmake -B build -DCMAKE_INSTALL_PREFIX=/opt/gtest | |
| cmake --build build -j$(nproc) | |
| sudo cmake --install build | |
| - name: Build and test with coverage | |
| run: | | |
| # Dynamically find SimGrid Python path | |
| SIMGRID_PYTHON_PATH=$(find /opt/simgrid/lib -type d -path "*/python*/site-packages" 2>/dev/null | head -1) | |
| if [ -z "$SIMGRID_PYTHON_PATH" ]; then | |
| SIMGRID_PYTHON_PATH=$(find /opt/simgrid/lib -type d -path "*/python*/dist-packages" 2>/dev/null | head -1) | |
| fi | |
| echo "Using SimGrid Python path: $SIMGRID_PYTHON_PATH" | |
| # Dynamically find FSMod Python path | |
| FSMOD_PYTHON_PATH=$(find /opt/fsmod/lib -type d -path "*/python*/site-packages" 2>/dev/null | head -1) | |
| if [ -z "$FSMOD_PYTHON_PATH" ]; then | |
| FSMOD_PYTHON_PATH=$(find /opt/fsmod/lib -type d -path "*/python*/dist-packages" 2>/dev/null | head -1) | |
| fi | |
| echo "Using FSMod Python path: $FSMOD_PYTHON_PATH" | |
| export LD_LIBRARY_PATH=/opt/simgrid/lib:/opt/fsmod/lib:/usr/local/lib | |
| export PYTHONPATH="$SIMGRID_PYTHON_PATH:$FSMOD_PYTHON_PATH:/usr/local/lib/python3.12/dist-packages" | |
| export CMAKE_PREFIX_PATH=/opt/simgrid:/opt/fsmod:/opt/gtest | |
| cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug | |
| cmake --build build -j$(nproc) | |
| sudo cmake --install build | |
| cmake --build build --target unit_tests -j$(nproc) | |
| cd build | |
| ./unit_tests | |
| cd test/python | |
| python3 ./unit_tests_python.py | |
| cd ../.. | |
| - name: Generate coverage report | |
| run: | | |
| cd build | |
| lcov --keep-going --directory . --capture --output-file coverage.info | |
| lcov --remove coverage.info '*/test/*' '*/include/*' -o coverage.info | |
| cd .. | |
| gcovr -e test -e examples --sonarqube -u -o coverage.xml --exclude-throw-branches \ | |
| --gcov-ignore-parse-errors --exclude-unreachable-branches | |
| - name: Upload coverage to Codecov | |
| if: env.CODECOV_TOKEN != '' | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| run: | | |
| bash <(curl -s https://codecov.io/bash) -f build/coverage.info -t ${CODECOV_TOKEN} | |
| - name: SonarQube Scan | |
| if: env.SONAR_TOKEN != '' | |
| uses: SonarSource/sonarqube-scan-action@v7 | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| with: | |
| args: > | |
| -Dsonar.projectKey=simgrid_dtlmod | |
| -Dsonar.organization=simgrid | |
| -Dsonar.cfamily.compile-commands=build/compile_commands.json | |
| -Dsonar.coverageReportPaths=coverage.xml | |
| - name: Build and deploy documentation | |
| if: github.ref == 'refs/heads/main' && env.TOKEN_GITHUB != '' | |
| env: | |
| TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }} | |
| run: | | |
| cd doc | |
| LC_ALL=C.UTF-8 ./Build.sh | |
| mkdir -p $HOME/gh-pages-to-deploy | |
| cp -r build/html/* $HOME/gh-pages-to-deploy/ | |
| cd .. | |
| git config --global user.email "actions@github.com" | |
| git config --global user.name "GitHub Actions" | |
| git clone -b gh-pages https://${TOKEN_GITHUB}@github.com/simgrid/DTLMod.git gh-pages | |
| cd gh-pages | |
| cp -Rf $HOME/gh-pages-to-deploy/* . | |
| touch .nojekyll | |
| git add -f . | |
| git diff-index --quiet HEAD || git commit -m "GitHub build $GITHUB_RUN_NUMBER" | |
| git push -fq origin gh-pages | |
| echo "Done updating gh-pages!" |