diff --git a/.travis.yml b/.travis.yml index 49b6ed2d12..7ff7a15982 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,18 +8,29 @@ addons: apt: packages: - gfortran - - g++ - mpich - libmpich-dev cache: directories: - $HOME/nndc_hdf5 + - $HOME/endf-b-vii.1 env: - - OPENMC_CONFIG="check_source" - - OPENMC_CONFIG="^hdf5-debug$" - - OPENMC_CONFIG="^omp-hdf5-debug$" - - OPENMC_CONFIG="^mpi-hdf5-debug$" - - OPENMC_CONFIG="^phdf5-debug$" + global: + - FC=gfortran + - MPI_DIR=/usr + - PHDF5_DIR=/usr + - HDF5_DIR=/usr + - OMP_NUM_THREADS=2 + - OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml + - OPENMC_ENDF_DATA=$HOME/endf-b-vii.1 + - OPENMC_MULTIPOLE_LIBRARY=$HOME/multipole_lib + - PATH=$PATH:$HOME/NJOY2016/build + matrix: + - OPENMC_CONFIG="check_source" + - OPENMC_CONFIG="^hdf5-debug$" + - OPENMC_CONFIG="^omp-hdf5-debug$" + - OPENMC_CONFIG="^mpi-hdf5-debug$" + - OPENMC_CONFIG="^phdf5-debug$" # We aren't testing the check_source script so just run it with Python 3. matrix: @@ -32,37 +43,18 @@ before_install: sudo add-apt-repository ppa:nschloe/hdf5-backports -y; sudo apt-get update -q; sudo apt-get install libhdf5-serial-dev libhdf5-mpich-dev -y; - export FC=gfortran; - export MPI_DIR=/usr; - export PHDF5_DIR=/usr; - export HDF5_DIR=/usr; fi install: - if [[ $OPENMC_CONFIG != "check_source" ]]; then + ./tools/ci/travis-install-njoy.sh pip install numpy cython; pip install --upgrade pytest; pip install -e .[test]; fi before_script: - - if [[ $OPENMC_CONFIG != "check_source" ]]; then - if [[ ! -e $HOME/nndc_hdf5/cross_sections.xml ]]; then - wget https://anl.box.com/shared/static/a6sw2cep34wlz6b9i9jwiotaqoayxcxt.xz -O - | tar -C $HOME -xvJ; - fi; - export OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml; - git clone --branch=master git://github.com/smharper/windowed_multipole_library.git wmp_lib; - tar xzvf wmp_lib/multipole_lib.tar.gz; - export OPENMC_MULTIPOLE_LIBRARY=$PWD/multipole_lib; - fi + - ./tools/ci/travis-before-script.sh script: - - cd tests - - export OMP_NUM_THREADS=2 - - if [[ $OPENMC_CONFIG == "check_source" ]]; then - ./check_source.py; - else - ./run_tests.py -C $OPENMC_CONFIG -j 2 && - pytest --cov=../openmc -v unit_tests/; - fi - - cd .. + - ./tools/ci/travis-script.sh diff --git a/tools/ci/travis-before-script.sh b/tools/ci/travis-before-script.sh new file mode 100755 index 0000000000..6a56fcfe7c --- /dev/null +++ b/tools/ci/travis-before-script.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -ex +if [[ $OPENMC_CONFIG != "check_source" ]]; then + # Download NNDC HDF5 data + if [[ ! -e $HOME/nndc_hdf5/cross_sections.xml ]]; then + wget https://anl.box.com/shared/static/a6sw2cep34wlz6b9i9jwiotaqoayxcxt.xz -O - | tar -C $HOME -xvJ + fi + + # Download ENDF/B-VII.1 distribution + if [[ ! -d $HOME/endf-b-vii.1/neutrons ]]; then + wget https://anl.box.com/shared/static/4kd2gxnf4gtk4w1c8eua5fsua22kvgjb.xz -O - | tar -C $HOME -xvJ + fi + + # Download multipole library + git clone --branch=master git://github.com/smharper/windowed_multipole_library.git wmp_lib + tar -C $HOME -xzvf wmp_lib/multipole_lib.tar.gz +fi diff --git a/tools/ci/travis-install-njoy.sh b/tools/ci/travis-install-njoy.sh new file mode 100755 index 0000000000..a338cbf4b7 --- /dev/null +++ b/tools/ci/travis-install-njoy.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -ex +cd $HOME +git clone https://github.com/njoy/NJOY2016 +cd NJOY2016 +sed -i -e 's/5\.1/4.8/' CMakeLists.txt +mkdir build && cd build +cmake .. && make 2>/dev/null && sudo make install diff --git a/tools/ci/travis-script.sh b/tools/ci/travis-script.sh new file mode 100755 index 0000000000..71a3c6d746 --- /dev/null +++ b/tools/ci/travis-script.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -ex +cd tests +if [[ $OPENMC_CONFIG == "check_source" ]]; then + ./check_source.py; +else + ./run_tests.py -C $OPENMC_CONFIG -j 2 + pytest --cov=../openmc -v unit_tests/ +fi