Build wheels (Windows) #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: [ main ] | |
pull_request: | |
branches: [ main ] | |
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 nipy | |
env: | |
BUILD_COMMIT: main | |
REPO_DIR: nipy | |
PKG_NAME: nipy | |
NP_BUILD_DEP: "numpy==1.13.3" | |
NP_TEST_DEP: "numpy==1.13.3" | |
EXTRA_FLAGS: "" | |
CYTHON_DEP: "Cython>=3" | |
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 }} | |
CYTHON_DEP: "Cython>=3" | |
run: | | |
if [ "$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 [ "$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 [ "$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 version, 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 [ "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=main" >> $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)" >> $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 | |
pip install ${NP_BUILD_DEP} ${CYTHON_DEP} ${SCIPY_DEP} | |
cd ${REPO_DIR} | |
pip install -r dev-requirements.txt | |
echo "------- Checkout BUILD_COMMIT --------" | |
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} | |
pip wheel . | |
cd .. | |
- name: Install Tests Dependencies | |
run: | | |
# Install the test dependencies | |
pip install ${NP_TEST_DEP} ${SCIPY_DEP} ${CYTHON_DEP} | |
pip install --pre --no-index --find-links ./${REPO_DIR} ${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-plus --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 main 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}/*.whl | |
anaconda -t ${TOKEN} upload --force -u ${ANACONDA_ORG} ./${REPO_DIR}/*.whl; | |
fi |