Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker build #2

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3987ad9
adding wrokflow to build docker img
bam241 Aug 4, 2021
a978ff7
fixing names
bam241 Aug 4, 2021
83c6400
fixing jobs names
bam241 Aug 4, 2021
5d6ce5d
where is /__w/cyclus/cyclus/src/../share/dbtypes.json
bam241 Aug 4, 2021
f125117
what is in there ?
bam241 Aug 4, 2021
27f7197
what is in there ?
bam241 Aug 4, 2021
4d7e127
correct poath
bam241 Aug 4, 2021
00c4f42
conditional retagging
bam241 Aug 13, 2021
cf90f29
nosetest no capture
bam241 Aug 14, 2021
cca83af
Adding full path to bear
bam241 Aug 14, 2021
bbd3b26
IN and OUT
bam241 Aug 14, 2021
54be64a
what with checkou_cmd
bam241 Aug 15, 2021
ab32fd0
should be better
bam241 Aug 15, 2021
75b48fe
updating python path
bam241 Aug 16, 2021
af46862
how about now?
bam241 Aug 16, 2021
171d321
this should do it
bam241 Aug 16, 2021
11c4b22
how about now?
bam241 Aug 18, 2021
9dee973
what is in there ?
bam241 Aug 18, 2021
46b99fb
any better?
bam241 Aug 19, 2021
63ee09f
beck to checkout output
bam241 Aug 19, 2021
0a410fe
with python path ?
bam241 Aug 19, 2021
3a46a89
with python path ?
bam241 Aug 19, 2021
4685e44
how about now ?
bam241 Aug 19, 2021
e8f2b5a
fixing cyton version
bam241 Aug 24, 2021
7f3a5a5
how about now ?
bam241 Aug 24, 2021
af62bf8
missing \
bam241 Aug 24, 2021
fd48bda
we need make..
bam241 Aug 24, 2021
d7853d1
adding nose
bam241 Aug 24, 2021
d9170a0
adding nosetest
bam241 Aug 24, 2021
bcc620e
this should be nose
bam241 Aug 24, 2021
cdb77da
cython < 0.29
bam241 Aug 24, 2021
669b7cd
cython=0.28.5
bam241 Aug 24, 2021
acf0c21
releasing constrina on hdf5, adding tables
bam241 Aug 25, 2021
1079308
tables
bam241 Aug 25, 2021
df0815a
transfering some package to python
bam241 Aug 26, 2021
709da81
udpate dockerfile
bam241 Aug 26, 2021
209ebd3
tmp
bam241 Aug 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .github/workflows/docker_deps_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Build & Publish Cyclus-deps docker image

on:
# allows us to run workflows manually
workflow_dispatch:
push:
paths:
- 'docker/cyclus-deps/Dockerfile'
- '.github/workflows/docker_deps_publish.yml'


jobs:
build-deps-img:
runs-on: ubuntu-latest
name: Cyclus deps

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Export Cyclus-deps
uses: docker/build-push-action@v2
with:
file: docker/cyclus-deps/Dockerfile
push: true
context: .
tags: ghcr.io/${{ github.repository_owner }}/cyclus_deps:ci_testing


test_img:
needs: [build-deps-img]
runs-on: ubuntu-latest

container:
image: ghcr.io/${{ github.repository_owner }}/cyclus_deps:ci_testing

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: setup
run: |
echo "HOME=/github/home/" >> $GITHUB_ENV
echo "PATH=$PATH:${HOME}/.local/bin" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HOME}/.local/lib" >> $GITHUB_ENV

- name: Building Cyclus
run: |
mkdir -p ${HOME}/.local/lib/python3.7/site-packages/
cd ${GITHUB_WORKSPACE}
python install.py -j 2 \
--build-type=Release --core-version 999999.999999 \
-DBLAS_LIBRARIES="/opt/conda/lib/libblas.so" \
-DLAPACK_LIBRARIES="/opt/conda/lib/liblapack.so"

- name: Unit Test
run: |
cyclus_unit_tests; exit $?

- name: Nosetest
run: |
export PYTHONPATH="$PYTHONPATH:${GITHUB_WORKSPACE}/tests"
nosetests --nocapture -w ${GITHUB_WORKSPACE}/tests; exit $?

pushing_test_stable_img:
if: ${{ github.repository_owner == 'cyclus' }}
needs: [test_img]
runs-on: ubuntu-latest

name: ghcr.io/${{ github.repository_owner }}/cyclus_deps':' ci-testing -> latest/stable

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

# - name: Push Image as stable img
# uses: akhilerm/[email protected]
# with:
# src: ghcr.io/${{ github.repository_owner }}/cyclus_deps:ci_testing
# dst: ghcr.io/${{ github.repository_owner }}/cyclus_deps:stable

- name: Push Image as latest img
uses: akhilerm/[email protected]
with:
src: ghcr.io/${{ github.repository_owner }}/cyclus_deps:ci_testing
dst: ghcr.io/${{ github.repository_owner }}/cyclus_deps:latest
96 changes: 96 additions & 0 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Build & Publish docker Cyclus image

on:
# allows us to run workflows manually
workflow_dispatch:
push:
paths-ignore:
- 'docker/cyclus-deps/Dockerfile'
- '.github/workflows/docker_deps_publish.yml'
release:
types: # This configuration does not affect the page_build event above
- created
jobs:
build-img:
runs-on: ubuntu-latest

name: Cyclus

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: placing the proper Dockerfile
run: |
cp docker/cyclus-ci/Dockerfile .

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Export cyclus Docker image
uses: docker/build-push-action@v2
with:
file: Dockerfile
push: true
context: .
build-args: |
UBUNTU_VERSION=${{ matrix.ubuntu_versions }}
tags: ghcr.io/${{ github.repository_owner }}/cyclus:ci_testing


test_img:
needs: [build-img]
runs-on: ubuntu-latest

container:
image: ghcr.io/${{ github.repository_owner }}/cyclus:ci_testing

steps:
- name: Unit Test
run: |
cyclus_unit_tests; exit $?

- name: Nosetest
run: |
export PYTHONPATH="${PYTHONPATH}:/cyclus/tests"
nosetests --nocapture -w /cyclus/tests; exit $?


pushing_latest_stable_img:
if: ${{ github.repository_owner == 'cyclus' }}
needs: [test_img]
runs-on: ubuntu-latest

name: ghcr.io/${{ github.repository_owner }}/cyclus':' ci-testing -> latest/stable

steps:
- name: setup
run: |
if [ "github.event_name" != "release" ]; then
echo "img_tag=latest" >> $GITHUB_ENV
else
echo "img_tag=stable" >> $GITHUB_ENV
fi

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push Image as stable img
uses: akhilerm/[email protected]
with:
src: ghcr.io/${{ github.repository_owner }}/cyclus:ci_testing
dst: ghcr.io/${{ github.repository_owner }}/cyclus:${{ env.img_tag }}
74 changes: 38 additions & 36 deletions docker/cyclus-deps/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,47 +36,49 @@ RUN conda config --add channels conda-forge
RUN conda update -n base -c defaults conda
RUN conda update -y --all && \
conda install -y \
openssh \
gxx_linux-64 \
gcc_linux-64 \
cmake \
make \
docker-pycreds \
git \
xo \
python-json-logger \
glib=2.56 \
libxml2 \
libxmlpp \
libblas \
libcblas \
liblapack \
pkg-config \
coincbc=2.9 \
boost-cpp \
hdf5 \
sqlite \
pcre \
gettext \
bzip2 \
xz \
setuptools \
nose \
pytables \
pandas \
jinja2 \
"cython<=0.28.5" \
websockets \
pprintpp \
&& \
conda clean -y --all
openssh \
gxx_linux-64 \
gcc_linux-64 \
cmake \
make \
docker-pycreds \
git \
xo \
python-json-logger \
glib \
glibmm \
libxml2 \
libxmlpp \
libblas \
libcblas \
liblapack \
pkg-config \
coincbc \
boost-cpp \
hdf5 \
sqlite \
pcre \
gettext \
bzip2 \
xz \
&& \
conda clean -y --all
ENV CC /opt/conda/bin/x86_64-conda_cos6-linux-gnu-gcc
ENV CXX /opt/conda/bin/x86_64-conda_cos6-linux-gnu-g++
ENV CPP /opt/conda/bin/x86_64-conda_cos6-linux-gnu-cpp
ENV PYTHONPATH "/home/conda/.local/lib/python3.7/site-packages/:/root/.local/lib/python3.7/site-packages/"
RUN pip install setuptools \
tables \
pandas \
jinja2 \
websockets \
pprintpp \
nose \
cython

ENV PYTHONPATH "/home/conda/.local/lib/python3.9/site-packages/:/root/.local/lib/python3.9/site-packages/"
# required for the nosetest
ENV PYTHONWARNINGS ignore
RUN mkdir -p /root/.local/lib/python3.7/site-packages/
RUN mkdir -p /root/.local/lib/python3.9/site-packages/
#
# pip packages to overide conda
#
Expand Down
32 changes: 23 additions & 9 deletions tests/test_bear_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import subprocess

from nose.tools import assert_in, assert_true, assert_greater_equal
from tools import check_cmd


inputfile = {
'simulation': {
Expand Down Expand Up @@ -44,23 +46,35 @@
},
}

CWD = os.path.dirname(__file__)
INPUT = os.path.join(CWD, "input")

def test_bear_deploy():
if os.path.exists('bears.h5'):
os.remove('bears.h5')
with open('bears.json', 'w') as f:

sim_input = os.path.join(INPUT, 'bears.json')
sim_output = os.path.join(INPUT, 'bears.h5')

if os.path.exists(sim_output):
os.remove(sim_output)
with open(sim_input, 'w') as f:
json.dump(inputfile, f)

env = dict(os.environ)
env['PYTHONPATH'] = "."
s = subprocess.check_output(['cyclus', '-o', 'bears.h5', 'bears.json'],
universal_newlines=True, env=env)

cmd = ["cyclus", "-o", sim_output, "--input-file", sim_input]
s = subprocess.check_output(cmd, cwd=".", universal_newlines=True, env=env)


# test that the institution deploys a BearStore
assert_in("New fac: BearStore", s)
# test that the first agents exist with right minimum production.
agents = re.compile('Agent \d+ 8\.0')
all_agents = set(agents.findall(s))
assert_greater_equal(len(all_agents), 9)
if os.path.exists('bears.json'):
os.remove('bears.json')
if os.path.exists('bears.h5'):
os.remove('bears.h5')

if os.path.exists(sim_input):
os.remove(sim_input)
if os.path.exists(sim_output):
os.remove(sim_output)