Skip to content

Commit

Permalink
Begin work to integrate cibuildwheel tests. (#351)
Browse files Browse the repository at this point in the history
* Test and deploy binary pip wheels:

 - Add scripts to be run inside a cibuildwheel docker image on both linux
   and macos which installs static versions of OpenBLAS (linux only), fftw,
   and suitesparse.  Link our internal _libtoast extension to these static
   packages, which ensures consistency regardless of other shared libraries
   loaded by other packages.

 - Add a github workflow which tests pip wheel building daily, and preserves
   the wheels as artifacts which can be downloaded and tested as needed.
   This also runs the unit tests on the installed wheel packages (linux and
   macos, python 3.6-3.8).

 - Add a deployment workflow executed on git tags which uploads to pypi.
   this will likely need some testing during 2.3.7 tag preparation.

 - Cleanup package definitions in setup.py, version generation, and add a
   MANIFEST.in file to ensure that extra package files are bundled.

* Use path relative to setup.py when generating version.

* Require python 3.6.0 or newer.  Add documentation for the release process.
  • Loading branch information
tskisner authored May 30, 2020
1 parent 3471da9 commit 6c02c9f
Show file tree
Hide file tree
Showing 19 changed files with 630 additions and 45 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Deploy tagged releases.

name: Deploy Release

on:
push:
tags:
- '*'

env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}

jobs:
py36:
name: Python 3.6 wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
env:
CIBW_BUILD: cp36-macosx_x86_64 cp36-manylinux_x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
CIBW_BUILD_VERBOSITY: 3
CIBW_ENVIRONMENT_LINUX: "TOAST_STATIC_DEPS=1 TOAST_BUILD_BLAS_LIBRARIES='-lopenblas -fopenmp -lm -lgfortran' TOAST_BUILD_LAPACK_LIBRARIES='-lopenblas -fopenmp -lm -lgfortran'"
CIBW_ENVIRONMENT_MACOS: "TOAST_STATIC_DEPS=1"
CIBW_BEFORE_BUILD_LINUX: ./wheels/install_deps_linux.sh
CIBW_BEFORE_BUILD_MACOS: ./wheels/install_deps_osx.sh
CIBW_BEFORE_TEST: echo "" >/dev/null
CIBW_TEST_COMMAND: export OMP_NUM_THREADS=2; python -c 'import toast.tests; toast.tests.run()'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- name: Install cibuildwheel
run: |
python -m pip install twine cibuildwheel==1.4.2
- name: Build wheel
run: |
python -m cibuildwheel --output-dir wheelhouse
- name: Upload to PyPI
run: |
python -m twine upload wheelhouse/toast*.whl
py37:
name: Python 3.7 wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
env:
CIBW_BUILD: cp37-macosx_x86_64 cp37-manylinux_x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
CIBW_BUILD_VERBOSITY: 3
CIBW_ENVIRONMENT_LINUX: "TOAST_STATIC_DEPS=1 TOAST_BUILD_BLAS_LIBRARIES='-lopenblas -fopenmp -lm -lgfortran' TOAST_BUILD_LAPACK_LIBRARIES='-lopenblas -fopenmp -lm -lgfortran'"
CIBW_ENVIRONMENT_MACOS: "TOAST_STATIC_DEPS=1"
CIBW_BEFORE_BUILD_LINUX: ./wheels/install_deps_linux.sh
CIBW_BEFORE_BUILD_MACOS: ./wheels/install_deps_osx.sh
CIBW_BEFORE_TEST: echo "" >/dev/null
CIBW_TEST_COMMAND: export OMP_NUM_THREADS=2; python -c 'import toast.tests; toast.tests.run()'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- name: Install cibuildwheel
run: |
python -m pip install twine cibuildwheel==1.4.2
- name: Build wheel
run: |
python -m cibuildwheel --output-dir wheelhouse
- name: Upload to PyPI
run: |
python -m twine upload wheelhouse/toast*.whl
py38:
name: Python 3.8 wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
env:
CIBW_BUILD: cp38-macosx_x86_64 cp38-manylinux_x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
CIBW_BUILD_VERBOSITY: 3
CIBW_ENVIRONMENT_LINUX: "TOAST_STATIC_DEPS=1 TOAST_BUILD_BLAS_LIBRARIES='-lopenblas -fopenmp -lm -lgfortran' TOAST_BUILD_LAPACK_LIBRARIES='-lopenblas -fopenmp -lm -lgfortran'"
CIBW_ENVIRONMENT_MACOS: "TOAST_STATIC_DEPS=1"
CIBW_BEFORE_BUILD_LINUX: ./wheels/install_deps_linux.sh
CIBW_BEFORE_BUILD_MACOS: ./wheels/install_deps_osx.sh
CIBW_BEFORE_TEST: echo "" >/dev/null
CIBW_TEST_COMMAND: export OMP_NUM_THREADS=2; python -c 'import toast.tests; toast.tests.run()'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- name: Install cibuildwheel
run: |
python -m pip install twine cibuildwheel==1.4.2
- name: Build wheel
run: |
python -m cibuildwheel --output-dir wheelhouse
- name: Upload to PyPI
run: |
python -m twine upload wheelhouse/toast*.whl
115 changes: 115 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@

name: Test Binary Wheels

# Uncomment here for testing and comment out schedule below.
# on:
# push:
# branches: [ master ]
# pull_request:
# branches: [ master ]

# Uncomment here for production and comment out push / PR above.
on:
schedule:
- cron: '0 4 * * *'

jobs:
py36:
name: Python 3.6 wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
env:
CIBW_BUILD: cp36-macosx_x86_64 cp36-manylinux_x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
CIBW_BUILD_VERBOSITY: 3
CIBW_ENVIRONMENT_LINUX: "TOAST_STATIC_DEPS=1 TOAST_BUILD_BLAS_LIBRARIES='-lopenblas -fopenmp -lm -lgfortran' TOAST_BUILD_LAPACK_LIBRARIES='-lopenblas -fopenmp -lm -lgfortran'"
CIBW_ENVIRONMENT_MACOS: "TOAST_STATIC_DEPS=1"
CIBW_BEFORE_BUILD_LINUX: ./wheels/install_deps_linux.sh
CIBW_BEFORE_BUILD_MACOS: ./wheels/install_deps_osx.sh
CIBW_BEFORE_TEST: echo "" >/dev/null
CIBW_TEST_COMMAND: export OMP_NUM_THREADS=2; python -c 'import toast.tests; toast.tests.run()'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==1.4.2
- name: Build wheel
run: |
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
with:
name: wheels
path: ./wheelhouse
py37:
name: Python 3.7 wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
env:
CIBW_BUILD: cp37-macosx_x86_64 cp37-manylinux_x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
CIBW_BUILD_VERBOSITY: 3
CIBW_ENVIRONMENT_LINUX: "TOAST_STATIC_DEPS=1 TOAST_BUILD_BLAS_LIBRARIES='-lopenblas -fopenmp -lm -lgfortran' TOAST_BUILD_LAPACK_LIBRARIES='-lopenblas -fopenmp -lm -lgfortran'"
CIBW_ENVIRONMENT_MACOS: "TOAST_STATIC_DEPS=1"
CIBW_BEFORE_BUILD_LINUX: ./wheels/install_deps_linux.sh
CIBW_BEFORE_BUILD_MACOS: ./wheels/install_deps_osx.sh
CIBW_BEFORE_TEST: echo "" >/dev/null
CIBW_TEST_COMMAND: export OMP_NUM_THREADS=2; python -c 'import toast.tests; toast.tests.run()'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==1.4.2
- name: Build wheel
run: |
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
with:
name: wheels
path: ./wheelhouse
py38:
name: Python 3.8 wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
env:
CIBW_BUILD: cp38-macosx_x86_64 cp38-manylinux_x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
CIBW_BUILD_VERBOSITY: 3
CIBW_ENVIRONMENT_LINUX: "TOAST_STATIC_DEPS=1 TOAST_BUILD_BLAS_LIBRARIES='-lopenblas -fopenmp -lm -lgfortran' TOAST_BUILD_LAPACK_LIBRARIES='-lopenblas -fopenmp -lm -lgfortran'"
CIBW_ENVIRONMENT_MACOS: "TOAST_STATIC_DEPS=1"
CIBW_BEFORE_BUILD_LINUX: ./wheels/install_deps_linux.sh
CIBW_BEFORE_BUILD_MACOS: ./wheels/install_deps_osx.sh
CIBW_BEFORE_TEST: echo "" >/dev/null
CIBW_TEST_COMMAND: export OMP_NUM_THREADS=2; python -c 'import toast.tests; toast.tests.run()'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==1.4.2
- name: Build wheel
run: |
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
with:
name: wheels
path: ./wheelhouse
11 changes: 3 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Auxiliary files
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

# Copy the RELEASE file into the build directory
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/RELEASE"
"${CMAKE_CURRENT_BINARY_DIR}/RELEASE"
COPYONLY
)

# Use GNUInstallDirs to install libraries into correct locations on all
# platforms.
include(GNUInstallDirs)
Expand Down Expand Up @@ -69,8 +62,10 @@ if(BLAS_FOUND)
if(LAPACK_FOUND)
find_package(LAPACKnames)
else(LAPACK_FOUND)
message(SEND_ERROR "Could not find a working LAPACK installation")
message(FATAL_ERROR "Could not find a working LAPACK installation")
endif(LAPACK_FOUND)
else(BLAS_FOUND)
message(FATAL_ERROR "Could not find a working BLAS installation")
endif(BLAS_FOUND)

find_package(FFTW)
Expand Down
10 changes: 10 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
include README.md
include AUTHORS
include LICENSE
include src
include CMakeLists.txt
include tutorial
include example
include platforms
include cmake
include docs
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Time Ordered Astrophysics Scalable Tools

[![Build Status](https://travis-ci.org/hpc4cmb/toast.svg?branch=master)](https://travis-ci.org/hpc4cmb/toast)
![Build Status](https://github.com/hpc4cmb/toast/workflows/Run%20Test%20Suite/badge.svg?branch=master)

See the full documentation here:

Expand Down
1 change: 0 additions & 1 deletion RELEASE

This file was deleted.

14 changes: 5 additions & 9 deletions cmake/FindAATM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,18 @@ if(PKG_CONFIG_FOUND AND NOT AATM_ROOT)
endif()

# Check whether to search static or dynamic libs
set(CMAKE_FIND_LIBRARY_SUFFIXES_SAV ${CMAKE_FIND_LIBRARY_SUFFIXES})

set(AATM_LIB_NAME "aatm")

if(${AATM_USE_STATIC_LIBS})
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV})
set(AATM_LIB_NAME "aatm_static")
endif()

if(AATM_ROOT)
# find libs
find_library(
AATM_LIB
NAMES "aatm"
NAMES ${AATM_LIB_NAME}
PATHS ${AATM_ROOT}
PATH_SUFFIXES "lib" "lib64"
NO_DEFAULT_PATH
Expand All @@ -54,7 +53,7 @@ if(AATM_ROOT)
else(AATM_ROOT)
find_library(
AATM_LIB
NAMES "aatm"
NAMES ${AATM_LIB_NAME}
PATHS "${PKG_AATM_PREFIX}"
PATH_SUFFIXES "lib" "lib64"
)
Expand All @@ -70,9 +69,6 @@ if(AATM_LIB)
set(AATM_LIBRARIES ${AATM_LIB})
endif(AATM_LIB)

# Restore variable
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV})

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(AATM
Expand Down
34 changes: 34 additions & 0 deletions docs/dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,37 @@ exposed through pybind11 should also have docstrings defined in the bindings. C
that is not exposed to python is considered internal, expert-level code that does not
require formal documentation. However, such code should have sufficient comments to
describe the algorithm and design choices.

Testing Workflow
--------------------------

We are using a github workflow to pull docker containers with our dependencies and run
our unit tests. Those docker containers are re-generated whenever a new tag is made on
the `cmbenv git repository <https://github.com/hpc4cmb/cmbenv>`_. So if there are
dependencies that need to be updated, open a PR against cmbenv which updates the version
or build in the package file. After merging and tagging a new cmbenv release the
updated docker images will be available in an hour or two and be used automatically.

Release Process
---------------------------

There are some github workflows that only run when a new tag is created. Unless you are
sure everything works, create a "release candidate" tag first. Before making a tag,
ensure that the `docs/changes.rst` file contains all pull requests that have been merged
since the last tag. Also edit the `src/toast/RELEASE` file and set the version to a
`PEP-440 compatible string <https://www.python.org/dev/peps/pep-0440/>`_. Next go onto
the github releases page and create a new release from the master branch. Briefly, the
format for a stable release, a release candidate or alpha version is:

2.6.9
2.6.7rc2
2.6.8a1

After tagging the release, verify that the github workflow to deploy pip wheels runs and
uploads these to PyPI. The conda-forge bots will automatically detect the new tag and
open a PR to update the feedstock. Also, after the release is complete, update the
`RELEASE` file to be at the "alpha" of the next release. For example, after tagging
version 3.4.5, set the version in the RELEASE file to 3.4.6a1. This version is **only**
used when building pip wheels. Anyone installing locally with setup.py or with pip
running on the local source tree will get a version constructed from the number of
commits since the last git tag.
Loading

0 comments on commit 6c02c9f

Please sign in to comment.