diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3da79c0482..4d129df1fad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: | @@ -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 @@ -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: | @@ -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 @@ -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() }} @@ -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 diff --git a/tools/ci/gha-cache-keys.sh b/tools/ci/gha-cache-keys.sh new file mode 100755 index 00000000000..4f696ed0287 --- /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 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 \ No newline at end of file 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-njoy.sh b/tools/ci/gha-install-njoy.sh index 168fcd4a7b7..071d7ad3a03 100755 --- a/tools/ci/gha-install-njoy.sh +++ b/tools/ci/gha-install-njoy.sh @@ -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 \ No newline at end of file diff --git a/tools/ci/gha-install.sh b/tools/ci/gha-install.sh index 4cf62afbb71..e164ad5b663 100755 --- a/tools/ci/gha-install.sh +++ b/tools/ci/gha-install.sh @@ -7,11 +7,15 @@ 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 @@ -19,8 +23,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 [[ ! -d "$HOME/LIBMESH" ]]; then + ./tools/ci/gha-install-libmesh.sh + fi fi # Install MCPL @@ -28,7 +34,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