diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5051b8d0bb..73fff93392d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,54 +21,29 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: + setup: + runs-on: ubuntu-22.04 + outputs: + matrix: ${{ steps.read-json.outputs.matrix }} + + steps: + - uses: actions/checkout@v4 + + - name: Send JSON matrix contents to job output + id: read-json + shell: bash + run: | + echo "matrix<> $GITHUB_OUTPUT + cat $GITHUB_WORKSPACE/tools/ci/matrix.json >> $GITHUB_OUTPUT + main: runs-on: ubuntu-22.04 + timeout-minutes: 180 + needs: setup strategy: - matrix: - python-version: ["3.11"] - mpi: [n, y] - omp: [n, y] - dagmc: [n] - ncrystal: [n] - libmesh: [n] - event: [n] - vectfit: [n] - - include: - - python-version: "3.12" - omp: n - mpi: n - - python-version: "3.13" - omp: n - mpi: n - - dagmc: y - python-version: "3.11" - mpi: y - omp: y - - ncrystal: y - python-version: "3.11" - mpi: n - omp: n - - libmesh: y - python-version: "3.11" - mpi: y - omp: y - - libmesh: y - python-version: "3.11" - mpi: n - omp: y - - event: y - python-version: "3.11" - omp: y - mpi: n - - vectfit: y - python-version: "3.11" - omp: n - mpi: y - name: "Python ${{ matrix.python-version }} (omp=${{ matrix.omp }}, - mpi=${{ matrix.mpi }}, dagmc=${{ matrix.dagmc }}, ncrystal=${{ matrix.ncrystal }}, - libmesh=${{ matrix.libmesh }}, event=${{ matrix.event }} - vectfit=${{ matrix.vectfit }})" + matrix: "${{ fromJSON( needs.setup.outputs.matrix ) }}" + + name: "${{ matrix.job-name }}" env: MPI: ${{ matrix.mpi }} @@ -124,24 +99,76 @@ jobs: if: ${{ matrix.vectfit == 'y' }} run: sudo apt install -y libblas-dev liblapack-dev + - name: Hash dependencies to check caches + run: | + $GITHUB_WORKSPACE/tools/ci/gha-caches.sh + + - name: Restore NJOY2016 + uses: actions/cache@v4 + with: + path: | + ~/NJOY2016/metaconfigure + ~/NJOY2016/src + ~/NJOY2016/build/njoy + ~/NJOY2016/build/libnjoy.so + key: NJOY2016-${{ env.NJOY_HASH }} + + - name: Restore DAGMC + if: ${{ matrix.dagmc == 'y' }} + uses: actions/cache@v4 + with: + path: | + ~/DAGMC + ~/MOAB + key: DAGMC-${{ env.DAGMC_HASH }}/MOAB-${{ env.MOAB_HASH }} + + - name: Restore NCrystal + if: ${{ matrix.ncrystal == 'y' }} + uses: actions/cache@v4 + with: + path: | + ~/ncrystal_src + ~/ncrystal_bld + ~/ncrystal_inst + key: NCrystal-${{ env.NC_HASH }} + + - name: Restore vectfit + if: ${{ matrix.vectfit == 'y' }} + uses: actions/cache@v4 + with: + path: | + ~/pybind11 + ~/xtl + ~/xtensor-python + ~/xtensor-blas + ~/vectfit + key: vectfit-${{ env.VF_HASH }}/pybind-${{ env.PYBIND_HASH }} + + - name: Restore libmesh + if: ${{ matrix.libmesh == 'y' }} + uses: actions/cache@v4 + with: + path: | + ~/LIBMESH + key: libmesh-mpi-${{matrix.mpi}}-${{ env.NC_HASH }} + - name: install shell: bash run: | - echo "$HOME/NJOY2016/build" >> $GITHUB_PATH $GITHUB_WORKSPACE/tools/ci/gha-install.sh - + - name: display-config shell: bash run: | openmc -v - - name: cache-xs + - name: Restore endf-b-vii.1 cache uses: actions/cache@v4 with: path: | ~/nndc_hdf5 ~/endf-b-vii.1 - key: ${{ runner.os }}-build-xs-cache + key: endf-b-vii.1-cache - name: before shell: bash diff --git a/tools/ci/gha-caches.sh b/tools/ci/gha-caches.sh new file mode 100755 index 00000000000..71edbc3fbbb --- /dev/null +++ b/tools/ci/gha-caches.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -ex + +echo "NJOY_HASH=$(git ls-remote https://github.com/njoy/NJOY2016.git HEAD |\ + head -c 15)" >> $GITHUB_ENV + +if [[ $DAGMC = 'y' ]]; then + echo "MOAB_HASH=$(git ls-remote https://bitbucket.org/fathomteam/moab.git \ + --branch Version5.1.0 HEAD | 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 [[ $NCRYSTAL = 'y' ]]; then + echo "NC_HASH=$(git ls-remote https://github.com/mctools/ncrystal \ + --branch develop HEAD | head -c 15)" >> $GITHUB_ENV +fi + +if [[ $VECTFIT = 'y' ]]; then + echo "PYBIND_HASH=$(git ls-remote https://github.com/pybind/pybind11 \ + --branch master HEAD | head -c 15)" >> $GITHUB_ENV + + echo "VF_HASH=$(git ls-remote https://github.com/liangjg/vectfit.git HEAD |\ + head -c 15)" >> $GITHUB_ENV +fi + +if [[ $LIBMESH = 'y' ]]; then + echo "NC_HASH=$(git ls-remote https://github.com/libmesh/libmesh \ + --branch v1.7.1 HEAD | head -c 15)" >> $GITHUB_ENV +fi diff --git a/tools/ci/gha-install-libmesh.sh b/tools/ci/gha-install-libmesh.sh index d4557d2d3a2..47ab2fa7906 100755 --- a/tools/ci/gha-install-libmesh.sh +++ b/tools/ci/gha-install-libmesh.sh @@ -13,7 +13,8 @@ if [[ $MPI == 'y' ]]; then ../libmesh/configure --prefix=$HOME/LIBMESH CXX=mpicxx CC=mpicc FC=mpifort F77=mpif77 \ --enable-exodus --disable-netcdf-4 --disable-eigen --disable-lapack else - ../libmesh/configure --prefix=$HOME/LIBMESH --enable-exodus --disable-netcdf-4 --disable-eigen --disable-lapack --disable-mpi + ../libmesh/configure --prefix=$HOME/LIBMESH --enable-exodus --disable-netcdf-4 \ + --disable-eigen --disable-lapack --disable-mpi fi make -j4 install rm -rf $HOME/LIBMESH/build diff --git a/tools/ci/gha-install-mcpl.sh b/tools/ci/gha-install-mcpl.sh index 9b8609398a0..3713d40e065 100755 --- a/tools/ci/gha-install-mcpl.sh +++ b/tools/ci/gha-install-mcpl.sh @@ -1,7 +1,11 @@ #!/bin/bash set -ex + +# MCPL variables +MCPL_REPO='https://github.com/mctools/mcpl' + cd $HOME -git clone https://github.com/mctools/mcpl +git clone $MCPL_REPO cd mcpl mkdir build && cd build -cmake .. && make 2>/dev/null && sudo make install +cmake .. && make 2>/dev/null && sudo make install \ No newline at end of file diff --git a/tools/ci/gha-install-ncrystal.sh b/tools/ci/gha-install-ncrystal.sh index 16f77e13e2b..f352e700612 100755 --- a/tools/ci/gha-install-ncrystal.sh +++ b/tools/ci/gha-install-ncrystal.sh @@ -34,7 +34,6 @@ make install # yet. If it appears in the future, we should add it here. # Output the configuration to the log - "${INST_DIR}/bin/ncrystal-config" --setup # Change environmental variables diff --git a/tools/ci/gha-install-njoy.sh b/tools/ci/gha-install-njoy.sh index 8255ffea836..9f2775add77 100755 --- a/tools/ci/gha-install-njoy.sh +++ b/tools/ci/gha-install-njoy.sh @@ -1,7 +1,15 @@ #!/bin/bash set -ex + +# NJOY variables +NJOY_REPO='https://github.com/njoy/NJOY2016' +NJOY_INSTALL_DIR=$HOME/NJOY2016 + cd $HOME -git clone https://github.com/njoy/NJOY2016 +git clone $NJOY_REPO cd NJOY2016 mkdir build && cd build -cmake -Dstatic=on .. && make 2>/dev/null && sudo make install +cmake -Dstatic=on .. -DCMAKE_INSTALL_PREFIX=$NJOY_INSTALL_DIR && +make 2>/dev/null && sudo make install +rm -rf $HOME/NJOY2016/tests +rm -rf $HOME/NJOY2016/build \ No newline at end of file diff --git a/tools/ci/gha-install-vectfit.sh b/tools/ci/gha-install-vectfit.sh index bd38e1ea8cd..2ead59fc229 100755 --- a/tools/ci/gha-install-vectfit.sh +++ b/tools/ci/gha-install-vectfit.sh @@ -43,4 +43,4 @@ pip install wheel # Install vectfit cd $HOME git clone https://github.com/liangjg/vectfit.git -pip install --no-build-isolation ./vectfit +pip install --no-build-isolation ./vectfit \ No newline at end of file diff --git a/tools/ci/gha-install.sh b/tools/ci/gha-install.sh index cff7dc834f5..55330df2f35 100755 --- a/tools/ci/gha-install.sh +++ b/tools/ci/gha-install.sh @@ -7,30 +7,52 @@ 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 +echo "$HOME/NJOY2016/bin" >> $GITHUB_PATH # Install DAGMC if needed if [[ $DAGMC = 'y' ]]; then - ./tools/ci/gha-install-dagmc.sh + if [ ! -d "$HOME/DAGMC" ] || [ ! -d "$HOME/MOAB" ] + then + ./tools/ci/gha-install-dagmc.sh + fi fi # Install NCrystal if needed if [[ $NCRYSTAL = 'y' ]]; then - ./tools/ci/gha-install-ncrystal.sh + if [ ! -d "$HOME/ncrystal_bld" ] + then + ./tools/ci/gha-install-ncrystal.sh + else + cd $HOME/ncrystal_bld + eval $( "$HOME/ncrystal_inst/bin/ncrystal-config" --setup ) + cd $GITHUB_WORKSPACE + fi fi # Install vectfit for WMP generation if needed if [[ $VECTFIT = 'y' ]]; then - ./tools/ci/gha-install-vectfit.sh + if [ ! -d "$HOME/vectfit" ] + then + ./tools/ci/gha-install-vectfit.sh + fi fi # Install libMesh if needed if [[ $LIBMESH = 'y' ]]; then - ./tools/ci/gha-install-libmesh.sh + if [ ! -d "$HOME/libmesh" ] + then + ./tools/ci/gha-install-libmesh.sh + fi fi # Install MCPL -./tools/ci/gha-install-mcpl.sh +if [[ ! -d "$HOME/mcpl" ]]; then + ./tools/ci/gha-install-mcpl.sh +fi + # For MPI configurations, make sure mpi4py and h5py are built against the # correct version of MPI diff --git a/tools/ci/matrix.json b/tools/ci/matrix.json new file mode 100644 index 00000000000..3e50ecf2eee --- /dev/null +++ b/tools/ci/matrix.json @@ -0,0 +1,137 @@ +{ + "include": [ + { + "job-name": "Python 3.11", + "python-version": "3.11", + "omp": "n", + "mpi": "n", + "dagmc": "n", + "ncrystal": "n", + "libmesh": "n", + "event": "n", + "vectfit": "n" + }, + { + "job-name": "Python 3.11 [omp]", + "python-version": "3.11", + "omp": "y", + "mpi": "n", + "dagmc": "n", + "ncrystal": "n", + "libmesh": "n", + "event": "n", + "vectfit": "n" + }, + { + "job-name": "Python 3.11 [mpi]", + "python-version": "3.11", + "omp": "n", + "mpi": "y", + "dagmc": "n", + "ncrystal": "n", + "libmesh": "n", + "event": "n", + "vectfit": "n" + }, + { + "job-name": "Python 3.11 [omp,mpi]", + "python-version": "3.11", + "omp": "y", + "mpi": "y", + "dagmc": "n", + "ncrystal": "n", + "libmesh": "n", + "event": "n", + "vectfit": "n" + }, + { + "job-name": "Python 3.12", + "python-version": "3.12", + "omp": "n", + "mpi": "n", + "dagmc": "n", + "ncrystal": "n", + "libmesh": "n", + "event": "n", + "vectfit": "n" + }, + { + "job-name": "Python 3.13", + "python-version": "3.13", + "omp": "n", + "mpi": "n", + "dagmc": "n", + "ncrystal": "n", + "libmesh": "n", + "event": "n", + "vectfit": "n" + }, + { + "job-name": "Python 3.11 [omp,mpi,dagmc]", + "python-version": "3.11", + "omp": "y", + "mpi": "y", + "dagmc": "y", + "ncrystal": "n", + "libmesh": "n", + "event": "n", + "vectfit": "n" + }, + { + "job-name": "Python 3.11 [ncrystal]", + "python-version": "3.11", + "omp": "n", + "mpi": "n", + "dagmc": "n", + "ncrystal": "y", + "libmesh": "n", + "event": "n", + "vectfit": "n" + }, + { + "job-name": "Python 3.11 [omp,mpi,libmesh]", + "python-version": "3.11", + "omp": "y", + "mpi": "y", + "dagmc": "n", + "ncrystal": "n", + "libmesh": "y", + "event": "n", + "vectfit": "n" + }, + { + "job-name": "Python 3.11 [omp,libmesh]", + "python-version": "3.11", + "omp": "y", + "mpi": "n", + "dagmc": "n", + "ncrystal": "n", + "libmesh": "y", + "event": "n", + "vectfit": "n" + }, + { + "job-name": "Python 3.11 [omp,event]", + "python-version": "3.11", + "omp": "y", + "mpi": "n", + "dagmc": "n", + "ncrystal": "n", + "libmesh": "n", + "event": "y", + "vectfit": "n" + }, + { + "job-name": "Python 3.11 [mpi,vectfit]", + "python-version": "3.11", + "omp": "n", + "mpi": "y", + "dagmc": "n", + "ncrystal": "n", + "libmesh": "n", + "event": "n", + "vectfit": "y" + } + ] +} +EOF \ No newline at end of file