diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index 8cbf8aa2d..038e79aa3 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -23,53 +23,167 @@ jobs: vtk: [off] int: [int32_t] + #include: + # # test vtk only without scotch and with delaunay insertion (more + # # tests are useless) + # - os: ubuntu-20.04 + # pattern: off + # pointmap: off + # scotch: off + # vtk: on + # int: int32_t + # + # - os: macos-12 + # pattern: off + # pointmap: off + # scotch: off + # vtk: on + # int: int32_t + # + # # Test pointmap with scotch except on windows + # - os: ubuntu-20.04 + # pattern: off + # pointmap: on + # scotch: on + # vtk: off + # int: int32_t + # + # - os: macos-12 + # pattern: off + # pointmap: on + # scotch: on + # vtk: off + # int: int32_t + # + # # Add windows basic test (matrix is not testable as dependencies + # # don't build with MSVC) + # - os: windows-2022 + # pattern: off + # pointmap: off + # scotch: off + # vtk: off + # int: int32_t + # + # - os: windows-2022 + # pattern: on + # pointmap: off + # scotch: off + # vtk: off + # int: int32_t + # + # # Add test for pointmap only if pattern off + # - os: windows-2022 + # pattern: off + # pointmap: on + # scotch: off + # vtk: off + # int: int32_t + # + # # Test int64_t build on all archi, and try to cover all code + # - os: ubuntu-20.04 + # pattern: on + # pointmap: on + # scotch: on + # vtk: on + # int: int64_t + # + # - os: ubuntu-20.04 + # pattern: off + # pointmap: off + # scotch: on + # vtk: on + # int: int64_t + # + # - os: ubuntu-20.04 + # pattern: off + # pointmap: off + # scotch: off + # vtk: off + # int: int64_t + # + # - os: macos-12 + # pattern: on + # pointmap: on + # scotch: on + # vtk: on + # int: int64_t + # + # - os: macos-12 + # pattern: off + # pointmap: off + # scotch: off + # vtk: off + # int: int64_t + # + # - os: windows-2022 + # pattern: on + # pointmap: on + # scotch: off + # vtk: off + # int: int64_t + # + # - os: windows-2022 + # pattern: off + # pointmap: off + # scotch: off + # vtk: off + # int: int64_t + steps: + - name: Set cmake_build_type and export coverage flags + run: | + if ${{ matrix.os == 'ubuntu-20.04' && inputs.code_coverage == true }}; then + # if code coverage is enabled, linux build is runned in Debug mode + + if [[ ${{ inputs.cmake_build_type }} != Debug ]]; then + echo "WARNING: build type is forced to debug mode on ubuntu to allow coverage." + fi + + echo "BUILD_TYPE=Debug" >> "$GITHUB_ENV" + echo "C_FLG_PROF=-fprofile-arcs -ftest-coverage" >> "$GITHUB_ENV" + + else + echo "BUILD_TYPE=${{ inputs.cmake_build_type }}" >> "$GITHUB_ENV" + fi + + shell: bash + - name: Print options and set environment variables run: | - echo "Job parameters: + echo "${{ github.event.inputs.name }}: + Os: ${{ matrix.os }}, Pattern: ${{ matrix.pattern }}, - Pointmap: ${{ matrix.pointmap }}, Scotch: ${{ matrix.scotch }}, VTK: ${{ matrix.vtk }}, - int: ${{ matrix.int }}" + int: ${{ matrix.int }}, + Build: ${{ env.BUILD_TYPE }}" - - name: Install VTK - # Download vtk only if used - if: matrix.vtk == 'on' - run: | - sudo sed -i 's/azure\.//' /etc/apt/sources.list - sudo apt-get update - sudo apt-get install -y libvtk7-dev + # gfortran compiler and scotch makefile depends on the os + if [ "$RUNNER_OS" == "macOS" ]; then + echo "SCOTCH_MAKE=Make.inc/Makefile.inc.i686_mac_darwin10" >> "$GITHUB_ENV" + echo "FORT_FLG=\"-DCMAKE_Fortran_COMPILER=gfortran-11\"" >> "$GITHUB_ENV" - - name: Install Sctoch - # Download scotch only if used - if: matrix.scotch == 'on' - run: | - git clone https://gitlab.inria.fr/scotch/scotch.git - cd scotch - git checkout v6.1.3 - cd src - cp Make.inc/Makefile.inc.x86-64_pc_linux2 Makefile.inc - make scotch -j 4 - make install scotch -j 4 - - - name: Install LibCommons + elif [ "$RUNNER_OS" == "Linux" ]; then + echo "SCOTCH_MAKE=Make.inc/Makefile.inc.x86-64_pc_linux2" >> "$GITHUB_ENV" + echo "FORT_FLG=\"-DCMAKE_Fortran_COMPILER=gfortran-9\"" >> "$GITHUB_ENV" + fi + echo "NJOBS=$NJOBS" >> "$GITHUB_ENV" + # Remark: variable values are still empty inside this context + + shell: bash + env: + NJOBS: "2" + + - name: Set environment variables for output comparison + if: "! contains(github.event.head_commit.message, '[skip output comparison]')" run: | - git clone https://github.com/ISCDtoolbox/Commons.git - cd Commons - mkdir build - cd build - cmake .. - make install + echo "C_FLG=-DMMG_COMPARABLE_OUTPUT" >> "$GITHUB_ENV" + echo "MMG_ERROR_RULE=\"COMMAND_ERROR_IS_FATAL ANY\"" >> "$GITHUB_ENV" - - name: Install LinearElasticity + - name: Assign CMAKE_C_FLAGS if needed + if: ${{ env.C_FLG || env.C_FLG_PROF }} run: | - git clone https://github.com/ISCDtoolbox/LinearElasticity.git - cd LinearElasticity - mkdir build - cd build - cmake .. - make install + echo "CMAKE_C_FLG=-DCMAKE_C_FLAGS=\"${{ env.C_FLG }} ${{ env.C_FLG_PROF }}\"" >> "$GITHUB_ENV" # checkout the provided branch name if workflow is manually run - uses: actions/checkout@v3