Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/code coverage #109

Merged
merged 3 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/long-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
# run tests on PR events
pull_request:
types: [opened, synchronize]

# run tests manually on a given branch (default is master)
workflow_dispatch:
Expand All @@ -25,3 +26,5 @@ jobs:
cmake_build_type: RelWithAssert
add_cmake_cfg_args:
branch_name: ${{github.event.inputs.branch}}
code_coverage: true
secrets: inherit
62 changes: 48 additions & 14 deletions .github/workflows/main-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ on:
required: false
type: string

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

# job
jobs:
ci:
Expand Down Expand Up @@ -59,14 +65,32 @@ jobs:
additional-IOs: on

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 "${{ github.event.inputs.name }}:
Os: ${{ matrix.os }},
Pointmap:${{ matrix.pointmap }},
Scotch: ${{ matrix.scotch }},
Mpich instead of openmpi: ${{ matrix.mpich-instead-openmpi }},
Build: ${{ inputs.cmake_build_type }},
Build: ${{ env.BUILD_TYPE }},
additional-IOs: ${{matrix.additional-IOs}}"

# gfortran compiler and scotch makefile depends on the os
Expand Down Expand Up @@ -149,40 +173,40 @@ jobs:


# checkout the provided branch name if workflow is manually run
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: inputs.branch_name
with:
ref: ${{github.event.inputs.branch}}
path: ParMmg

# checkout the event branch for automatic workflows
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: inputs.branch_name == ''
with:
path: ParMmg

- name: Test compilation with shared libs linkage
run: |
cmake -SParMmg -Bbuild_shared -DCI_DIR=~/testparmmg \
${{ env.C_FLG }} \
-DCMAKE_C_FLAGS="${{ env.C_FLG_PROF }}" \
${{ env.FORT_FLG }} \
-DBUILD_TESTING=ON \
-DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DUSE_POINTMAP=${{ matrix.pointmap }} \
-DUSE_SCOTCH=${{ matrix.scotch }} \
-DSCOTCH_DIR=scotch \
-DBUILD_SHARED_LIBS=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: Configure Mmg with static libs (default behaviour)
run: |
cmake -SParMmg -Bbuild -DCI_DIR=~/testparmmg\
${{ env.C_FLG }} \
-DCMAKE_C_FLAGS="${{ env.C_FLG_PROF }}" \
${{ env.FORT_FLG }} \
-DBUILD_TESTING=ON \
-DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DUSE_POINTMAP=${{ matrix.pointmap }} \
-DUSE_SCOTCH=${{ matrix.scotch }} \
-DSCOTCH_DIR=scotch \
Expand All @@ -191,29 +215,29 @@ jobs:

- name: Build ParMmg
run: |
cmake --build build --config ${{ inputs.cmake_build_type }} -j ${{ env.NJOBS }}
cmake --build build --config ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}

- name: Install ParMmg
run: |
sudo cmake --build build --target install --config ${{ inputs.cmake_build_type }} -j ${{ env.NJOBS }}
sudo cmake --build build --target install --config ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}

- name: Archive production artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ParMmg-bin
name: ParMmg-bin-${{ matrix.os }}-${{ matrix.pointmap }}-${{ matrix.scotch }}-${{ matrix.mpich-instead-openmpi }}-${{ matrix.additional-IOs }}
path: |
build/bin

- name: Test ParMmg
run: |
cd build
ctest --timeout 7200 -VV -C ${{ inputs.cmake_build_type }} -E ${{ env.EXCLUDE_TESTS }}
ctest --timeout 7200 -VV -C ${{ env.BUILD_TYPE }} -E ${{ env.EXCLUDE_TESTS }}

- name: Test non native I/Os (requiring install of dependencies)
if: matrix.additional-IOs == 'on'
run: |
cd build
ctest -R "hdf5" -VV -C ${{ inputs.cmake_build_type }} -j ${{ env.NJOBS }}
ctest -R "hdf5" -VV -C ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}

# - name: Archive production artifacts for tests
# if: success() || failure()
Expand All @@ -222,3 +246,13 @@ jobs:
# name: ParMmg-tests
# path: |
# build/TEST_OUTPUTS

- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-20.04' && inputs.code_coverage == true
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
root_dir: .
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fixes:
- "ParMmg/ParMmg::"