From 7e51a5eae006e492c51a94ffb7009396dbc1e5bc Mon Sep 17 00:00:00 2001 From: Jacob Williams Date: Sun, 3 Apr 2022 08:21:42 -0500 Subject: [PATCH 1/2] added codecov to CI --- .github/workflows/CI.yml | 34 +++++++++++++++++++++++----------- README.md | 3 ++- codecov.yml | 13 +++++++++++++ 3 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 792def1..a1a3bd1 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -43,19 +43,31 @@ jobs: - name: Install GFortran Linux if: contains( matrix.os, 'ubuntu') run: | - sudo add-apt-repository ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install -y gcc-${GCC_V} gfortran-${GCC_V} - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \ - --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \ - --slave /usr/bingcov gcov /usr/bin/gcov-${GCC_V} - # sudo apt-get install -y libblas-dev liblapack-dev + sudo apt-get install lcov + sudo update-alternatives \ + --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc_v }} 100 \ + --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ matrix.gcc_v }} \ + --slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.gcc_v }} - - name: Compile - run: fpm build --profile release + # - name: Compile + # run: fpm build --profile release - - name: Run test - run: fpm test + - name: Run tests + run: fpm test --profile debug --flag -coverage + + - name: Create coverage report + run: | + mkdir -p ${{ env.COV_DIR }} + lcov --capture --initial --base-directory . --directory build/gfortran_*/ --output-file ${{ env.COV_DIR }}/coverage.base + lcov --capture --base-directory . --directory build/gfortran_*/ --output-file ${{ env.COV_DIR }}/coverage.capture + lcov --add-tracefile ${{ env.COV_DIR }}/coverage.base --add-tracefile ${{ env.COV_DIR }}/coverage.capture --output-file ${{ env.COV_DIR }}/coverage.info + env: + COV_DIR: build/coverage + + - name: Upload coverage report + uses: codecov/codecov-action@v2 + with: + files: build/coverage/coverage.info - name: Build documentation run: ford ./fortran-csv-module.md diff --git a/README.md b/README.md index 27c142f..03e31e8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ ![fortran-csv-module](/media/logo.png) ============ -![Build Status](https://github.com/jacobwilliams/fortran-csv-module/actions/workflows/CI.yml/badge.svg) +![CI Status](https://github.com/jacobwilliams/fortran-csv-module/actions/workflows/CI.yml/badge.svg) +[![codecov](https://codecov.io/gh/jacobwilliams/fortran-csv-module/branch/master/graph/badge.svg?token=43HK33CSMY)](https://codecov.io/gh/jacobwilliams/fortran-csv-module) ### Description diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..a26265b --- /dev/null +++ b/codecov.yml @@ -0,0 +1,13 @@ +comment: + layout: header, changes, diff, sunburst +coverage: + ignore: + - test + - doc + status: + patch: + default: + target: 20% + project: + default: + target: 60% From 01614fd497ef1ac3dbeb5c1b3d44851348d08470 Mon Sep 17 00:00:00 2001 From: Jacob Williams Date: Sun, 3 Apr 2022 08:25:08 -0500 Subject: [PATCH 2/2] target 70% --- codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codecov.yml b/codecov.yml index a26265b..ad55d96 100644 --- a/codecov.yml +++ b/codecov.yml @@ -7,7 +7,7 @@ coverage: status: patch: default: - target: 20% + target: 70% project: default: target: 60%