Skip to content

Add callable workflow for building OpenMPI from source #1

Add callable workflow for building OpenMPI from source

Add callable workflow for building OpenMPI from source #1

# Build OpenMPI from source using the latest commit on the
# 'main' branch and cache the results
# Triggers the workflow on a call from another workflow
on:
workflow_call:
inputs:
install_path:
description: "location to install OpenMPI to or restore to from cache"
required: true
type: string
build_mode:
description: "production vs. debug build"
required: true
type: string
permissions:
contents: read
jobs:
ubuntu_gcc_build_and_test:
name: "Build OpenMPI ${{ 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 OpenMPI Source
uses: actions/[email protected]
repository: 'open-mpi/ompi'

Check failure on line 34 in .github/workflows/build_openmpi_source.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build_openmpi_source.yml

Invalid workflow file

You have an error in your yaml syntax on line 34
path: 'ompi'
submodules: recursive
- name: Get OpenMPI commit hash
shell: bash
id: get-sha
run: |
cd $GITHUB_WORKSPACE/ompi
export OPENMPI_SHA=$(git rev-parse HEAD)
echo "OPENMPI_SHA=$OPENMPI_SHA" >> $GITHUB_ENV
echo "sha=$OPENMPI_SHA" >> $GITHUB_OUTPUT
# Output SHA for debugging
echo "OPENMPI_SHA=$OPENMPI_SHA"
- name: Cache OpenMPI (GCC) installation
id: cache-openmpi-ubuntu-gcc
uses: actions/cache@v4
with:
path: ${{ inputs.install_path }}
key: ${{ runner.os }}-${{ runner.arch }}-gcc-openmpi-${{ steps.get-sha.outputs.sha }}
- name: Install OpenMPI (GCC) (Production)
if: ${{ steps.cache-openmpi-ubuntu-gcc.cache-hit != 'true' && (inputs.build_mode != 'debug') }}
run: |
cd $GITHUB_WORKSPACE/ompi
./autogen.pl
./configure \
CC=gcc \
--prefix=${{ inputs.install_path }}
make -j2
make install
- name: Install OpenMPI (GCC) (Debug)
if: ${{ steps.cache-openmpi-ubuntu-gcc.cache-hit != 'true' && (inputs.build_mode == 'debug') }}
run: |
cd $GITHUB_WORKSPACE/ompi
./autogen.pl
./configure \
CC=gcc \
--prefix=${{ inputs.install_path }} \
--enable-debug
make -j2
make install