Skip to content

Commit

Permalink
Add code coverage argument in ci script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Algiane committed Apr 9, 2024
1 parent f3c00b3 commit c6b4cbb
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 13 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/long-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ on:
# Default value if no value is explicitly provided
default: 'master'
required: false
code_coverage:
type: boolean
# Default value if no value is explicitly provided
default: true
required: false


# job
jobs:
Expand All @@ -26,3 +32,4 @@ jobs:
cmake_build_type: RelWithAssert
add_cmake_cfg_args: -D LONG_TESTS=ON
branch_name: ${{github.event.inputs.branch}}
code_coverage: true
52 changes: 39 additions & 13 deletions .github/workflows/main-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ on:
required: false
type: string

code_coverage:
description: 'Code coverage'
required: false
type: boolean

# job
jobs:
ci:
Expand Down Expand Up @@ -141,6 +146,22 @@ jobs:
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
- name: Print options and set environment variables
run: |
echo "${{ github.event.inputs.name }}:
Expand All @@ -149,7 +170,7 @@ jobs:
Scotch: ${{ matrix.scotch }},
VTK: ${{ matrix.vtk }},
int: ${{ matrix.int }},
Build: ${{ inputs.cmake_build_type }}"
Build: ${{ env.BUILD_TYPE }}"
# gfortran compiler and scotch makefile depends on the os
if [ "$RUNNER_OS" == "macOS" ]; then
Expand All @@ -170,9 +191,14 @@ jobs:
- name: Set environment variables for output comparison
if: "! contains(github.event.head_commit.message, '[skip output comparison]')"
run: |
echo "C_FLG=\"-DCMAKE_C_FLAGS=-DMMG_COMPARABLE_OUTPUT\"" >> "$GITHUB_ENV"
echo "C_FLG=-DMMG_COMPARABLE_OUTPUT" >> "$GITHUB_ENV"
echo "MMG_ERROR_RULE=\"COMMAND_ERROR_IS_FATAL ANY\"" >> "$GITHUB_ENV"
- name: Assign CMAKE_C_FLAGS if needed
if: ${{ env.C_FLG || env.C_FLG_PROF }}
run: |
echo "CMAKE_C_FLG=-DCMAKE_C_FLAGS=\"${{ env.C_FLG }} ${{ env.C_FLG_PROF }}\"" >> "$GITHUB_ENV"
- name: Install VTK
# Download vtk only if used
if: matrix.vtk == 'on'
Expand Down Expand Up @@ -235,11 +261,11 @@ jobs:
- name: Test compilation with shared libs linkage
run: |
cmake -Smmg -Bbuild_shared \
${{ env.C_FLG }} \
${{ env.CMAKE_C_FLG }} \
${{ env.FORT_FLG }} \
-DCI_CONTEXT=ON \
-DBUILD_TESTING=ON \
-DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DMMG_PATTERN=${{ matrix.pattern }} \
-DUSE_SCOTCH=${{ matrix.scotch }} \
-DSCOTCH_DIR=scotch \
Expand All @@ -251,7 +277,7 @@ jobs:
-DTEST_LIBMMG2D=ON \
-DTEST_LIBMMG3D=ON \
${{ inputs.add_cmake_cfg_args }}
cmake --build build_shared --config ${{ inputs.cmake_build_type }} -j ${{ env.NJOBS }}
cmake --build build_shared --config ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}
shell: bash

#- name: Test compilation without library linkage
Expand All @@ -261,7 +287,7 @@ jobs:
# ${{ env.FORT_FLG }} \
# -DCI_CONTEXT=ON \
# -DBUILD_TESTING=ON \
# -DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} \
# -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
# -DMMG_PATTERN=${{ matrix.pattern }} \
# -DUSE_SCOTCH=${{ matrix.scotch }} \
# -DSCOTCH_DIR=scotch \
Expand All @@ -272,7 +298,7 @@ jobs:
# -DLIBMMG2D_STATIC=OFF \
# -DLIBMMG3D_STATIC=OFF \
# ${{ inputs.add_cmake_cfg_args }}
# cmake --build build_nolibs --config ${{ inputs.cmake_build_type }} -j ${{ env.NJOBS }}
# cmake --build build_nolibs --config ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}
# shell: bash
#
#- name: Configure Mmg with static libs (default behaviour)
Expand All @@ -283,7 +309,7 @@ jobs:
# -DCMAKE_INSTALL_PREFIX=mmg-install \
# -DCI_CONTEXT=ON \
# -DBUILD_TESTING=ON \
# -DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} \
# -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
# -DMMG_PATTERN=${{ matrix.pattern }} \
# -DUSE_SCOTCH=${{ matrix.scotch }} \
# -DSCOTCH_DIR=scotch \
Expand All @@ -298,10 +324,10 @@ jobs:
#
#- name: Build Mmg
# run: |
# cmake --build build --config ${{ inputs.cmake_build_type }} -j ${{ env.NJOBS }}
# cmake --build build --config ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}
#- name: Install Mmg
# run: |
# cmake --build build --target install --config ${{ inputs.cmake_build_type }} -j ${{ env.NJOBS }}
# cmake --build build --target install --config ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}
#
#- name: Archive production artifacts
# uses: actions/upload-artifact@v3
Expand All @@ -315,20 +341,20 @@ jobs:
# if: matrix.vtk == 'off' && matrix.int == 'int32_t'
# run: |
# cd build
# ctest --timeout 7200 -VV -C ${{ inputs.cmake_build_type }} -j ${{ env.NJOBS }}
# ctest --timeout 7200 -VV -C ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}
#
#- name: Test Mmg with in64_t integers
# # Run long tests only on ubuntu with pattern off, scotch on, vtk on and int64_t integers
# if: matrix.os == 'ubuntu-20.04' && matrix.pattern == 'off' && matrix.scotch == 'on' && matrix.vtk == 'on' && matrix.int == 'int64_t'
# run: |
# cd build
# ctest --timeout 7200 -VV -C ${{ inputs.cmake_build_type }} -j ${{ env.NJOBS }}
# ctest --timeout 7200 -VV -C ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}
#
#- name: Test non native I/Os of Mmg
# if: matrix.vtk == 'on'
# run: |
# cd build
# ctest -R "msh|vtk" -VV -C ${{ inputs.cmake_build_type }} -j ${{ env.NJOBS }}
# ctest -R "msh|vtk" -VV -C ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}

# - name: Archive production artifacts for tests
# if: success() || failure()
Expand Down

0 comments on commit c6b4cbb

Please sign in to comment.