Skip to content

Commit

Permalink
Merge pull request #5 from fusion-energy/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
shimwell authored Jun 22, 2021
2 parents 48b4217 + 0d22014 commit 817f373
Show file tree
Hide file tree
Showing 184 changed files with 11,380 additions and 7,655 deletions.
19 changes: 2 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,7 @@ jobs:
- run:
name: install
command: |
python setup.py install # this dosen't support the optional packages like pip install .[neutronics] does
- run:
name: run neutronics_utils tests
command:
pytest tests/test_neutronics_utils.py -v --cov=paramak --cov-report term --cov-report xml --junitxml=test-reports/junit.xml

- run:
name: run neutronics_example tests
command:
pytest tests/test_example_neutronics_simulations.py -v --cov=paramak --cov-report term --cov-report xml --junitxml=test-reports/junit.xml
python setup.py install
- run:
name: run utils tests
Expand Down Expand Up @@ -55,11 +45,6 @@ jobs:
command:
pytest tests/test_parametric_reactors/ -v --cov=paramak --cov-append --cov-report term --cov-report xml --junitxml=test-reports/junit.xml

- run:
name: run neutronics tests
command:
pytest tests/test_parametric_neutronics/ -v --cov=paramak --cov-append --cov-report term --cov-report xml --junitxml=test-reports/junit.xml

- run:
name: run example shape tests
command:
Expand All @@ -73,7 +58,7 @@ jobs:
- run:
name: run example reactor tests
command:
pytest tests/test_example_reactors.py -v --cov=paramak --cov-append --cov-report term --cov-report xml --junitxml=test-reports/junit.xml
pytest --capture=tee-sys tests/test_example_reactors.py -v --cov=paramak --cov-append --cov-report term --cov-report xml --junitxml=test-reports/junit.xml

- store_test_results:
path: test-reports
Expand Down
4 changes: 0 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,3 @@ _Put an `x` in the boxes that apply. You can also fill these out after creating
- [ ] Unit tests pass locally with my changes
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)

## Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...
17 changes: 0 additions & 17 deletions .github/workflows/docker_ci.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/docker_ci_develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

name: CI - Develop
on:
pull_request:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cadquery-version: [2.1]
include-neutronics: [true]

steps:
- uses: actions/checkout@v1
- name: Build and test with Docker
run: |
docker build -t paramak --build-arg include_neutronics=${{ matrix.include-neutronics }} --build-arg cq_version=${{ matrix.cadquery-version}} --build-arg compile_cores=2 .
docker run --rm paramak /bin/bash -c "bash run_tests.sh include_neutronics=${{ matrix.include-neutronics }} && curl -s https://codecov.io/bash | bash"
21 changes: 21 additions & 0 deletions .github/workflows/docker_ci_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

name: CI - Main
on:
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cadquery-version: [2.1, master]
include-neutronics: [true]

steps:
- uses: actions/checkout@v1
- name: Build and test with Docker
run: |
docker build -t paramak --build-arg include_neutronics=${{ matrix.include-neutronics }} --build-arg cq_version=${{ matrix.cadquery-version}} --build-arg compile_cores=2 .
docker run --rm paramak /bin/bash -c "bash run_tests.sh include_neutronics=${{ matrix.include-neutronics }} && curl -s https://codecov.io/bash | bash"
4 changes: 2 additions & 2 deletions .github/workflows/dockerhub-publish-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ jobs:
id: docker_build
uses: docker/build-push-action@v2
with:
file: DockerfileDependencies
push: true
tags: ukaea/paramak:dependencies
target: dependencies
build-args: |
cq_version=master
cq_version=2.1
compile_cores=2
include_neutronics=true
-
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/dockerhub-publish-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This yml file will trigger a Github Action on pushes to the main branch.
# This Action will build and upload a Docker image to Dockerhub
# https://github.com/marketplace/actions/publish-docker

name: dockerhub-publish-dev

on:
push:
branches: develop

jobs:
main:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: ukaea/paramak:dev
build-args: |
cq_version=2.1
compile_cores=2
include_neutronics=true
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
8 changes: 5 additions & 3 deletions .github/workflows/dockerhub-publish-geometry-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
# This Action will build and upload a Docker image to Dockerhub
# https://github.com/marketplace/actions/publish-docker

name: dockerhub-publish-dev
name: dockerhub-publish-geometry-dependencies

on:
push:
branches: develop
branches:
- develop
- main

jobs:
main:
Expand All @@ -32,7 +34,7 @@ jobs:
push: true
tags: ukaea/paramak:geometry-dependencies
build-args: |
cq_version=master
cq_version=2.1
compile_cores=2
include_neutronics=false
-
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dockerhub-publish-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
tags: ukaea/paramak:latest
tags: ukaea/paramak:stable
build-args: |
cq_version=master
cq_version=2.1
compile_cores=2
include_neutronics=true
-
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
name: Upload Python Package

on:
push:
branches:
- main
release:
types: [created]

jobs:
deploy:
Expand All @@ -27,7 +26,7 @@ jobs:
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} # TODO change to token
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
Expand Down
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ paramak.egg-info/
coverage.xml
.coverage

# trelis journal files
# trelis output files
*.jou
*.log
*.trelis
*.cub

# neutronics geometry files
*.h5m
Expand Down Expand Up @@ -59,3 +61,7 @@ test-reports/

# ppp output directory
manifest_processed/

# conda buid and dist dir
build/
dist/
56 changes: 28 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Options: [1, 2, 3, 4, 5, 6...]
#
# Example builds:
# Building using the defaults (cq_version 2, no neutronics and 1 core compile)
# Building using the defaults (cq_version 2.1, no neutronics and 1 core compile)
# docker build -t ukaea/paramak .
#
# Building to include cadquery master, neutronics dependencies and use 8 cores.
Expand All @@ -40,10 +40,10 @@
# docker run --rm ukaea/paramak pytest /tests
# docker run --rm ukaea/paramak /bin/bash -c "cd .. && bash run_tests.sh"

FROM continuumio/miniconda3:4.9.2
FROM continuumio/miniconda3:4.9.2 as dependencies

# By default this Dockerfile builds with the latest release of CadQuery 2
ARG cq_version=2
ARG cq_version=2.1
ARG include_neutronics=false
ARG compile_cores=1

Expand All @@ -62,12 +62,13 @@ RUN apt-get install -y libgl1-mesa-glx libgl1-mesa-dev libglu1-mesa-dev \
apt-get clean

# Installing CadQuery
# jupyter is installed before cadquery to avoid a conflict
RUN echo installing CadQuery version $cq_version && \
conda install jupyter -y --quiet && \
conda install -c cadquery -c conda-forge cadquery="$cq_version" && \
conda install -c conda-forge -c python python=3.8 && \
conda install -c conda-forge -c cadquery cadquery="$cq_version" && \
pip install jupyter-cadquery==2.1.0 && \
conda clean -afy


# Install neutronics dependencies from Debian package manager
RUN if [ "$include_neutronics" = "true" ] ; \
then echo installing with include_neutronics=true ; \
Expand All @@ -88,20 +89,9 @@ RUN if [ "$include_neutronics" = "true" ] ; \
apt-get --yes install libglfw3-dev ; \
fi

# Clone and install NJOY2016
RUN if [ "$include_neutronics" = "true" ] ; \
then git clone --single-branch --branch master https://github.com/njoy/NJOY2016.git /opt/NJOY2016 ; \
cd /opt/NJOY2016 ; \
mkdir build ; \
cd build ; \
cmake -Dstatic=on .. ; \
make 2>/dev/null ; \
make install ; \
fi

# Clone and install Embree
RUN if [ "$include_neutronics" = "true" ] ; \
then git clone --single-branch --branch master https://github.com/embree/embree.git ; \
then git clone --single-branch --branch v3.12.2 --depth 1 https://github.com/embree/embree.git ; \
cd embree ; \
mkdir build ; \
cd build ; \
Expand All @@ -117,7 +107,7 @@ RUN if [ "$include_neutronics" = "true" ] ; \
mkdir MOAB ; \
cd MOAB ; \
mkdir build ; \
git clone --single-branch --branch develop https://bitbucket.org/fathomteam/moab.git ; \
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 \
Expand All @@ -141,7 +131,6 @@ RUN if [ "$include_neutronics" = "true" ] ; \
python setup.py install ; \
fi


# Clone and install Double-Down
RUN if [ "$include_neutronics" = "true" ] ; \
then git clone --single-branch --branch main https://github.com/pshriwise/double-down.git ; \
Expand All @@ -159,7 +148,7 @@ RUN if [ "$include_neutronics" = "true" ] ; \
RUN if [ "$include_neutronics" = "true" ] ; \
then mkdir DAGMC ; \
cd DAGMC ; \
git clone --single-branch --branch develop https://github.com/svalinn/DAGMC.git ; \
git clone --single-branch --branch 3.2.0 --depth 1 https://github.com/svalinn/DAGMC.git ; \
mkdir build ; \
cd build ; \
cmake ../DAGMC -DBUILD_TALLY=ON \
Expand Down Expand Up @@ -187,23 +176,30 @@ RUN if [ "$include_neutronics" = "true" ] ; \
make -j"$compile_cores" install ; \
cd .. ; \
pip install -e .[test] ; \
/opt/openmc/tools/ci/download-xs.sh ; \
fi

ENV OPENMC_CROSS_SECTIONS=/root/nndc_hdf5/cross_sections.xml

RUN if [ "$include_neutronics" = "true" ] ; \
then pip install vtk ; \
pip install parametric_plasma_source ; \
pip install neutronics_material_maker ; \
pip install neutronics_material_maker==0.3.2 ; \
pip install openmc_data_downloader ; \
openmc_data_downloader -e all -i H3 -l ENDFB-7.1-NNDC TENDL-2019 -p neutron photon ; \
fi

COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt

# @pullrequest reviewer, we would like to make the copy optional but don't know
# how. Then we can build a dependency image for use in circle ci.
# Copy over the source code, examples and tests
ENV OPENMC_CROSS_SECTIONS=/cross_sections.xml
ENV PATH="/MOAB/build/bin:${PATH}"
ENV PATH="/DAGMC/bin:${PATH}"

RUN mkdir /home/paramak
EXPOSE 8888
WORKDIR /home/paramak


FROM dependencies as final

COPY run_tests.sh run_tests.sh
COPY paramak paramak/
COPY examples examples/
Expand All @@ -213,3 +209,7 @@ COPY README.md README.md

# using setup.py instead of pip due to https://github.com/pypa/pip/issues/5816
RUN python setup.py install

# this helps prevent the kernal failing
RUN echo "#!/bin/bash\n\njupyter lab --notebook-dir=/home/paramak --port=8888 --no-browser --ip=0.0.0.0 --allow-root" >> /home/paramak/docker-cmd.sh
CMD bash /home/paramak/docker-cmd.sh
Loading

0 comments on commit 817f373

Please sign in to comment.