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

Add code coverage to CI #1651

Merged
merged 7 commits into from
Jul 9, 2021
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
39 changes: 37 additions & 2 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ jobs:
- name: Install Python dependencies
run: pip install -r python/requirements.txt

- name: Install coverage
if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.6 }}
run: pip install coverage==4.5.4

- name: Install mpi4py
if: ${{ matrix.enable-mpi && steps.cache.outputs.cache-hit != true }}
run: pip install mpi4py
Expand All @@ -136,28 +140,59 @@ jobs:
echo "MEEP_VERSION=${MEEP_VERSION}" >> $GITHUB_ENV

- name: Run configure
if: ${{ !(matrix.enable-mpi == false && matrix.python-version == 3.6) }}
run: |
mkdir -p build &&
pushd build &&
../configure --enable-maintainer-mode --prefix=${HOME}/local --with-libctl=${HOME}/local/share/libctl ${MPICONF} &&
popd

- name: Run configure
if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.6 }}
run: ./configure --enable-maintainer-mode --prefix=${HOME}/local --with-libctl=${HOME}/local/share/libctl ${MPICONF}

- name: Run make
if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.6 }}
run: make ${MKCHECKFLAGS}

- name: Run make check
if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.6 }}
run: |
pushd python/ &&
make ${MKCHECKFLAGS} check &&
popd

- name: Run make distcheck
if: ${{ !(matrix.enable-mpi == false && matrix.python-version == 3.6) }}
run: |
pushd build &&
make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl ${MPICONF}" &&
popd

- name: Generate coverage report
if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.6 }}
run: |
pushd python/ &&
coverage report -i &&
coverage xml -i &&
popd

- name: Upload coverage to Codecov
if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.6 }}
uses: codecov/codecov-action@v1
with:
files: ${{ github.workspace }}/python/coverage.xml

- name: Archive C++ test logs
if: ${{ failure() && !(matrix.enable-mpi == false && matrix.python-version == 3.6) }}
uses: actions/upload-artifact@v2
if: failure()
with:
name: cpp-tests-mpi-${{ matrix.enable-mpi }}-log
path: ${{ github.workspace }}/build/meep-${{ env.MEEP_VERSION }}/_build/sub/tests/test-suite.log

- name: Archive Python test logs
if: ${{ failure() && !(matrix.enable-mpi == false && matrix.python-version == 3.6) }}
uses: actions/upload-artifact@v2
if: failure()
with:
name: py${{ matrix.python-version }}-tests-mpi-${{ matrix.enable-mpi }}-log
path: ${{ github.workspace }}/build/meep-${{ env.MEEP_VERSION }}/_build/sub/python/test-suite.log
14 changes: 14 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
coverage:
status:
project:
default:
informational: true
patch:
default:
informational: true

comment:
layout: "reach, diff, files"

fixes:
- "meep/::python/"
2 changes: 1 addition & 1 deletion python/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ TESTS = \
$(WVG_SRC_TEST)

if WITH_COVERAGE
PY_LOG_COMPILER = coverage run -a --omit=$(top_srcdir)/python/tests/*,${HOME}/virtualenv/*,$(top_srcdir)/python/examples/*
PY_LOG_COMPILER = coverage run -a --source=$(top_srcdir)/python/meep --omit=$(top_srcdir)/python/tests/*,$(top_srcdir)/python/examples/*,$(top_srcdir)/python/meep/materials.py
else
PY_LOG_COMPILER = $(RUNCODE) $(PYTHON)
endif
Expand Down