Skip to content

Commit

Permalink
Merge pull request #481 from JulienDoerner/documentation
Browse files Browse the repository at this point in the history
Add coverage report to documentation
  • Loading branch information
lukasmerten authored Jun 4, 2024
2 parents 95ff182 + 7d4d84d commit a6dbe04
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 7 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/create_coverage_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: create-coverage-report
on: [workflow_dispatch]

jobs:
create-coverage-report:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
config:
- name: "ubuntu-22"
os: ubuntu-22.04
cxx: "g++-11"
cc: "gcc-11"
fc: "gfortran-11"
swig_builtin: "On" #uses swig 4.0.2
py: "/usr/bin/python3" #python 3.10
# define steps to take
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Prerequirements
run: |
sudo apt-get update
sudo apt-get install libmuparser-dev libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov doxygen graphviz
sudo apt-get install pandoc # do not only use pip to install pandoc, see https://stackoverflow.com/questions/62398231/building-docs-fails-due-to-missing-pandoc
pip install -r doc/pages/example_notebooks/requirements.txt # load requirements for notebooks
pip install sphinx==7.2.6 sphinx_rtd_theme m2r2 nbsphinx lxml_html_clean breathe pandoc exhale # load requirements for documentation
- name: Set up the build
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
FC: ${{ matrix.config.fc }}
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/.local -DENABLE_PYTHON=True -DPython_EXECUTABLE=${{ matrix.config.py }} -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS=native -DPython_INSTALL_PACKAGE_DIR=/home/runner/.local/ -DBUILD_DOC=OFF -DENABLE_COVERAGE=On
- name: Build CRPropa
run: |
cd build
make -j
- name: run test
run: |
cd build
make test
continue-on-error: true
- name: coverage report
run: |
cd build
make coverage
tar -zcvf coverage.tar.gz coverageReport
- name: archive documentation
uses: actions/upload-artifact@v4
with:
name: "coverage"
path: |
build/coverage.tar.gz
7 changes: 3 additions & 4 deletions .github/workflows/create_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
sudo apt-get install libmuparser-dev libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov doxygen graphviz
sudo apt-get install pandoc # do not only use pip to install pandoc, see https://stackoverflow.com/questions/62398231/building-docs-fails-due-to-missing-pandoc
pip install -r doc/pages/example_notebooks/requirements.txt # load requirements for notebooks
pip install sphinx sphinx_rtd_theme m2r2 nbsphinx lxml_html_clean breathe pandoc exhale # load requirements for documentation
pip install sphinx==7.2.6 sphinx_rtd_theme m2r2 nbsphinx lxml_html_clean breathe pandoc exhale # load requirements for documentation
- name: Set up the build
env:
CXX: ${{ matrix.config.cxx }}
Expand All @@ -50,16 +50,15 @@ jobs:
run: |
cd build
make coverage
tar -zcvf coverage.tar.gz coverageReport
- name: build documentation
run: |
cd build
make doc
tar -zcvf documentation.tar.gz doc
cp -r coverageReport doc/pages/coverageReport
tar -zcvf documentation.tar.gz doc
- name: archive documentation
uses: actions/upload-artifact@v4
with:
name: "documentation"
path: |
build/documentation.tar.gz
build/coverage.tar.gz
69 changes: 69 additions & 0 deletions .github/workflows/deploy_new_documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: deploy-documentation
on:
push:
branches:
- main
- 'releases/**'

jobs:
build-and-deploy:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
config:
- name: "ubuntu-22"
os: ubuntu-22.04
cxx: "g++-11"
cc: "gcc-11"
fc: "gfortran-11"
swig_builtin: "On" #uses swig 4.0.2
py: "/usr/bin/python3" #python 3.10

# define steps to take
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Prerequirements
run: |
sudo apt-get update
sudo apt-get install libmuparser-dev libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov doxygen graphviz
sudo apt-get install pandoc # do not only use pip to install pandoc, see https://stackoverflow.com/questions/62398231/building-docs-fails-due-to-missing-pandoc
pip install -r doc/pages/example_notebooks/requirements.txt # load requirements for notebooks
pip install sphinx==7.2.6 sphinx_rtd_theme m2r2 nbsphinx lxml_html_clean breathe pandoc exhale # load requirements for documentation
- name: Set up the build
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
FC: ${{ matrix.config.fc }}
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/.local -DENABLE_PYTHON=True -DPython_EXECUTABLE=${{ matrix.config.py }} -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS=native -DPython_INSTALL_PACKAGE_DIR=/home/runner/.local/ -DBUILD_DOC=On -DENABLE_COVERAGE=On
- name: Build CRPropa
run: |
cd build
make -j
- name: run test
run: |
cd build
make test
continue-on-error: true
- name: coverage report
run: |
cd build
make coverage
- name: build documentation
run: |
cd build
make doc
- name: move final documentation # to avoid conflict with .gitignore
run: |
mv build/doc ~/final_doc
cp -r build/coverageReport ~/final_doc/pages/coverageReport
- name: deploy documentation #deploys the documentation to the gh-pages branch
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ~/final_doc

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ lib/
share/
doc/api/

!final_doc/ # needed for deployment of the documentation

cmake/CMakeCache.txt
cmake/CMakeFiles/

Expand Down
4 changes: 1 addition & 3 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ Contents

.. toctree::
:caption: DEVEL
:maxdepth: 1
:maxdepth: 2

pages/Debugging.md
pages/Code-Coverage.md
pages/Data-files.md


3 changes: 3 additions & 0 deletions doc/pages/Code-Coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ make test
make coverage
```
The final report is in ```~/build/coverageReport/index.html```

### Coverage report of the current master branch
The coverage report of the current master branch can be accesed `by clicking here <coverageReport/index.html>`_ now.

0 comments on commit a6dbe04

Please sign in to comment.