GitHub build 142 #143
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 | |
| env: | |
| BUILD_WRAPPER_OUT_DIR: bw-outputs | |
| steps: | |
| - uses: actions/checkout@master | |
| with: | |
| fetch-depth: 0 | |
| - name: Install prereqs | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgraphviz-dev libboost-all-dev nlohmann-json3-dev pybind11-dev | |
| - name: Install SimGrid | |
| run: | | |
| git clone https://framagit.org/simgrid/simgrid.git | |
| cd simgrid | |
| mkdir build | |
| cd build | |
| cmake -Denable_smpi=OFF -Denable_model-checking=OFF .. | |
| make -j4 | |
| sudo make install | |
| - name: Install FSMod | |
| run: | | |
| git clone https://github.com/simgrid/file-system-module.git | |
| cd file-system-module | |
| mkdir build | |
| cd build | |
| cmake .. -Denable_lib_in_jar=OFF -Denable_sthread=OFF | |
| make -j4 | |
| sudo make install | |
| - name: Install Google Tests | |
| run: | | |
| wget 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 . | |
| make -j4 | |
| sudo make install | |
| - name: Install lcov and gcovr | |
| run: | | |
| sudo apt-get -y install lcov gcovr | |
| - name: Run tests, compute coverage | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| run: | | |
| git clone https://github.com/simgrid/DTLMod.git | |
| cd DTLMod | |
| mkdir build | |
| cd build | |
| cmake .. | |
| make -j4 | |
| sudo make install | |
| make -j4 unit_tests | |
| ./unit_tests | |
| export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" | |
| export PYTHONPATH="/usr/local/lib/python3.12/dist-packages/" | |
| cd test/python | |
| python ./unit_tests_python.py | |
| cd ../.. | |
| lcov --keep-going --directory . --capture --output-file coverage.info | |
| lcov --remove coverage.info '*/test/*' '*/include/*' | |
| bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_TOKEN} | |
| - name: Install sonar-scanner and build-wrapper | |
| uses: SonarSource/sonarcloud-github-c-cpp@v2 | |
| - name: Run build-wrapper | |
| run: | | |
| mkdir build | |
| cmake -S . -B build | |
| build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ --config Release | |
| - name: Run tests to generate coverage statistics | |
| run: | | |
| cd build | |
| make -j4 unit_tests | |
| ./unit_tests | |
| export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" | |
| export PYTHONPATH="/usr/local/lib/python3.12/dist-packages/" | |
| cd test/python | |
| python ./unit_tests_python.py | |
| cd ../.. | |
| - name: Collect coverage into one XML report | |
| run: | | |
| gcovr -e test -e examples --sonarqube -u -o coverage.xml --exclude-throw-branches \ | |
| --gcov-ignore-parse-errors --exclude-unreachable-branches | |
| - name: Run sonar-scanner | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| run: | | |
| sonar-scanner --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" \ | |
| --define sonar.coverageReportPaths=coverage.xml | |
| - name: Install Doxygen and Sphinx | |
| run: | | |
| sudo apt-get install -y python3-breathe python3-sphinx python3-sphinx-rtd-theme python3-sphinx-copybutton python3-sphinx-tabs | |
| sudo apt-get -y install doxygen | |
| - name: Build and Deploy Documentation | |
| env: | |
| TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }} | |
| run: | | |
| cd DTLMod/build | |
| cmake .. | |
| echo "Building documentation..." | |
| cd ../doc | |
| LC_ALL=C.UTF-8 ./Build.sh | |
| mkdir $HOME/gh-pages-to-deploy | |
| cp -r build/html/* $HOME/gh-pages-to-deploy/ | |
| cd .. | |
| echo "Updating gh-pages branch..." | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "GitHub Actions" | |
| echo "git clone -q -b gh-pages https://${TOKEN_GITHUB}@github.com/simgrid/DTLMod.git gh-pages" | |
| git clone -b gh-pages https://${TOKEN_GITHUB}@github.com/simgrid/DTLMod.git gh-pages > /dev/null | |
| 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 > /dev/null | |
| echo "Done updating gh-pages!" |