From 90ac756e514a8531ca37de0e490d3fe7affc29ca Mon Sep 17 00:00:00 2001 From: Algiane Froehly Date: Fri, 12 Apr 2024 09:26:54 +0200 Subject: [PATCH 1/3] CI: Update actions, add coverage + sychronized and opened flag to PR rules. --- .github/workflows/long-tests.yml | 3 ++ .github/workflows/main-job.yml | 60 +++++++++++++++++++++++++------- codecov.yml | 3 ++ 3 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/long-tests.yml b/.github/workflows/long-tests.yml index b434ce9e..be864006 100644 --- a/.github/workflows/long-tests.yml +++ b/.github/workflows/long-tests.yml @@ -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: @@ -25,3 +26,5 @@ jobs: cmake_build_type: RelWithAssert add_cmake_cfg_args: branch_name: ${{github.event.inputs.branch}} + code_coverage: true + secrets: inherit diff --git a/.github/workflows/main-job.yml b/.github/workflows/main-job.yml index 34aaa1b4..5349b7f7 100644 --- a/.github/workflows/main-job.yml +++ b/.github/workflows/main-job.yml @@ -17,6 +17,12 @@ on: required: false type: string + code_coverage: + description: 'Code coverage' + required: false + default: true + type: boolean + # job jobs: ci: @@ -59,6 +65,24 @@ 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 }}: @@ -66,7 +90,7 @@ jobs: 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 @@ -149,7 +173,7 @@ 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}} @@ -164,25 +188,25 @@ jobs: - 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 \ @@ -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() @@ -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 }} diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..b9547418 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,3 @@ +fixes: + - "ParMmg/ParMmg::" + From fc017a15c35ed845c71f543078c158ac234cae48 Mon Sep 17 00:00:00 2001 From: Algiane Froehly Date: Fri, 12 Apr 2024 09:41:45 +0200 Subject: [PATCH 2/3] Fix missing parenthesis. --- .github/workflows/main-job.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main-job.yml b/.github/workflows/main-job.yml index 5349b7f7..627f1f58 100644 --- a/.github/workflows/main-job.yml +++ b/.github/workflows/main-job.yml @@ -188,7 +188,7 @@ jobs: - name: Test compilation with shared libs linkage run: | cmake -SParMmg -Bbuild_shared -DCI_DIR=~/testparmmg \ - -DCMAKE_C_FLAGS=${{ env.C_FLG_PROF }} \ + -DCMAKE_C_FLAGS="${{ env.C_FLG_PROF }}" \ ${{ env.FORT_FLG }} \ -DBUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ @@ -203,7 +203,7 @@ jobs: - name: Configure Mmg with static libs (default behaviour) run: | cmake -SParMmg -Bbuild -DCI_DIR=~/testparmmg\ - -DCMAKE_C_FLAGS=${{ env.C_FLG_PROF }} \ + -DCMAKE_C_FLAGS="${{ env.C_FLG_PROF }}" \ ${{ env.FORT_FLG }} \ -DBUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ From fc427f254129815298d81fdce301e861ca315fbc Mon Sep 17 00:00:00 2001 From: Algiane Froehly Date: Fri, 12 Apr 2024 10:32:30 +0200 Subject: [PATCH 3/3] Missing update of action-checkout versin. --- .github/workflows/main-job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main-job.yml b/.github/workflows/main-job.yml index 627f1f58..49f9c894 100644 --- a/.github/workflows/main-job.yml +++ b/.github/workflows/main-job.yml @@ -180,7 +180,7 @@ jobs: path: ParMmg # checkout the event branch for automatic workflows - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 if: inputs.branch_name == '' with: path: ParMmg