break up Python CI steps so reading logs is easier

release/4.3a0
Varun Agrawal 2022-07-26 13:11:21 -04:00
parent a700c87504
commit d92ce6ba9a
2 changed files with 60 additions and 38 deletions

View File

@ -43,8 +43,10 @@ if [ -z ${PYTHON_VERSION+x} ]; then
exit 127 exit 127
fi fi
PYTHON="python${PYTHON_VERSION}" export PYTHON="python${PYTHON_VERSION}"
function install_dependencies()
{
if [[ $(uname) == "Darwin" ]]; then if [[ $(uname) == "Darwin" ]]; then
brew install wget brew install wget
else else
@ -52,18 +54,20 @@ else
sudo apt-get install -y wget libicu-dev python3-pip python3-setuptools sudo apt-get install -y wget libicu-dev python3-pip python3-setuptools
fi fi
PATH=$PATH:$($PYTHON -c "import site; print(site.USER_BASE)")/bin export PATH=$PATH:$($PYTHON -c "import site; print(site.USER_BASE)")/bin
[ "${GTSAM_WITH_TBB:-OFF}" = "ON" ] && install_tbb [ "${GTSAM_WITH_TBB:-OFF}" = "ON" ] && install_tbb
$PYTHON -m pip install -r $GITHUB_WORKSPACE/python/requirements.txt
}
BUILD_PYBIND="ON" function build()
{
sudo $PYTHON -m pip install -r $GITHUB_WORKSPACE/python/requirements.txt
mkdir $GITHUB_WORKSPACE/build mkdir $GITHUB_WORKSPACE/build
cd $GITHUB_WORKSPACE/build cd $GITHUB_WORKSPACE/build
BUILD_PYBIND="ON"
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
-DGTSAM_BUILD_TESTS=OFF \ -DGTSAM_BUILD_TESTS=OFF \
-DGTSAM_BUILD_UNSTABLE=${GTSAM_BUILD_UNSTABLE:-ON} \ -DGTSAM_BUILD_UNSTABLE=${GTSAM_BUILD_UNSTABLE:-ON} \
@ -84,5 +88,22 @@ make -j2 install
cd $GITHUB_WORKSPACE/build/python cd $GITHUB_WORKSPACE/build/python
$PYTHON -m pip install --user . $PYTHON -m pip install --user .
}
function test()
{
cd $GITHUB_WORKSPACE/python/gtsam/tests cd $GITHUB_WORKSPACE/python/gtsam/tests
$PYTHON -m unittest discover -v $PYTHON -m unittest discover -v
}
# select between build or test
case $1 in
-d)
install_dependencies
-b)
build
;;
-t)
test
;;
esac

View File

@ -117,11 +117,12 @@ jobs:
uses: pierotofy/set-swap-space@master uses: pierotofy/set-swap-space@master
with: with:
swap-size-gb: 6 swap-size-gb: 6
- name: Build (Linux) - name: Install Dependencies
if: runner.os == 'Linux'
run: | run: |
bash .github/scripts/python.sh bash .github/scripts/python.sh -d
- name: Build (macOS) - name: Build
if: runner.os == 'macOS'
run: | run: |
bash .github/scripts/python.sh bash .github/scripts/python.sh -b
- name: Test
run: |
bash .github/scripts/python.sh -t