From 6682cab9272e18493b6bf9ac3b18ed7e335249ec Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Wed, 30 Oct 2024 13:23:07 -0500 Subject: [PATCH] Add callable workflow for building MPICH from source --- .github/workflows/build_mpich_source.yml | 78 +++++++++++++++++++ .github/workflows/test_build_mpich_source.yml | 14 ++++ 2 files changed, 92 insertions(+) create mode 100644 .github/workflows/build_mpich_source.yml create mode 100644 .github/workflows/test_build_mpich_source.yml diff --git a/.github/workflows/build_mpich_source.yml b/.github/workflows/build_mpich_source.yml new file mode 100644 index 00000000000..fa7b06f951a --- /dev/null +++ b/.github/workflows/build_mpich_source.yml @@ -0,0 +1,78 @@ +# Build MPICH from source using the latest commit on the +# 'main' branch and cache the results. The result is installed +# to (or restored to) '${{ runner.workspace }}/mpich'. + +# Triggers the workflow on a call from another workflow +on: + workflow_call: + inputs: + build_mode: + description: "production vs. debug build" + required: true + type: string + +permissions: + contents: read + +jobs: + ubuntu_gcc_build_and_test: + name: "Build MPICH ${{ inputs.build_mode }} (GCC)" + + runs-on: ubuntu-latest + + steps: + - name: Install Linux dependencies + run: | + sudo apt-get update + sudo apt-get install build-essential libtool libtool-bin + + - name: Get MPICH source + uses: actions/checkout@v4.1.7 + with: + repository: 'pmodels/mpich' + path: 'mpich' + submodules: recursive + + - name: Get MPICH commit hash + shell: bash + id: get-sha + run: | + cd $GITHUB_WORKSPACE/mpich + export MPICH_SHA=$(git rev-parse HEAD) + echo "MPICH_SHA=$MPICH_SHA" >> $GITHUB_ENV + echo "sha=$MPICH_SHA" >> $GITHUB_OUTPUT + # Output SHA for debugging + echo "MPICH_SHA=$MPICH_SHA" + + - name: Cache MPICH (GCC) installation + id: cache-mpich-ubuntu-gcc + uses: actions/cache@v4 + with: + path: ${{ runner.workspace }}/mpich + key: ${{ runner.os }}-${{ runner.arch }}-gcc-mpich-${{ steps.get-sha.outputs.sha }}-${{ inputs.build_mode }} + + - name: Install MPICH (GCC) (Production) + if: ${{ steps.cache-mpich-ubuntu-gcc.cache-hit != 'true' && (inputs.build_mode != 'debug') }} + run: | + cd $GITHUB_WORKSPACE/mpich + ./autogen.sh + ./configure \ + CC=gcc \ + --prefix=${{ runner.workspace }}/mpich \ + --enable-threads=multiple + make -j2 + make install + + - name: Install MPICH (GCC) (Debug) + if: ${{ steps.cache-mpich-ubuntu-gcc.cache-hit != 'true' && (inputs.build_mode == 'debug') }} + run: | + cd $GITHUB_WORKSPACE/mpich + ./autogen.sh + ./configure \ + CC=gcc \ + --prefix=${{ runner.workspace }}/mpich \ + --enable-g=most \ + --enable-debuginfo \ + --enable-threads=multiple + make -j2 + make install diff --git a/.github/workflows/test_build_mpich_source.yml b/.github/workflows/test_build_mpich_source.yml new file mode 100644 index 00000000000..bde4e26c1d5 --- /dev/null +++ b/.github/workflows/test_build_mpich_source.yml @@ -0,0 +1,14 @@ +name: Test building MPICH from source + +on: + workflow_dispatch: + +permissions: + contents: read + +jobs: + debug: + name: "MPICH debug" + uses: ./.github/workflows/build_mpich_source.yml + with: + build_mode: "debug" \ No newline at end of file