Skip to content
75 changes: 59 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,58 @@ jobs:
sudo update-alternatives --set mpirun /usr/bin/mpirun.mpich
sudo update-alternatives --set mpi-x86_64-linux-gnu /usr/include/x86_64-linux-gnu/mpich

- name: cache-xs
uses: actions/cache@v6
with:
path: |
~/nndc_hdf5
~/endf-b-vii.1
key: ${{ runner.os }}-build-xs-cache-${{ hashFiles(format('{0}/tools/ci/download-xs.sh', github.workspace)) }}

- name: Get dependency cache keys and mpi-dep versions
shell: bash
run: $GITHUB_WORKSPACE/tools/ci/gha-cache-keys.sh

- name: Restore pip cache according to mpi-deps
uses: actions/cache@v6
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-py${{ matrix.python-version }}-mpi-${{ matrix.mpi }}-${{ hashFiles(format('tools/ci/requirements-mpi-{0}.txt', matrix.mpi)) }}-${{ hashFiles('tools/ci/mpi-deps.txt') }}


- name: Restore NJOY2016
uses: actions/cache@v6
with:
path: |
~/NJOY2016/metaconfigure
~/NJOY2016/build/njoy
~/NJOY2016/build/libnjoy.so
key: NJOY2016-${{ env.NJOY_HASH }}

- name: Restore MOAB
if: ${{ matrix.dagmc == 'y' }}
uses: actions/cache@v6
with:
path: |
~/MOAB
key: MOAB-${{ env.MOAB_HASH }}

- name: Restore DAGMC
if: ${{ matrix.dagmc == 'y' }}
uses: actions/cache@v6
with:
path: |
~/DAGMC
key: DAGMC-${{ env.DAGMC_HASH }}

- name: Restore libmesh
if: ${{ matrix.libmesh == 'y' }}
uses: actions/cache@v6
with:
path: |
~/LIBMESH
key: libmesh-mpi-${{matrix.mpi}}-${{ env.LB_HASH }}

- name: install
shell: bash
run: |
Expand All @@ -154,16 +206,7 @@ jobs:

- name: display-config
shell: bash
run: |
openmc -v

- name: cache-xs
uses: actions/cache@v5
with:
path: |
~/nndc_hdf5
~/endf-b-vii.1
key: ${{ runner.os }}-build-xs-cache-${{ hashFiles(format('{0}/tools/ci/download-xs.sh', github.workspace)) }}
run: openmc -v

- name: before
shell: bash
Expand All @@ -174,13 +217,13 @@ jobs:
run: |
CTEST_OUTPUT_ON_FAILURE=1 make test -C $GITHUB_WORKSPACE/build/
$GITHUB_WORKSPACE/tools/ci/gha-script.sh

- name: Setup tmate debug session
continue-on-error: true
if: ${{ failure() && contains(env.COMMIT_MESSAGE, '[gha-debug]') }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 10

- name: Generate C++ coverage (gcovr)
shell: bash
run: |
Expand All @@ -198,13 +241,13 @@ jobs:
--merge-mode-functions=separate \
--print-summary \
--lcov -o coverage-cpp.lcov || true

- name: Merge C++ and Python coverage
shell: bash
run: |
# Merge C++ and Python LCOV into a single file for upload
cat coverage-cpp.lcov coverage-python.lcov > coverage.lcov

- name: Upload coverage to Coveralls
if: ${{ hashFiles('coverage.lcov') != '' }}
uses: coverallsapp/github-action@v2
Expand All @@ -214,7 +257,7 @@ jobs:
flag-name: C++ and Python
path-to-lcov: coverage.lcov
fail-on-error: false

coverage:
needs: [filter-changes, main]
if: ${{ always() }}
Expand All @@ -227,7 +270,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
fail-on-error: false

ci-pass:
needs: [filter-changes, main, coverage]
name: Check CI status
Expand Down
29 changes: 29 additions & 0 deletions tools/ci/gha-cache-keys.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -ex

echo "NJOY_HASH=$(git ls-remote https://github.com/njoy/NJOY2016.git HEAD \
--tags 2016.78 | head -c 15)" >> $GITHUB_ENV

if [[ "$DAGMC" == 'y' ]]; then
echo "MOAB_HASH=$(git ls-remote https://bitbucket.org/fathomteam/moab.git \
--tags Version5.1.0 | head -c 15)" >> $GITHUB_ENV

echo "DAGMC_HASH=$(git ls-remote https://github.com/svalinn/dagmc.git HEAD |\
head -c 15)" >> $GITHUB_ENV
fi

if [[ "$LIBMESH" == 'y' ]]; then
echo "LB_HASH=$(git ls-remote https://github.com/libmesh/libmesh \
--tags v1.7.1 | head -c 15)" >> $GITHUB_ENV
fi

if [[ "$MPI" == 'y' ]]; then
dpkg-query -W libmpich-dev libhdf5-mpich-dev > $GITHUB_WORKSPACE/tools/ci/mpi-deps.txt
cat $GITHUB_WORKSPACE/tools/ci/mpi-deps.txt
sha256sum $GITHUB_WORKSPACE/tools/ci/requirements-mpi-y.txt
sha256sum $GITHUB_WORKSPACE/tools/ci/mpi-deps.txt
else
touch $GITHUB_WORKSPACE/tools/ci/mpi-deps.txt
sha256sum $GITHUB_WORKSPACE/tools/ci/requirements-mpi-n.txt
sha256sum $GITHUB_WORKSPACE/tools/ci/mpi-deps.txt
fi
2 changes: 2 additions & 0 deletions tools/ci/gha-install-libmesh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ else
fi
make -j4 install
rm -rf $HOME/LIBMESH/build
rm -rf $HOME/LIBMESH/libmesh
rm -rf $HOME/LIBMESH/examples

popd
1 change: 1 addition & 0 deletions tools/ci/gha-install-njoy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ git clone -b 2016.78 https://github.com/njoy/NJOY2016
cd NJOY2016
mkdir build && cd build
cmake -Dstatic=on .. && make 2>/dev/null && sudo make install
rm -rf $HOME/NJOY2016/build
18 changes: 12 additions & 6 deletions tools/ci/gha-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,34 @@ pip install --upgrade pytest
pip install --upgrade numpy

# Install NJOY 2016
./tools/ci/gha-install-njoy.sh
if [[ ! -d "$HOME/NJOY2016" ]]; then
./tools/ci/gha-install-njoy.sh
fi

# Install DAGMC if needed
if [[ $DAGMC = 'y' ]]; then
./tools/ci/gha-install-dagmc.sh
if [[ "$DAGMC" == "y" ]]; then
if [[ ! -d "$HOME/DAGMC" ]] || [[ ! -d "$HOME/MOAB" ]]; then
./tools/ci/gha-install-dagmc.sh
fi
fi

# Install NCrystal and verify installation
pip install 'ncrystal>=4.1.0'
nctool --test

# Install libMesh if needed
if [[ $LIBMESH = 'y' ]]; then
./tools/ci/gha-install-libmesh.sh
if [[ "$LIBMESH" == "y" ]]; then
if [[ ! -d "$HOME/LIBMESH" ]]; then
./tools/ci/gha-install-libmesh.sh
fi
fi

# Install MCPL
pip install mcpl

# For MPI configurations, make sure mpi4py and h5py are built against the
# correct version of MPI
if [[ $MPI == 'y' ]]; then
if [[ "$MPI" == "y" ]]; then
pip install --no-binary=mpi4py mpi4py

export CC=mpicc
Expand Down
18 changes: 18 additions & 0 deletions tools/ci/requirements-mpi-n.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# requirements-mpi-n.txt
numpy
h5py
scipy
ipython
matplotlib
pandas
lxml
uncertainties
endf
packaging
pytest
pytest-cov>=4.0
pytest-rerunfailures
colorama
openpyxl
coverage>=7.4
gcovr>=7.2
7 changes: 7 additions & 0 deletions tools/ci/requirements-mpi-y.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# requirements-mpi-y.txt
-r requirements-mpi-n.txt
mpi4py
setuptools
Cython
pkgconfig
h5py
Loading