Skip to content

Commit

Permalink
Revert "remove openmc source build from CI"
Browse files Browse the repository at this point in the history
This reverts commit 1f3ffbf.
  • Loading branch information
yardasol committed Sep 6, 2023
1 parent cc50a43 commit c45c179
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 4 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/cache-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ jobs:
run:
shell: bash -l {0}

env:
MPI: no
OMP: no
PHDF5: no
DAGMC: no
EVENT: no
VECTFIT: no
LIBMESH: no

steps:
- uses: actions/checkout@v3

Expand All @@ -42,6 +51,7 @@ jobs:
with:
path: |
/usr/share/miniconda3/envs/saltproc-env
~/openmc_src
~/endfb71_hdf5
~/.cache/pip
key: depcache-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
Expand All @@ -62,8 +72,19 @@ jobs:
- name: Download OpenMC
if: steps.dependencies-cache.outputs.cache-hit != 'true'
run: |
mamba install openmc
uses: actions/checkout@v3
with:
repository: openmc-dev/openmc
path: openmc
submodules: recursive

- name: Build OpenMC from source if no cache if found
if: steps.dependencies-cache.outputs.cache-hit != 'true'
run: $GITHUB_WORKSPACE/tools/ci/build-openmc.sh

- name: Restore OpenMC source build from cache
if: steps.dependencies-cache.outputs.cache-hit == 'true'
run: $GITHUB_WORKSPACE/tools/ci/restore-openmc.sh

- name: Install SaltProc
run: pip install .
Expand Down
26 changes: 24 additions & 2 deletions .github/workflows/test-saltproc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ jobs:
run:
shell: bash -l {0}

env:
MPI: no
OMP: no
PHDF5: no
DAGMC: no
EVENT: no
VECTFIT: no
LIBMESH: no

steps:
- uses: actions/checkout@v3

Expand All @@ -48,6 +57,8 @@ jobs:
with:
path: |
/usr/share/miniconda3/envs/saltproc-env
~/openmc_src
~/mcpl_src
~/endfb71_hdf5
~/.cache/pip
key: depcache-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
Expand All @@ -68,9 +79,20 @@ jobs:
- name: Download OpenMC
if: steps.dependencies-cache.outputs.cache-hit != 'true'
run: |
mamba install openmc
uses: actions/checkout@v3
with:
repository: openmc-dev/openmc
path: openmc
submodules: recursive

- name: Build OpenMC from source if no cache is found
if: steps.dependencies-cache.outputs.cache-hit != 'true'
run: $GITHUB_WORKSPACE/tools/ci/build-openmc.sh

- name: Restore OpenMC source build from cache
if: steps.dependencies-cache.outputs.cache-hit == 'true'
run: $GITHUB_WORKSPACE/tools/ci/restore-openmc.sh

- name: Install SaltProc
run: pip install .

Expand Down
54 changes: 54 additions & 0 deletions tools/ci/build-openmc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
set -ex

# Build openmc
cd openmc
./tools/ci/gha-install-mcpl.sh
python tools/ci/gha-install.py

# Create the caching folder
DIRS=(openmc_src mcpl_src)
for DIR in ${DIRS[@]}; do
mkdir $DIR
mkdir $DIR/bin
mkdir $DIR/lib
mkdir $DIR/share
mkdir $DIR/include
done

# Copy libraries to caching folder
cp /usr/local/bin/openmc openmc_src/bin/.
cp /usr/local/lib/libopenmc.so openmc_src/lib/.
cp -r /usr/local/lib/cmake openmc_src/lib/.
cp /usr/local/lib/libpugixml.a openmc_src/lib/.
cp -r /usr/local/lib/pkgconfig openmc_src/lib/.
#cp -r /usr/local/share/openmc openmc_src/share/.
#cp -r /usr/local/share/man openmc_src/share/.
cp -r /usr/local/include/openmc openmc_src/include/.
cp /usr/local/include/pugiconfig.hpp openmc_src/include/.
cp /usr/local/include/pugixml.hpp openmc_src/include/.
INCLUDES=(fmt xtl xtensor gsl gsl-lite openmc)
for I in ${INCLUDES[@]}; do
cp -r /usr/local/include/$I openmc_src/include/.
done

# MCPL stuff
cp /usr/local/lib/libmcpl.so mcpl_src/lib/.
cp /usr/local/include/mcpl.h mcpl_src/include/.
cp /usr/local/lib/libsswmcpl.so mcpl_src/lib/.
cp /usr/local/lib/libphitsmcpl.so mcpl_src/lib/.
cp -r /usr/local/share/MCPL mcpl_src/share/.

MCPL_BINARIES=(pymcpltool mcpl-config mcpl2ssw ssw2mcpl mcpl2phits phits2mcpl mcpltool)
for BINARY in ${MCPL_BINARIES[@]}; do
cp /usr/local/bin/$BINARY mcpl_src/bin/.
done


# Move the caching folders to $HOME
mv openmc_src $HOME/openmc_src
mv mcpl_src $HOME/mcpl_src

# Install the OpenMC python API
pip install .
cd ../
30 changes: 30 additions & 0 deletions tools/ci/restore-openmc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -ex

# Move cached OpenMC libaries to PATH
sudo mv $HOME/openmc_src/bin/openmc /usr/local/bin/openmc
OPENMC_LIBS=(libopenmc.so cmake libpugixml.a pkgconfig)
for LIB in ${OPENMC_LIBS[@]}; do
sudo mv $HOME/openmc_src/lib/$LIB /usr/local/lib/.
done

sudo mv $HOME/openmc_src/lib/ /usr/local/lib/
#sudo mv $HOME/openmc_src/share/openmc /usr/local/share/openmc
#sudo mv $HOME/openmc_src/share/man /usr/local/share/man
INCLUDES=(fmt xtl xtensor gsl gsl-lite openmc pugixml.hpp pugiconfig.hpp)
for I in ${INCLUDES[@]}; do
sudo mv $HOME/openmc_src/include/$I /usr/local/include/$I
done

# Move MCPL stuff
MCPL_BINARIES=(pymcpltool mcpl-config mcpltool mcpl2ssw ssw2mcpl mcpl2phits phits2mcpl)
for BINARY in ${MCPL_BINARIES[@]}; do
sudo mv $HOME/mcpl_src/bin/$BINARY /usr/local/bin/.
done

MCPL_LIBS=(libsswmcpl.so libphitsmcpl.so libmcpl.so)
for LIB in ${MCPL_LIBS[@]}; do
sudo mv $HOME/mcpl_src/lib/$LIB /usr/local/lib/.
done
sudo mv $HOME/mcpl_src/include/mcpl.h /usr/local/include/.
sudo mv $HOME/mcpl_src/share/MCPL /usr/local/share/.

0 comments on commit c45c179

Please sign in to comment.