forked from CRPropa/CRPropa3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request CRPropa#461 from JulienDoerner/actions_clean
Update Github Actions
- Loading branch information
Showing
7 changed files
with
198 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: create-documentation | ||
on: [workflow_dispatch] | ||
|
||
jobs: | ||
create-documentation: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- name: "ubuntu-20" | ||
os: ubuntu-20.04 | ||
cxx: "g++-9" | ||
cc: "gcc-9" | ||
fc: "gfortran-9" | ||
swig_builtin: "Off" #uses swig 4.0.1 | ||
|
||
# define steps to take | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Python install | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
cache: 'pip' # caching pip dependencies | ||
- 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 sphinx_rtd_theme m2r2 nbsphinx 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 -DENABLE_TESTING=ON -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} \ | ||
-DSIMD_EXTENSIONS=native -DBUILD_DOC=True -DENABLE_COVERAGE=True | ||
- 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: build documentation | ||
run: | | ||
cd build | ||
make doc | ||
tar -zcvf documentation.tar.gz doc | ||
- name: archive documentation | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: "documentation" | ||
path: | | ||
build/documentation.tar.gz | ||
build/coverage.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: crpropa-example-test | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
linux: | ||
runs-on: ${{ matrix.config.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- name: "ubuntu-20" | ||
os: ubuntu-20.04 | ||
cxx: "g++-9" | ||
cc: "gcc-9" | ||
fc: "gfortran-9" | ||
swig_builtin: "Off" #uses swig 4.0.1 | ||
py: "/usr/bin/python3" #python 3.8 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Preinstall | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libmuparser-dev python3-dev python-dev python3-numpy python-numpy python3-setuptools python-setuptools libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov | ||
pip3 install -r doc/pages/example_notebooks/requirements.txt # load requrements for notebooks | ||
pip3 install --upgrade Pygments | ||
pip3 install --upgrade numpy | ||
- 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=Off -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS=native | ||
- name: Build CRPropa | ||
run: | | ||
cd build | ||
make install -j | ||
- name: convert notebooks to python | ||
env: | ||
PYTHONPATH: "/home/runner/.local/lib/python3.8/site-packages/" | ||
runfolder: "/home/runner/notebook_run" | ||
run: | | ||
mkdir "$runfolder" | ||
cd doc/pages/example_notebooks/ | ||
for file in */*.ipynb; do | ||
echo "$file" | ||
if [ -f "$file" ]; then | ||
f=(${file//// }) | ||
f=${f[1]} | ||
f=(${f//./}) | ||
finalFile="$runfolder"/"$f".py | ||
echo "convert notebook $file to script $finalFile" | ||
jupyter nbconvert --to python "$file" --stdout | grep -v -e "^get_ipython" > "$runfolder"/"$f".py | ||
fi | ||
done | ||
- name: run all python scripts | ||
env: | ||
PYTHONPATH: "$/home/runner/.local/lib/python3.8/site-packages/" | ||
runfolder: "/home/runner/notebook_run" | ||
run: | | ||
cp doc/pages/example_notebooks/galactic_lensing/crpropa_output.txt "$runfolder"/ | ||
cd "$runfolder" | ||
for file in *.py; do | ||
if [ "$file" = "custom-photon-fieldipynb.py" ] || | ||
[ "$file" = "MHD_modelsipynb.py" ] || | ||
[ "$file" = "density_grid_samplingipynb.py" ] || | ||
[ "$file" = "lensing_crv4ipynb.py" ] || | ||
[ "$file" = "lensing_mapsv4ipynb.py" ]; then | ||
echo "skip file $file" | ||
else | ||
echo "run file $file" | ||
python3 $file | ||
fi | ||
done |
11 changes: 11 additions & 0 deletions
11
doc/pages/example_notebooks/galactic_lensing/crpropa_output.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# taken from https://github.com/CRPropa/CRPropa3/blob/2577c47ad898db13ce3b17c153e700041f304da4/galactic_lensing/crpropa_output.txt | ||
1552.209 1000010010 1000260560 6.3094 1137.0405 118.8033 117.3283 120.0056 198.3873 -48.1072 250.9588 0.23085 0.06390 -0.97089 -0.76661 0.63718 -0.07947 0.000 | ||
1553.387 1000010010 1000260560 6.3049 1137.0405 119.3010 117.8840 119.3933 198.3873 -48.1072 250.9588 -0.52969 0.57890 -0.61993 -0.76661 0.63718 -0.07947 0.000 | ||
1552.209 1000010010 1000260560 6.3094 1137.0405 118.8033 117.3283 120.0056 198.3873 -48.1072 250.9588 0.23085 0.06390 -0.97089 -0.76661 0.63718 -0.07947 0.000 | ||
1553.387 1000010010 1000260560 6.3049 1137.0405 119.3010 117.8840 119.3933 198.3873 -48.1072 250.9588 -0.52969 0.57890 -0.61993 -0.76661 0.63718 -0.07947 0.000 | ||
2507.574 1000010010 1000020040 5.7274 157.5835 119.0234 117.9255 118.5094 64.1676 230.1578 58.0133 -0.24543 -0.93458 -0.25754 -0.21277 0.71704 -0.66376 0.000 | ||
597.459 1000010010 1000260560 9.6493 869.9225 119.0855 117.4122 119.7995 161.5538 74.8338 161.2846 -0.80199 0.46811 0.37105 -0.20573 0.14302 0.96810 0.000 | ||
1059.588 1000010010 1000260560 17.2427 7507.9875 118.9984 117.3895 118.5193 332.7822 143.8280 378.0030 -0.19054 0.28077 0.94067 -0.18628 0.64559 -0.74061 0.000 | ||
1342.343 1000010010 1000010010 17.7414 135.4199 118.9361 118.4267 118.8868 125.1438 25.9860 115.6526 0.01002 -0.98594 -0.16682 0.04910 -0.03836 -0.99806 0.000 | ||
140.527 1000010010 1000070140 50.7971 6946.8090 117.6596 117.8698 119.9085 173.0595 28.5316 197.1513 -0.17251 0.29795 -0.93886 -0.18122 0.95242 -0.24506 0.000 | ||
792.198 1000010010 1000070140 23.8203 765.9928 118.0031 117.7912 118.2653 221.2443 140.1373 120.6517 0.97493 0.06808 -0.21183 0.79843 0.58276 0.15130 0.000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# collection of all packages used in the analyis of the example notebooks. This is used for the automatic test of the notebooks | ||
numpy | ||
matplotlib | ||
pandas | ||
healpy | ||
seaborn | ||
scipy | ||
tqdm | ||
h5py | ||
jupyter |
Oops, something went wrong.