Skip to content

Build wheels

Build wheels #10

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Build wheels
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 0 * * 3' # weekly
jobs:
build:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
platform: [x64]
MB_ML_VER: [2014]
include:
- python-version: '3.8'
os: ubuntu-latest
PLAT: x86_64
- python-version: '3.9'
os: ubuntu-latest
PLAT: x86_64
- python-version: '3.10'
os: ubuntu-latest
PLAT: x86_64
- python-version: '3.11'
os: ubuntu-latest
PLAT: x86_64
- python-version: '3.10'
os: macos-latest
PLAT: x86_64
- python-version: '3.11'
os: macos-latest
PLAT: x86_64
- python-version: '3.8'
os: macos-latest
PLAT: x86_64
- python-version: '3.8'
os: macos-latest
PLAT: universal2
- python-version: '3.9'
os: macos-latest
PLAT: universal2
- python-version: '3.10'
os: macos-latest
PLAT: universal2
- python-version: '3.11'
os: macos-latest
PLAT: universal2
env:
REPO_DIR: nipy
PKG_NAME: nipy
BUILD_COMMIT: main
UNICODE_WIDTH: 32
MB_PYTHON_VERSION: ${{ matrix.python-version }}
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
MB_ML_VER: ${{ matrix.MB_ML_VER }}
PLAT: ${{ matrix.PLAT }}
SCIPY_DEP: scipy
TRAVIS_REPO_SLUG: ${{ github.repository }}
TRAVIS_BRANCH: ${{ github.head_ref }}
TRAVIS_PULL_REQUEST: ${{ github.event.number }}
TRAVIS_BUILD_DIR: ${{ github.workspace }}
SCIPY_WHEELS_NIGHTLY_ACCESS: ${{ secrets.SCIPY_WHEELS_NIGHTLY_ACCESS }}
MULTIBUILD_WHEELS_STAGING_ACCESS: ${{ secrets.MULTIBUILD_WHEELS_STAGING_ACCESS }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Pin Numpy and Scipy version
run: |
if [ "$MB_PYTHON_VERSION" == '3.8' ]; then
echo "NP_BUILD_DEP=$(echo numpy==1.22.2)" >> $GITHUB_ENV;
echo "NP_TEST_DEP=$(echo numpy==1.22.2)" >> $GITHUB_ENV;
elif [ "$MB_PYTHON_VERSION" == '3.9' ]; then
echo "NP_BUILD_DEP=$(echo numpy==1.22.2)" >> $GITHUB_ENV;
echo "NP_TEST_DEP=$(echo numpy==1.22.2)" >> $GITHUB_ENV;
elif [ "$MB_PYTHON_VERSION" == '3.10' ]; then
echo "NP_BUILD_DEP=$(echo numpy==1.22.2)" >> $GITHUB_ENV;
echo "NP_TEST_DEP=$(echo numpy==1.22.2)" >> $GITHUB_ENV;
elif [ "$PYTHON_VERSION" == '3.11' ]; then
echo "NP_BUILD_DEP=$(echo numpy==1.23.2)" >> $GITHUB_ENV
echo "NP_TEST_DEP=$(echo numpy==1.23.2)" >> $GITHUB_ENV
elif [ "$PYTHON_VERSION" == '3.12' ]; then
echo "NP_BUILD_DEP=$(echo numpy==1.26.0)" >> $GITHUB_ENV
echo "NP_TEST_DEP=$(echo numpy==1.26.0)" >> $GITHUB_ENV
else
echo "None of the defined python versions, use default"
fi
- name: Setup Environment variables
run: |
if [ "schedule" == "${{ github.event_name }}" ] || [ "main" == "$BUILD_COMMIT" ]; then echo "ANACONDA_ORG=scipy-wheels-nightly" >> $GITHUB_ENV; else echo "ANACONDA_ORG=multibuild-wheels-staging" >> $GITHUB_ENV; fi
if [ "schedule" == "${{ github.event_name }}" ] || [ "main" == "$BUILD_COMMIT" ]; then echo "TOKEN=$SCIPY_WHEELS_NIGHTLY_ACCESS" >> $GITHUB_ENV; else echo "TOKEN=$MULTIBUILD_WHEELS_STAGING_ACCESS" >> $GITHUB_ENV; fi
if [ "macos-latest" == "${{ matrix.os }}" ]; then echo "TRAVIS_OS_NAME=osx" >> $GITHUB_ENV; else echo "TRAVIS_OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV; fi
if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP Cython nibabel)" >> $GITHUB_ENV;
echo "TEST_DEPENDS=$(echo $NP_TEST_DEP pytest nibabel $SCIPY_DEP pytest-doctestplus)" >> $GITHUB_ENV;
- name: Setup Special Environment variables for Linux
if: startsWith(matrix.os,'ubuntu') && matrix.MB_ML_VER == 2010
run: |
echo "DOCKER_TEST_IMAGE=$(echo multibuild/xenial_$PLAT)" >> $GITHUB_ENV
- name: Print some Environment variable
run: |
echo "ANACONDA_ORG: ${ANACONDA_ORG}"
echo "TRAVIS_BRANCH: ${TRAVIS_BRANCH}"
echo "TRAVIS_PULL_REQUEST: ${TRAVIS_PULL_REQUEST}"
echo "TRAVIS_REPO_SLUG: ${TRAVIS_REPO_SLUG}"
echo "TRAVIS_EVENT_TYPE: ${TRAVIS_EVENT_TYPE}"
echo "TRAVIS_OS_NAME: ${TRAVIS_OS_NAME}"
echo "NP_BUILD_DEP: ${NP_BUILD_DEP}"
echo "NP_TEST_DEP: ${NP_TEST_DEP}"
echo "PLAT: ${PLAT}"
echo "DOCKER_TEST_IMAGE: ${DOCKER_TEST_IMAGE}"
echo "BUILD_DEPENDS: ${BUILD_DEPENDS}"
echo "TEST_DEPENDS: ${TEST_DEPENDS}"
echo "BUILD_COMMIT: ${BUILD_COMMIT}"
- name: Install VirtualEnv
run: |
python -m pip install --upgrade pip
pip install virtualenv
- name: Build and Install Wheels
run: |
source multibuild/common_utils.sh
source multibuild/travis_steps.sh
echo "------- BEFORE INSTALL --------"
before_install
echo "------- CLEAN CODE --------"
clean_code $REPO_DIR $BUILD_COMMIT
echo "------- BUILD WHEEL --------"
build_wheel $REPO_DIR $PLAT
echo "------- INSTALL_RUN --------"
install_run $PLAT
- name: Upload wheels
if: always()
run: |
# trigger an upload to the shared ecosystem
# infrastructure at: https://anaconda.org/scipy-wheels-nightly
# for cron jobs only (restricted to master branch once
# per week)
# SCIPY_WHEELS_NIGHTLY_ACCESS is a secret token
# used in Travis CI config, originally
#
# for merges (push events) we use the staging area instead;
# MULTIBUILD_WHEELS_STAGING_ACCESS is a secret token used in Travis
# CI config, originally generated at anaconda.org for
# multibuild-wheels-staging
# generated at anaconda.org for scipy-wheels-nightly
if [ "$TRAVIS_EVENT_TYPE" == "cron" ] || [ "$TRAVIS_EVENT_TYPE" == "push" ]; then
pip install git+https://github.com/Anaconda-Platform/anaconda-client.git@ce89e4351eef0f3d2840c713397e013231de25f8;
ls ${TRAVIS_BUILD_DIR}/wheelhouse/*.whl
anaconda -t ${TOKEN} upload --force -u ${ANACONDA_ORG} ${TRAVIS_BUILD_DIR}/wheelhouse/*.whl;
fi