diff --git a/.github/workflows/cache-dependencies.yml b/.github/workflows/cache-dependencies.yml index d849265cd..08c2ee96d 100644 --- a/.github/workflows/cache-dependencies.yml +++ b/.github/workflows/cache-dependencies.yml @@ -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 @@ -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 }} @@ -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 . diff --git a/.github/workflows/test-saltproc.yml b/.github/workflows/test-saltproc.yml index 0854b8657..446af254f 100644 --- a/.github/workflows/test-saltproc.yml +++ b/.github/workflows/test-saltproc.yml @@ -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 @@ -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 }} @@ -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 . diff --git a/tools/ci/build-openmc.sh b/tools/ci/build-openmc.sh new file mode 100755 index 000000000..c042e2594 --- /dev/null +++ b/tools/ci/build-openmc.sh @@ -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 ../ diff --git a/tools/ci/restore-openmc.sh b/tools/ci/restore-openmc.sh new file mode 100755 index 000000000..35fb60ab1 --- /dev/null +++ b/tools/ci/restore-openmc.sh @@ -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/.