diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3da79c0482..9de726042de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -146,7 +146,85 @@ 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('tools/ci/download-xs.sh') }} + + - name: get cache keys from commits, scripts, 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 + id: njoy + uses: actions/cache@v6 + with: + path: | + ~/NJOY2016/metaconfigure + ~/NJOY2016/build/njoy + ~/NJOY2016/build/libnjoy.so + key: >- + NJOY2016-${{ env.NJOY_HASH }}- + ${{ runner.os }}- + ${{ hashFiles('tools/ci/gha-install-njoy.sh') }} + + - name: Restore MOAB + id: moab + if: ${{ matrix.dagmc == 'y' }} + uses: actions/cache@v6 + with: + path: | + ~/MOAB + key: >- + MOAB-${{ env.MOAB_HASH }}- + ${{ runner.os }}- + ${{ hashFiles('tools/ci/gha-install-moab.sh') }} + + - name: Restore DAGMC + id: dagmc + if: ${{ matrix.dagmc == 'y' }} + uses: actions/cache@v6 + with: + path: | + ~/DAGMC + key: >- + DAGMC-${{ env.DAGMC_HASH }}- + ${{ runner.os }}- + ${{ hashFiles('tools/ci/gha-install-dagmc.sh') }} + + - name: Restore libmesh + id: libmesh + if: ${{ matrix.libmesh == 'y' }} + uses: actions/cache@v6 + with: + path: | + ~/LIBMESH + key: >- + libmesh-mpi-${{ matrix.mpi }}- + ${{ env.LB_HASH }}- + ${{ runner.os }}- + ${{ hashFiles('tools/ci/gha-install-libmesh.sh') }} + - name: install + env: + NJOY_HIT: ${{ steps.njoy.outputs.cache-hit }} + MOAB_HIT: ${{ steps.moab.outputs.cache-hit }} + DAGMC_HIT: ${{ steps.dagmc.outputs.cache-hit }} + LIBMESH_HIT: ${{ steps.libmesh.outputs.cache-hit }} shell: bash run: | echo "$HOME/NJOY2016/build" >> $GITHUB_PATH @@ -154,16 +232,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 @@ -174,13 +243,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: | @@ -198,13 +267,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 @@ -214,7 +283,7 @@ jobs: flag-name: C++ and Python path-to-lcov: coverage.lcov fail-on-error: false - + coverage: needs: [filter-changes, main] if: ${{ always() }} @@ -227,7 +296,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 diff --git a/tools/ci/gha-cache-keys.sh b/tools/ci/gha-cache-keys.sh new file mode 100755 index 00000000000..427824734e1 --- /dev/null +++ b/tools/ci/gha-cache-keys.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -ex + +echo "NJOY_HASH=$(git ls-remote https://github.com/njoy/NJOY2016.git \ + --tags 2016.78 )" >> $GITHUB_ENV + +if [[ "$DAGMC" == 'y' ]]; then + echo "MOAB_HASH=$(git ls-remote https://bitbucket.org/fathomteam/moab.git \ + --tags 5.5.1 )" >> $GITHUB_ENV + + echo "DAGMC_HASH=$(git ls-remote https://github.com/svalinn/dagmc.git \ + --branches develop )" >> $GITHUB_ENV +fi + +if [[ "$LIBMESH" == 'y' ]]; then + echo "LB_HASH=$(git ls-remote https://github.com/libmesh/libmesh \ + --tags v1.7.1 )" >> $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 \ No newline at end of file diff --git a/tools/ci/gha-install-dagmc.sh b/tools/ci/gha-install-dagmc.sh index 8d0648a5041..c0e4cbe8e6e 100755 --- a/tools/ci/gha-install-dagmc.sh +++ b/tools/ci/gha-install-dagmc.sh @@ -1,4 +1,3 @@ - #!/bin/bash set -ex @@ -14,15 +13,6 @@ DAGMC_INSTALL_DIR=$HOME/DAGMC/ CURRENT_DIR=$(pwd) -# MOAB Install -cd $HOME -mkdir MOAB && cd MOAB -git clone -b $MOAB_BRANCH $MOAB_REPO -mkdir build && cd build -cmake ../moab -DENABLE_HDF5=ON -DENABLE_NETCDF=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$MOAB_INSTALL_DIR -make -j && make -j install -rm -rf $HOME/MOAB/moab $HOME/MOAB/build - # DAGMC Install cd $HOME mkdir DAGMC && cd DAGMC diff --git a/tools/ci/gha-install-libmesh.sh b/tools/ci/gha-install-libmesh.sh index d4557d2d3a2..a6486799bca 100755 --- a/tools/ci/gha-install-libmesh.sh +++ b/tools/ci/gha-install-libmesh.sh @@ -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 diff --git a/tools/ci/gha-install-moab.sh b/tools/ci/gha-install-moab.sh new file mode 100755 index 00000000000..0306b51832e --- /dev/null +++ b/tools/ci/gha-install-moab.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -ex + +# MOAB Variables +MOAB_BRANCH='5.5.1' +MOAB_REPO='https://bitbucket.org/fathomteam/moab/' +MOAB_INSTALL_DIR=$HOME/MOAB/ + +CURRENT_DIR=$(pwd) + +# MOAB Install +cd $HOME +mkdir MOAB && cd MOAB +git clone -b $MOAB_BRANCH $MOAB_REPO +mkdir build && cd build +cmake ../moab -DENABLE_HDF5=ON -DENABLE_NETCDF=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$MOAB_INSTALL_DIR +make -j && make -j install +rm -rf $HOME/MOAB/moab $HOME/MOAB/build + +cd $CURRENT_DIR \ No newline at end of file diff --git a/tools/ci/gha-install-njoy.sh b/tools/ci/gha-install-njoy.sh index 168fcd4a7b7..f4ad2e83543 100755 --- a/tools/ci/gha-install-njoy.sh +++ b/tools/ci/gha-install-njoy.sh @@ -5,3 +5,8 @@ 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 +find "$HOME/NJOY2016/build" -maxdepth 1 \ + ! -name njoy \ + ! -name libnjoy.so \ + -type f \ + -delete \ No newline at end of file diff --git a/tools/ci/gha-install.sh b/tools/ci/gha-install.sh index 4cf62afbb71..b3abb36fa21 100755 --- a/tools/ci/gha-install.sh +++ b/tools/ci/gha-install.sh @@ -7,11 +7,19 @@ pip install --upgrade pytest pip install --upgrade numpy # Install NJOY 2016 -./tools/ci/gha-install-njoy.sh +if [[ "$NJOY_HIT" != "true" ]]; 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 [[ "$MOAB_HIT" != "true" ]]; then + ./tools/ci/gha-install-moab.sh + fi + + if [[ "$DAGMC_HIT" != "true" ]]; then + ./tools/ci/gha-install-dagmc.sh + fi fi # Install NCrystal and verify installation @@ -19,8 +27,10 @@ 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 [[ "$LIBMESH_HIT" != "true" ]]; then + ./tools/ci/gha-install-libmesh.sh + fi fi # Install MCPL @@ -28,7 +38,7 @@ 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 diff --git a/tools/ci/requirements-mpi-n.txt b/tools/ci/requirements-mpi-n.txt new file mode 100755 index 00000000000..f5aecc94d0c --- /dev/null +++ b/tools/ci/requirements-mpi-n.txt @@ -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 \ No newline at end of file diff --git a/tools/ci/requirements-mpi-y.txt b/tools/ci/requirements-mpi-y.txt new file mode 100755 index 00000000000..e6d0b96750c --- /dev/null +++ b/tools/ci/requirements-mpi-y.txt @@ -0,0 +1,7 @@ +# requirements-mpi-y.txt +-r requirements-mpi-n.txt +mpi4py +setuptools +Cython +pkgconfig +h5py \ No newline at end of file