Skip to content

Commit 7e7ac4c

Browse files
slayoojcurtis2
andauthored
add code coverage analysis using codecov.io (#212)
Co-authored-by: Jeffrey Curtis <jcurtis2@illinois.edu>
1 parent 3428a60 commit 7e7ac4c

11 files changed

Lines changed: 61 additions & 16 deletions

File tree

.github/actions/codecov/action.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 'Upload Coverage Report'
2+
description: 'Generates and uploads code coverage to Codecov'
3+
4+
inputs:
5+
codecov_token:
6+
description: 'Codecov upload token'
7+
required: true
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Generate coverage report
13+
run: docker run -v shared-data:/build -v $(pwd):/codecov -t partmc-test bash -c "lcov --capture --directory /build --output-file /codecov/coverage.info --no-external"
14+
shell: bash
15+
16+
- name: Upload coverage report to codecov.io
17+
uses: codecov/codecov-action@v5.5.0
18+
with:
19+
token: ${{ inputs.codecov_token }}
20+
fail_ci_if_error: true
21+

.github/workflows/camp.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ jobs:
1212
- name: Build the testing docker image
1313
run: docker build -f Dockerfile.camp -t partmc-test .
1414
- name: Run the tests in the docker container
15-
run: docker run -t partmc-test bash -c 'cd /build; make test'
15+
run: docker run -v shared-data:/build -t partmc-test bash -c 'cd /build; make test'
16+
- name: Generate and upload coverage report
17+
uses: ./.github/actions/codecov
18+
with:
19+
codecov_token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/cloud_parcel.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v1
1212
- name: Build the testing docker image
13-
run: docker build -f Dockerfile.cloud_parcel -t partmc-cloud-parcel .
13+
run: docker build -f Dockerfile.cloud_parcel -t partmc-test .
1414
- name: Run the tests in the docker container
15-
run: docker run -t partmc-cloud-parcel bash -c 'cd /build; make test'
15+
run: docker run -v shared-data:/build -t partmc-test bash -c 'cd /build; make test'
16+
- name: Generate and upload coverage report
17+
uses: ./.github/actions/codecov
18+
with:
19+
codecov_token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ jobs:
1212
- name: Build the testing docker image
1313
run: docker build -t partmc-test .
1414
- name: Run the tests in the docker container
15-
run: docker run -t partmc-test bash -c 'cd /build; make test'
15+
run: docker run -v shared-data:/build -t partmc-test bash -c 'cd /build; make test'
16+
- name: Generate and upload coverage report
17+
uses: ./.github/actions/codecov
18+
with:
19+
codecov_token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/mpi.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ jobs:
1212
- name: Build the testing docker image
1313
run: docker build -f Dockerfile.mpi -t partmc-test .
1414
- name: Run the tests in the docker container
15-
run: docker run -t partmc-test bash -c 'cd /build; CTEST_OUTPUT_ON_FAILURE=1 OMPI_MCA_rmaps_base_oversubscribe=false make test'
15+
run: docker run -v shared-data:/build -t partmc-test bash -c 'cd /build; CTEST_OUTPUT_ON_FAILURE=1 OMPI_MCA_rmaps_base_oversubscribe=false make test'
16+
- name: Generate and upload coverage report
17+
uses: ./.github/actions/codecov
18+
with:
19+
codecov_token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/tchem.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ jobs:
1212
- name: Build the testing docker image
1313
run: docker build -f Dockerfile.tchem -t partmc-test .
1414
- name: Run the tests in the docker container
15-
run: docker run -t partmc-test bash -c 'export CTEST_PARALLEL_LEVEL=4; cd /build; make test'
15+
run: docker run -v shared-data:/build -t partmc-test bash -c 'export CTEST_PARALLEL_LEVEL=4; cd /build; make test'
16+
- name: Generate and upload coverage report
17+
uses: ./.github/actions/codecov
18+
with:
19+
codecov_token: ${{ secrets.CODECOV_TOKEN }}

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ RUN dnf -y update \
99
netcdf-fortran-devel \
1010
gsl-devel \
1111
cmake \
12+
lcov \
1213
&& dnf clean all
1314

1415
# NOTE: Modify .dockerignore to whitelist files/directories to copy.
@@ -17,8 +18,8 @@ COPY . /partmc/
1718
RUN mkdir /build \
1819
&& cd /build \
1920
&& cmake -D CMAKE_BUILD_TYPE=release \
20-
-D CMAKE_C_FLAGS_RELEASE="-O2 -g -Werror -Wall -Wextra" \
21-
-D CMAKE_Fortran_FLAGS_RELEASE="-O2 -g -Werror -fimplicit-none -Wall -Wextra -Wconversion -Wunderflow -Wimplicit-interface -Wno-compare-reals -Wno-unused -Wno-unused-parameter -Wno-unused-dummy-argument -fbounds-check" \
21+
-D CMAKE_C_FLAGS_RELEASE="-O2 -g -Werror -Wall -Wextra --coverage" \
22+
-D CMAKE_Fortran_FLAGS_RELEASE="-O2 -g -Werror -fimplicit-none -Wall -Wextra -Wconversion -Wunderflow -Wimplicit-interface -Wno-compare-reals -Wno-unused -Wno-unused-parameter -Wno-unused-dummy-argument -fbounds-check --coverage" \
2223
-D ENABLE_GSL:BOOL=TRUE \
2324
/partmc \
2425
&& make

Dockerfile.camp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ RUN dnf -y update \
1212
openblas-devel \
1313
gsl-devel \
1414
cmake \
15+
lcov \
1516
&& dnf clean all
1617

1718
# Build the SuiteSparse libraries for sparse matrix support
@@ -76,8 +77,8 @@ RUN mkdir /build \
7677
&& cmake -D CMAKE_BUILD_TYPE=release \
7778
-D CMAKE_C_FLAGS_DEBUG="-g" \
7879
-D CMAKE_Fortran_FLAGS_DEBUG="-g" \
79-
-D CMAKE_C_FLAGS_RELEASE="-O2 -g -Werror -Wall -Wextra" \
80-
-D CMAKE_Fortran_FLAGS_RELEASE="-O2 -g -Werror -fimplicit-none -Wall -Wextra -Wconversion -Wunderflow -Wimplicit-interface -Wno-compare-reals -Wno-unused -Wno-unused-parameter -Wno-unused-dummy-argument -fbounds-check" \
80+
-D CMAKE_C_FLAGS_RELEASE="-O2 -g -Werror -Wall -Wextra --coverage" \
81+
-D CMAKE_Fortran_FLAGS_RELEASE="-O2 -g -Werror -fimplicit-none -Wall -Wextra -Wconversion -Wunderflow -Wimplicit-interface -Wno-compare-reals -Wno-unused -Wno-unused-parameter -Wno-unused-dummy-argument -fbounds-check --coverage" \
8182
-D ENABLE_GSL:BOOL=TRUE \
8283
-D ENABLE_CAMP:BOOL=TRUE \
8384
/partmc \

Dockerfile.cloud_parcel

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ RUN dnf -y update \
88
sundials-devel \
99
gsl-devel \
1010
cmake \
11+
lcov \
1112
&& dnf clean all
1213

1314
# NOTE: Modify .dockerignore to whitelist files/directories to copy.
@@ -16,8 +17,8 @@ COPY . /partmc/
1617
RUN mkdir /build \
1718
&& cd /build \
1819
&& cmake -D CMAKE_BUILD_TYPE=release \
19-
-D CMAKE_C_FLAGS_RELEASE="-O2 -g -Werror -Wall -Wextra" \
20-
-D CMAKE_Fortran_FLAGS_RELEASE="-O2 -g -Werror -fimplicit-none -Wall -Wextra -Wconversion -Wunderflow -Wimplicit-interface -Wno-compare-reals -Wno-unused -Wno-unused-parameter -Wno-unused-dummy-argument -fbounds-check" \
20+
-D CMAKE_C_FLAGS_RELEASE="-O2 -g -Werror -Wall -Wextra --coverage" \
21+
-D CMAKE_Fortran_FLAGS_RELEASE="-O2 -g -Werror -fimplicit-none -Wall -Wextra -Wconversion -Wunderflow -Wimplicit-interface -Wno-compare-reals -Wno-unused -Wno-unused-parameter -Wno-unused-dummy-argument -fbounds-check --coverage" \
2122
-D ENABLE_GSL:BOOL=TRUE \
2223
-D ENABLE_SUNDIALS:BOOL=TRUE \
2324
/partmc \

Dockerfile.mpi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ RUN dnf -y update \
99
gsl-devel \
1010
openmpi-devel \
1111
cmake \
12+
lcov \
1213
&& dnf clean all
1314

1415
# NOTE: Modify .dockerignore to whitelist files/directories to copy.
@@ -24,8 +25,8 @@ ENV CC=mpicc
2425
RUN mkdir /build \
2526
&& cd /build \
2627
&& cmake -D CMAKE_BUILD_TYPE=release \
27-
-D CMAKE_C_FLAGS_RELEASE="-O2 -g -Werror -Wall -Wextra" \
28-
-D CMAKE_Fortran_FLAGS_RELEASE="-O2 -g -Werror -fimplicit-none -Wall -Wextra -Wconversion -Wunderflow -Wimplicit-interface -Wno-compare-reals -Wno-unused -Wno-unused-parameter -Wno-unused-dummy-argument -fbounds-check" \
28+
-D CMAKE_C_FLAGS_RELEASE="-O2 -g -Werror -Wall -Wextra --coverage" \
29+
-D CMAKE_Fortran_FLAGS_RELEASE="-O2 -g -Werror -fimplicit-none -Wall -Wextra -Wconversion -Wunderflow -Wimplicit-interface -Wno-compare-reals -Wno-unused -Wno-unused-parameter -Wno-unused-dummy-argument -fbounds-check --coverage" \
2930
-D ENABLE_GSL:BOOL=TRUE \
3031
-D ENABLE_MPI:BOOL=TRUE \
3132
/partmc \

0 commit comments

Comments
 (0)