Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Build wheels (Windows) #169

Build wheels (Windows)

Build wheels (Windows) #169

# 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 (Windows)
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 0 * * 0' # weekly
jobs:
build:
# if: ${{ false }} # disable for now
runs-on: windows-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10', 3.11, 3.12]
platform: [x64] # Deactivate x32, until fix in dipy
env:
BUILD_COMMIT: master # 1.7.0
REPO_DIR: dipy
PKG_NAME: dipy
NP_BUILD_DEP: "numpy==1.13.3"
NP_TEST_DEP: "numpy==1.13.3"
EXTRA_FLAGS: ""
CYTHON_DEP: "Cython==0.29.24"
SCIPY_DEP: "scipy"
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, Scipy and Cython version
env:
PYTHON_VERSION: ${{ matrix.python-version }}
run: |
if [ "$PYTHON_VERSION" == '3.8' ]; then
echo "NP_BUILD_DEP=$(echo numpy==1.17.3)" >> $GITHUB_ENV
echo "NP_TEST_DEP=$(echo numpy==1.17.3)" >> $GITHUB_ENV
elif [ "$PYTHON_VERSION" == '3.9' ]; then
echo "NP_BUILD_DEP=$(echo numpy==1.19.4)" >> $GITHUB_ENV
echo "NP_TEST_DEP=$(echo numpy==1.19.4)" >> $GITHUB_ENV
echo "CYTHON_DEP=$(echo Cython==0.29.24)" >> $GITHUB_ENV
elif [ "$PYTHON_VERSION" == '3.10' ]; then
echo "NP_BUILD_DEP=$(echo numpy==1.22.0)" >> $GITHUB_ENV
echo "NP_TEST_DEP=$(echo numpy==1.22.0)" >> $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
echo "CYTHON_DEP=$(echo Cython==0.29.30)" >> $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 version, use default"
fi
- name: Setup Environment variables
run: |
if [ "schedule" == "${{ github.event_name }}" ] || [ "master" == "$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 }}" ] || [ "master" == "$BUILD_COMMIT" ]; then echo "TOKEN=$SCIPY_WHEELS_NIGHTLY_ACCESS" >> $GITHUB_ENV; else echo "TOKEN=$MULTIBUILD_WHEELS_STAGING_ACCESS" >> $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 nose pytest nibabel $SCIPY_DEP)" >> $GITHUB_ENV
- name: Print some Environment variable
run: |
echo "ANACONDA_ORG: ${ANACONDA_ORG}"
echo "TRAVIS_EVENT_TYPE: ${TRAVIS_EVENT_TYPE}"
echo "SCIPY_DEP: ${SCIPY_DEP}"
echo "NP_BUILD_DEP: ${NP_BUILD_DEP}"
echo "NP_TEST_DEP: ${NP_TEST_DEP}"
echo "CYTHON_DEP: ${CYTHON_DEP}"
echo "BUILD_DEPENDS: ${BUILD_DEPENDS}"
echo "TEST_DEPENDS: ${TEST_DEPENDS}"
echo "BUILD_COMMIT: ${BUILD_COMMIT}"
- name: Install Dependencies
run: |
echo "------- Update PIP --------"
python -m pip install --upgrade pip
echo "------- Install Dependencies--------"
pip install wheel==0.26
pip install ${NP_BUILD_DEP} ${CYTHON_DEP} ${SCIPY_DEP} nibabel tqdm
echo "------- Checkout BUILD_COMMIT --------"
cd ${REPO_DIR}
git submodule update --init
git fetch --tags
git show-ref
git remote -vv
git checkout ${BUILD_COMMIT}
cd ..
- name: Build Wheels
run: |
cd ${REPO_DIR}
python setup.py bdist_wheel
cd ..
- name: Install Tests Dependencies
run: |
# Install the test dependencies
pip install ${NP_TEST_DEP} ${SCIPY_DEP} ${CYTHON_DEP} nose pytest h5py
pip install --pre --no-index --find-links ./${REPO_DIR}/dist ${PKG_NAME}
- name: Run Tests
env:
MPLBACKEND: Agg
run: |
# Change into an innocuous directory and find tests from installation
mkdir for_testing
cd for_testing
python --version
pytest -s --doctest-modules --verbose --pyargs ${PKG_NAME}
cd ..
- 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 ./${REPO_DIR}/dist/*.whl
anaconda -t ${TOKEN} upload --force -u ${ANACONDA_ORG} ./${REPO_DIR}/dist/*.whl;
fi