diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml new file mode 100644 index 000000000..de1af05c9 --- /dev/null +++ b/.github/workflows/code-cov.yml @@ -0,0 +1,165 @@ +name: Code coverage + +on: + # run tests on push events + push: + # run tests on PR events + pull_request: + types: [opened, synchronize] + + +jobs: + coverage: + if: "! contains(github.event.head_commit.message, '[skip ci]')" + runs-on: ubuntu-20.04 + + strategy: + fail-fast: true + matrix: + pattern: [on,off] + pointmap: [off] + scotch: [on,off] + vtk: [off] + int: [int32_t] + + include: + # test vtk only without scotch and with delaunay insertion (more + # tests are useless) + - pattern: off + pointmap: off + scotch: off + vtk: on + int: int32_t + + # Test pointmap with scotch, with and without patterns + - pattern: off + pointmap: on + scotch: on + vtk: off + int: int32_t + + - pattern: on + pointmap: on + scotch: on + vtk: off + int: int32_t + + # Add builds for int64 + - pattern: on + pointmap: on + scotch: on + vtk: on + int: int64_t + + - pattern: off + pointmap: off + scotch: on + vtk: on + int: int64_t + + + steps: + - name: Print options and set environment variables + run: | + echo "Job parameters: + Pattern: ${{ matrix.pattern }}, + Pointmap: ${{ matrix.pointmap }}, + Scotch: ${{ matrix.scotch }}, + VTK: ${{ matrix.vtk }}, + int: ${{ matrix.int }}" + + - 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 + + - 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 + run: | + git clone https://github.com/ISCDtoolbox/Commons.git + cd Commons + mkdir build + cd build + cmake .. + make install + + - name: Install LinearElasticity + run: | + git clone https://github.com/ISCDtoolbox/LinearElasticity.git + cd LinearElasticity + mkdir build + cd build + cmake .. + make install + + # checkout the provided branch name if workflow is manually run + - uses: actions/checkout@v3 + if: inputs.branch_name + with: + ref: ${{github.event.inputs.branch}} + path: mmg + + # checkout the event branch for automatic workflows + - uses: actions/checkout@v3 + if: inputs.branch_name == '' + with: + path: mmg + + + - name: Configure Mmg with static libs (default behaviour) + run: | + cmake -Smmg -Bbuild \ + -DCMAKE_C_FLAGS=-fprofile-arcs -ftest-coverage \ + -DCMAKE_Fortran_COMPILER=gfortran-9 \ + -DCMAKE_INSTALL_PREFIX=mmg-install \ + -DCI_CONTEXT=ON \ + -DBUILD_TESTING=ON \ + -DCMAKE_BUILD_TYPE=Debug \ + -DMMG_PATTERN=${{ matrix.pattern }} \ + -DUSE_SCOTCH=${{ matrix.scotch }} \ + -DSCOTCH_DIR=scotch \ + -DUSE_VTK=${{ matrix.vtk }} \ + -DMMG5_INT=${{ matrix.int }} \ + -DTEST_LIBMMG=ON \ + -DTEST_LIBMMGS=ON \ + -DTEST_LIBMMG2D=ON \ + -DTEST_LIBMMG3D=ON \ + -DONLY_VERY_SHORT_TESTS + shell: bash + + - name: Build Mmg + run: | + cmake --build build --config Debug -j 4 + + - name: Install Mmg + run: | + cmake --build build --target install --config Debug -j 4 + + - name: Test Mmg + run: | + cd build + ctest --timeout 7200 -VV -C Debug -j 4 + + + - name: Upload coverage to Codecov + if: inputs.CODE_COVERAGE + uses: codecov/codecov-action@v4.0.1 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + + diff --git a/.github/workflows/long-tests.yml b/.github/workflows/long-tests.ymlold similarity index 100% rename from .github/workflows/long-tests.yml rename to .github/workflows/long-tests.ymlold diff --git a/.github/workflows/main-job.yml b/.github/workflows/main-job.ymlold similarity index 100% rename from .github/workflows/main-job.yml rename to .github/workflows/main-job.ymlold