From 9eab1695fafcf82b5434efb633cc0a07a91a9c69 Mon Sep 17 00:00:00 2001 From: John Vincent Cauilan <64677361+johvincau@users.noreply.github.com> Date: Wed, 1 Jul 2026 18:29:58 -0500 Subject: [PATCH 1/6] Add cache key script and caching steps for NJOY, MOAB, DAGMC, libmesh --- .github/workflows/ci.yml | 71 +++++++++++++++++++++++++-------- tools/ci/gha-cache-keys.sh | 18 +++++++++ tools/ci/gha-install-libmesh.sh | 2 + tools/ci/gha-install-njoy.sh | 1 + tools/ci/gha-install.sh | 18 ++++++--- 5 files changed, 88 insertions(+), 22 deletions(-) create mode 100755 tools/ci/gha-cache-keys.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3da79c0482..2a9cd710ac8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,6 +110,9 @@ jobs: uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} +# cache: 'pip' # caching pip dependencies +# cache-dependency-path: | +# requirements-pip.txt - name: Environment Variables run: | @@ -146,6 +149,51 @@ 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 + shell: bash + run: $GITHUB_WORKSPACE/tools/ci/gha-cache-keys.sh + + - 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 +202,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 +213,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 +237,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 +253,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 +266,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..724ed562663 --- /dev/null +++ b/tools/ci/gha-cache-keys.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -ex + +echo "NJOY_HASH=$(git ls-remote https://github.com/njoy/NJOY2016.git HEAD \ + --branch 2016.78 | 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 [[ "$LIBMESH" == 'y' ]]; then + echo "LB_HASH=$(git ls-remote https://github.com/libmesh/libmesh \ + --branch v1.7.1 HEAD | head -c 15)" >> $GITHUB_ENV +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 From a404973377656a6249437e69977ff9450db93a54 Mon Sep 17 00:00:00 2001 From: John Vincent Cauilan <64677361+johvincau@users.noreply.github.com> Date: Thu, 2 Jul 2026 20:26:27 -0500 Subject: [PATCH 2/6] Add pip requirements caching for expensive wheels --- .github/workflows/ci.yml | 6 +++--- tools/ci/requirements.txt | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100755 tools/ci/requirements.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a9cd710ac8..b80d254d675 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,9 +110,9 @@ jobs: uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} -# cache: 'pip' # caching pip dependencies -# cache-dependency-path: | -# requirements-pip.txt + cache: 'pip' + cache-dependency-path: | + $GITHUB_WORKSPACE/tools/ci/requirements.txt - name: Environment Variables run: | diff --git a/tools/ci/requirements.txt b/tools/ci/requirements.txt new file mode 100755 index 00000000000..8a53cd39e1d --- /dev/null +++ b/tools/ci/requirements.txt @@ -0,0 +1,18 @@ +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 +mpi4py \ No newline at end of file From f4094ff8fc9a5ad16500f5482d105730492cdef1 Mon Sep 17 00:00:00 2001 From: John Vincent Cauilan <64677361+johvincau@users.noreply.github.com> Date: Sat, 4 Jul 2026 16:03:28 -0500 Subject: [PATCH 3/6] Specify pinned versions for NJOY, MOAB, and LIBMESH --- tools/ci/gha-cache-keys.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ci/gha-cache-keys.sh b/tools/ci/gha-cache-keys.sh index 724ed562663..97f731ba3b7 100755 --- a/tools/ci/gha-cache-keys.sh +++ b/tools/ci/gha-cache-keys.sh @@ -2,11 +2,11 @@ set -ex echo "NJOY_HASH=$(git ls-remote https://github.com/njoy/NJOY2016.git HEAD \ - --branch 2016.78 | head -c 15)" >> $GITHUB_ENV + --tags 2016.78 | 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 + --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 @@ -14,5 +14,5 @@ fi if [[ "$LIBMESH" == 'y' ]]; then echo "LB_HASH=$(git ls-remote https://github.com/libmesh/libmesh \ - --branch v1.7.1 HEAD | head -c 15)" >> $GITHUB_ENV + --tags v1.7.1 | head -c 15)" >> $GITHUB_ENV fi \ No newline at end of file From e56a8bea0d7bfb26ba25c90ab860711f66b17eec Mon Sep 17 00:00:00 2001 From: John Vincent Cauilan <64677361+johvincau@users.noreply.github.com> Date: Tue, 7 Jul 2026 16:22:38 -0500 Subject: [PATCH 4/6] Split pip cache key depending on mpi-dep version --- .github/workflows/ci.yml | 20 ++++++++++--------- tools/ci/gha-cache-keys.sh | 11 ++++++++++ ...equirements.txt => requirements-mpi-n.txt} | 4 ++-- tools/ci/requirements-mpi-y.txt | 7 +++++++ 4 files changed, 31 insertions(+), 11 deletions(-) rename tools/ci/{requirements.txt => requirements-mpi-n.txt} (81%) create mode 100755 tools/ci/requirements-mpi-y.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b80d254d675..e839ed3644d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,14 +106,6 @@ jobs: with: fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: | - $GITHUB_WORKSPACE/tools/ci/requirements.txt - - name: Environment Variables run: | echo "OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml" >> $GITHUB_ENV @@ -157,10 +149,20 @@ jobs: ~/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 + - name: Get dependency cache keys and mpi-dep versions shell: bash run: $GITHUB_WORKSPACE/tools/ci/gha-cache-keys.sh + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: | + $GITHUB_WORKSPACE/tools/ci/mpi-deps.txt + $GITHUB_WORKSPACE/tools/ci/requirements-mpi-${{ matrix.mpi }}.txt + + - name: Restore NJOY2016 uses: actions/cache@v6 with: diff --git a/tools/ci/gha-cache-keys.sh b/tools/ci/gha-cache-keys.sh index 97f731ba3b7..4f696ed0287 100755 --- a/tools/ci/gha-cache-keys.sh +++ b/tools/ci/gha-cache-keys.sh @@ -15,4 +15,15 @@ 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/requirements.txt b/tools/ci/requirements-mpi-n.txt similarity index 81% rename from tools/ci/requirements.txt rename to tools/ci/requirements-mpi-n.txt index 8a53cd39e1d..f5aecc94d0c 100755 --- a/tools/ci/requirements.txt +++ b/tools/ci/requirements-mpi-n.txt @@ -1,3 +1,4 @@ +# requirements-mpi-n.txt numpy h5py scipy @@ -14,5 +15,4 @@ pytest-rerunfailures colorama openpyxl coverage>=7.4 -gcovr>=7.2 -mpi4py \ No newline at end of file +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 From 563fa0f795640904c3112c03b58ab779289f3a7f Mon Sep 17 00:00:00 2001 From: John Vincent Cauilan <64677361+johvincau@users.noreply.github.com> Date: Tue, 7 Jul 2026 18:25:46 -0500 Subject: [PATCH 5/6] Revert to manual pip caching for control over key --- .github/workflows/ci.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e839ed3644d..3fcec8f380b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,6 +106,11 @@ jobs: with: fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + - name: Environment Variables run: | echo "OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml" >> $GITHUB_ENV @@ -153,15 +158,11 @@ jobs: shell: bash run: $GITHUB_WORKSPACE/tools/ci/gha-cache-keys.sh - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 + - name: Restore pip cache according to mpi-deps + uses: actions/cache@v6 with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: | - $GITHUB_WORKSPACE/tools/ci/mpi-deps.txt - $GITHUB_WORKSPACE/tools/ci/requirements-mpi-${{ matrix.mpi }}.txt - + path: ~/.cache/pip + key: pip-${{ runner.os }}-py${{ matrix.python-version }}-mpi-${{ matrix.mpi }}-${{ hashFiles(format('{0}/tools/ci/requirements*.txt', github.workspace)) }}-${{ hashFiles(format('{0}/tools/ci/mpi-deps.txt', github.workspace)) }} - name: Restore NJOY2016 uses: actions/cache@v6 From bf7468a619cbaf235427c0823b84e57172ab8410 Mon Sep 17 00:00:00 2001 From: John Vincent Cauilan <64677361+johvincau@users.noreply.github.com> Date: Wed, 8 Jul 2026 14:46:43 -0500 Subject: [PATCH 6/6] Configure pip key gen to use either requirements-mpi-y/n.txt --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3fcec8f380b..4d129df1fad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -162,7 +162,8 @@ jobs: uses: actions/cache@v6 with: path: ~/.cache/pip - key: pip-${{ runner.os }}-py${{ matrix.python-version }}-mpi-${{ matrix.mpi }}-${{ hashFiles(format('{0}/tools/ci/requirements*.txt', github.workspace)) }}-${{ hashFiles(format('{0}/tools/ci/mpi-deps.txt', github.workspace)) }} + 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