Skip to content

28 general info

28 general info #80

Workflow file for this run

name: Test OpenBT Python Source Distribution
env:
CLONE_PATH: ${{ github.workspace }}
PKG_ROOT: ${{ github.workspace }}/openbt_pypkg
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
# Have this run on release so that it produces a Python source distribution
# whose version is correctly set to the release's vX.Y.Z tag.
branches: [main]
types: [published]
jobs:
#####----- BUILD SOURCE DISTRIBUTION
# Build a single source distribution that will be used for testing across all
# different test setups. This distribution is stored as an artifact so that
# it can be manually uploaded directly to PyPI as the official (and well
# tested) release.
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Setup base Python environment
run: $CLONE_PATH/.github/workflows/setup_base_python.sh ${{ runner.os }}
- name: Build src dist
run: |
pushd $PKG_ROOT
python -m build --sdist
ls -lart ./dist
popd
- name: Archive distributions
uses: actions/upload-artifact@v7
with:
name: OpenBT-distribution
path: |
${{ env.PKG_ROOT }}/dist/openbt-*.tar.gz
#####----- FULL TESTING WITHOUT COVERAGE
# Prefer full end-to-end test of installation built from source distribution
# rather than testing in local clone alone. In particular we test this in the
# similar way to how a user might install/test it.
#
# Since this is the main test action with many different test setups, we
# install different MPI implementations via OS package managers. The devmode
# action confirms that users can install MPI implementations using PyPI/pip.
test_sdist:
needs: [build]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-14, macos-15, macos-26, macos-26-intel,
ubuntu-22.04, ubuntu-24.04]
mpi_impl: ["openmpi", "mpich"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
exclude:
# MPICH+Ubuntu24.04 tests presently fail because they detect only one
# MPI process instead of two. I suspect that this is related to using
# an mpirun that is not associated with the MPI used to build the
# CLTs. Note that Meson failed as expected when I didn't install any
# MPI implementation, which suggests that there isn't a default
# installation. Unfortunately paths to mpirun and mpicxx don't offer
# much insight into what is found or if there are crossed
# installations.
#
# Next testing steps would be to build a minimal MPI program and see
# if I can reproduce the issue.
- os: ubuntu-24.04
mpi_impl: "mpich"
steps:
##-- Setup Testing Environment
- name: Checkout OpenBT
uses: actions/checkout@v7
- name: Install ${{ matrix.mpi_impl }}
run: |
if [ "${{ runner.os }}" = "Linux" ]; then
sudo apt-get update
if [ "${{ matrix.mpi_impl }}" = "openmpi" ]; then
sudo apt-get -y install openmpi-bin libopenmpi-dev
elif [ "${{ matrix.mpi_impl }}" = "mpich" ]; then
sudo apt-get -y install mpich libmpich-dev
else
echo "Cannot install ${{ matrix.mpi_impl }} for Linux"
exit 1
fi
elif [ "${{ runner.os }}" = "macOS" ]; then
if [ "${{ matrix.mpi_impl }}" = "openmpi" ]; then
brew install open-mpi
elif [ "${{ matrix.mpi_impl }}" = "mpich" ]; then
brew install mpich
else
echo "Cannot install ${{ matrix.mpi_impl }} for macOS"
exit 1
fi
fi
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Setup Python dependencies
run: $CLONE_PATH/.github/workflows/setup_base_python.sh ${{ runner.os }}
- uses: actions/download-artifact@v8
with:
name: OpenBT-distribution
path: ${{ env.PKG_ROOT }}/dist
##-- Run full test suite
- name: Run full OpenBT test suite
run: |
distribution=$PKG_ROOT/dist/openbt-*.tar.gz
ls -la $distribution
venv=$CLONE_PATH/TestSrc
which python
python -m venv $venv
. $venv/bin/activate
which python
python -m pip install --upgrade pip
python -m pip install -v $distribution
python -m pip list
python -c "import openbt ; print(openbt.__version__) ; exit(not openbt.test())"