This repository has been archived by the owner on Aug 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
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 #7 from fusion-energy/develop
adding CI to the repo
- Loading branch information
Showing
8 changed files
with
353 additions
and
1 deletion.
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,22 @@ | ||
# Builds a dockerimage and then runs tests from within the docker enviroment | ||
|
||
name: CI with docker build | ||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build and test with Docker | ||
run: | | ||
docker build -t paramak-neutronics --build-arg cq_version=2.1 --build-arg compile_cores=2 . | ||
docker run --rm paramak-neutronics /bin/bash -c "bash run_tests.sh" |
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,29 @@ | ||
|
||
# This CI will lauch a Docker image that contains all the dependencies required | ||
# within that image the pytest test suite is run | ||
|
||
|
||
name: CI with install | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
- main | ||
|
||
jobs: | ||
testing: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ghcr.io/fusion-energy/paramak-neutronics:dependencies | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: install package | ||
run: | | ||
python setup.py install | ||
- name: run tests | ||
run: | | ||
bash run_tests.sh | ||
curl -s https://codecov.io/bash |
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,70 @@ | ||
# This yml file will trigger a Github Action on release creation. | ||
# This Action will build and upload a Docker image to GHCR | ||
# https://github.com/marketplace/actions/publish-docker | ||
|
||
name: docker-publish-release | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build_and_push_dependencies: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
target: dependencies | ||
tags: ghcr.io/fusion-energy/paramak-neutronics:dependencies | ||
build-args: | | ||
cq_version=2.1 | ||
compile_cores=2 | ||
build_and_push_release: | ||
runs-on: ubuntu-latest | ||
needs: build_and_push_dependencies | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: ghcr.io/fusion-energy/paramak-neutronics | ||
build-args: | | ||
cq_version=2.1 | ||
compile_cores=2 |
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,176 @@ | ||
# This Dockerfile creates an enviroment / dependancies needed to run the | ||
# paramank_neutronics package. | ||
|
||
# This dockerfile provides an API endpoint that accepts arguments to drive | ||
# the neutronics model production and subsequent simulation | ||
|
||
# To build this Dockerfile into a docker image: | ||
# docker build -t paramank_neutronics . | ||
|
||
# To build this Dockerfile and use multiple cores to compile: | ||
# docker build -t paramank_neutronics --build-arg compile_cores=7 . | ||
|
||
# To run the resulting Docker image: | ||
# docker run -it paramank_neutronics | ||
|
||
# Run with the following command for a jupyter notebook interface | ||
# docker run -p 8888:8888 ukaea/paramak /bin/bash -c "jupyter notebook --notebook-dir=/examples --ip='*' --port=8888 --no-browser --allow-root" | ||
|
||
|
||
# TODO save build time by basing this on FROM ghcr.io/fusion-energy/paramak:latest | ||
# This can't be done currently as the base images uses conda installs for moab / dagmc which don't compile with OpenMC | ||
FROM continuumio/miniconda3:4.9.2 as dependencies | ||
|
||
ARG compile_cores=1 | ||
|
||
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 \ | ||
PATH=/opt/openmc/bin:$PATH \ | ||
LD_LIBRARY_PATH=/opt/openmc/lib:$LD_LIBRARY_PATH \ | ||
CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \ | ||
DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update -y && \ | ||
apt-get upgrade -y | ||
|
||
RUN apt-get install -y libgl1-mesa-glx \ | ||
libgl1-mesa-dev \ | ||
libglu1-mesa-dev \ | ||
freeglut3-dev \ | ||
libosmesa6 \ | ||
libosmesa6-dev \ | ||
libgles2-mesa-dev \ | ||
curl && \ | ||
apt-get clean | ||
|
||
# Installing CadQuery | ||
RUN conda install -c conda-forge -c python python=3.8 && \ | ||
conda install -c conda-forge -c cadquery cadquery=2.1 && \ | ||
pip install jupyter-cadquery==2.1.0 && \ | ||
conda clean -afy | ||
|
||
|
||
# Install neutronics dependencies from Debian package manager | ||
RUN apt-get install -y \ | ||
wget \ | ||
git \ | ||
gfortran g++ cmake \ | ||
mpich \ | ||
libmpich-dev \ | ||
libhdf5-serial-dev \ | ||
libhdf5-mpich-dev \ | ||
imagemagick | ||
|
||
|
||
# install addition packages required for MOAB | ||
RUN apt-get --yes install libeigen3-dev && \ | ||
apt-get --yes install libblas-dev && \ | ||
apt-get --yes install liblapack-dev && \ | ||
apt-get --yes install libnetcdf-dev && \ | ||
apt-get --yes install libtbb-dev && \ | ||
apt-get --yes install libglfw3-dev | ||
|
||
|
||
# Clone and install Embree | ||
RUN git clone --single-branch --branch v3.12.2 --depth 1 https://github.com/embree/embree.git && \ | ||
cd embree && \ | ||
mkdir build && \ | ||
cd build && \ | ||
cmake .. -DCMAKE_INSTALL_PREFIX=.. \ | ||
-DEMBREE_ISPC_SUPPORT=OFF && \ | ||
make -j"$compile_cores" && \ | ||
make -j"$compile_cores" install | ||
|
||
|
||
# Clone and install MOAB | ||
RUN pip install --upgrade numpy cython && \ | ||
mkdir MOAB && \ | ||
cd MOAB && \ | ||
mkdir build && \ | ||
git clone --single-branch --branch 5.2.1 --depth 1 https://bitbucket.org/fathomteam/moab.git && \ | ||
cd build && \ | ||
cmake ../moab -DENABLE_HDF5=ON \ | ||
-DENABLE_NETCDF=ON \ | ||
-DENABLE_FORTRAN=OFF \ | ||
-DENABLE_BLASLAPACK=OFF \ | ||
-DBUILD_SHARED_LIBS=OFF \ | ||
-DCMAKE_INSTALL_PREFIX=/MOAB && \ | ||
make -j"$compile_cores" && \ | ||
make -j"$compile_cores" install && \ | ||
rm -rf * && \ | ||
cmake ../moab -DENABLE_HDF5=ON \ | ||
-DENABLE_PYMOAB=ON \ | ||
-DENABLE_FORTRAN=OFF \ | ||
-DBUILD_SHARED_LIBS=ON \ | ||
-DENABLE_BLASLAPACK=OFF \ | ||
-DCMAKE_INSTALL_PREFIX=/MOAB && \ | ||
make -j"$compile_cores" && \ | ||
make -j"$compile_cores" install && \ | ||
cd pymoab && \ | ||
bash install.sh && \ | ||
python setup.py install | ||
|
||
|
||
# Clone and install Double-Down | ||
RUN git clone --single-branch --branch main https://github.com/pshriwise/double-down.git && \ | ||
cd double-down && \ | ||
mkdir build && \ | ||
cd build && \ | ||
cmake .. -DMOAB_DIR=/MOAB \ | ||
-DCMAKE_INSTALL_PREFIX=.. \ | ||
-DEMBREE_DIR=/embree && \ | ||
make -j"$compile_cores" && \ | ||
make -j"$compile_cores" install | ||
|
||
|
||
# Clone and install DAGMC | ||
RUN mkdir DAGMC && \ | ||
cd DAGMC && \ | ||
# git clone --single-branch --branch 3.2.0 --depth 1 https://github.com/svalinn/DAGMC.git && \ | ||
git clone --single-branch --branch 9b59a53311e94b8a49c8405d730aeef84f4ca3e2 --depth 1 https://github.com/svalinn/DAGMC.git && \ | ||
mkdir build && \ | ||
cd build && \ | ||
cmake ../DAGMC -DBUILD_TALLY=ON \ | ||
-DMOAB_DIR=/MOAB \ | ||
-DDOUBLE_DOWN=ON \ | ||
-DBUILD_STATIC_EXE=OFF \ | ||
-DBUILD_STATIC_LIBS=OFF \ | ||
-DCMAKE_INSTALL_PREFIX=/DAGMC/ \ | ||
-DDOUBLE_DOWN_DIR=/double-down && \ | ||
make -j"$compile_cores" install && \ | ||
rm -rf /DAGMC/DAGMC /DAGMC/build | ||
|
||
# Clone and install OpenMC with DAGMC | ||
RUN git clone --recurse-submodules https://github.com/openmc-dev/openmc.git /opt/openmc && \ | ||
cd /opt/openmc && \ | ||
mkdir build && \ | ||
cd build && \ | ||
cmake -Doptimize=on \ | ||
-Ddagmc=ON \ | ||
-DDAGMC_DIR=/DAGMC/ \ | ||
-DHDF5_PREFER_PARALLEL=on .. && \ | ||
make -j"$compile_cores" && \ | ||
make -j"$compile_cores" install && \ | ||
cd .. && \ | ||
pip install -e .[test] | ||
|
||
# installs python packages and nuclear data | ||
RUN pip install vtk && \ | ||
pip install neutronics_material_maker && \ | ||
pip install openmc_data_downloader && \ | ||
openmc_data_downloader -e all -i H3 -l ENDFB-7.1-NNDC TENDL-2019 -p neutron photon | ||
|
||
# setting enviromental varibles | ||
ENV OPENMC_CROSS_SECTIONS=/cross_sections.xml | ||
ENV PATH="/MOAB/build/bin:${PATH}" | ||
ENV PATH="/DAGMC/bin:${PATH}" | ||
|
||
RUN pip install paramak | ||
|
||
FROM dependencies as final | ||
|
||
COPY run_tests.sh run_tests.sh | ||
COPY paramak_neutronics paramak_neutronics/ | ||
COPY examples examples/ | ||
COPY setup.py setup.py | ||
COPY tests tests/ | ||
COPY README.md README.md |
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
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,25 @@ | ||
name: docs-environment | ||
|
||
channels: | ||
- conda-forge | ||
- cadquery | ||
|
||
dependencies: | ||
- pytest | ||
- plotly | ||
- scipy | ||
- numpy | ||
- matplotlib | ||
- Pillow | ||
- cadquery=2.1 | ||
- openmc | ||
- moab | ||
- pip: | ||
- neutronics-material-maker | ||
- remove_dagmc_tags | ||
- sympy | ||
- plasmaboundaries | ||
- sphinx-autodoc-typehints | ||
- sphinxcadquery | ||
- defusedxml | ||
|
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,23 @@ | ||
# .readthedocs.yml | ||
# Read the Docs configuration file | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Build documentation in the docs/ directory with Sphinx | ||
sphinx: | ||
configuration: docs/source/conf.py | ||
|
||
# Optional additional build formats | ||
# formats: | ||
|
||
# this is not needed if using conda environment | ||
# python: | ||
# version: 3.7 | ||
# install: | ||
# - requirements: requirements.txt | ||
|
||
# specify conda environment needed for build | ||
conda: | ||
environment: environment.yml |
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,7 @@ | ||
|
||
pytest tests/notebook_testing.py -v --cov=paramak_neutronics --cov-append -- --cov-report term --cov-report xml | ||
pytest tests/test_NeutronicModel.py -v --cov=paramak_neutronics --cov-append -- --cov-report term --cov-report xml | ||
pytest tests/test_Reactor_neutronics.py -v --cov=paramak_neutronics --cov-append -- --cov-report term --cov-report xml | ||
pytest tests/test_Shape_neutronics.py -v --cov=paramak_neutronics --cov-append -- --cov-report term --cov-report xml | ||
pytest tests/test_example_neutronics_simulations.py -v --cov=paramak_neutronics --cov-append -- --cov-report term --cov-report xml | ||
pytest tests/test_neutronics_utils.py -v --cov=paramak_neutronics --cov-append -- --cov-report term --cov-report xml |