Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frankenstein hack for gh actions #15

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Workflow to build and test wheels
name: Wheel builder

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
# Build the wheels for Linux, Windows and macOS for Python 3.7 and newer
build_wheels:
name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }}
runs-on: ${{ matrix.os }}

strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python: [37, 38, 39]
bitness: [32, 64]
manylinux_image: [manylinux1, manylinux2010]
include:
# Run 32 and 64 bit version in parallel for Linux and Windows
- os: windows-latest
bitness: 64
platform_id: win_amd64
- os: windows-latest
bitness: 32
platform_id: win32
- os: ubuntu-latest
bitness: 64
platform_id: manylinux_x86_64
- os: ubuntu-latest
bitness: 32
platform_id: manylinux_i686
- os: macos-latest
bitness: 64
platform_id: macosx_x86_64
exclude:
- os: macos-latest
bitness: 32
# Remove manylinux1 from the windows and osx build matrix since
# manylinux_image is not used for these platforms
- os: windows-latest
manylinux_image: manylinux1
- os: macos-latest
manylinux_image: manylinux1

steps:
- name: Checkout repo
uses: actions/checkout@v1
with:
submodules: 'true'

- name: Setup Python
uses: actions/setup-python@v2

- name: Build and test wheels
env:
CONFTEST_PATH: ${{ github.workspace }}/yt/conftest.py
CONFTEST_NAME: conftest.py
CIBW_ENVIRONMENT: OMP_NUM_THREADS=2
OPENBLAS_NUM_THREADS=2
SKLEARN_SKIP_NETWORK_TESTS=1
SKLEARN_BUILD_PARALLEL=3
MACOSX_DEPLOYMENT_TARGET=10.13
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: bash build_tools/github/repair_windows_wheels.sh {wheel} {dest_dir} ${{ matrix.bitness }}
CIBW_BEFORE_TEST_WINDOWS: bash build_tools/github/build_minimal_windows_image.sh ${{ matrix.python }} ${{ matrix.bitness }}
CIBW_TEST_REQUIRES: pytest pandas threadpoolctl
CIBW_TEST_COMMAND: bash {project}/build_tools/github/test_wheels.sh
CIBW_TEST_COMMAND_WINDOWS: bash {project}/build_tools/github/test_windows_wheels.sh ${{ matrix.python }} ${{ matrix.bitness }}
CIBW_BUILD_VERBOSITY: 1

run: bash build_tools/github/build_wheels.sh

- name: Store artifacts
uses: actions/upload-artifact@v2
with:
path: wheelhouse/*.whl

# Upload the wheels
upload_anaconda:
name: Upload to Anaconda
runs-on: ubuntu-latest
needs: [build_wheels]
# The artifacts cannot be uploaded on PRs
if: github.event_name != 'pull_request'

steps:
- name: Checkout repo
uses: actions/checkout@v1
with:
submodules: 'true'

- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: dist

- name: Setup Python
uses: actions/setup-python@v2

- name: Upload artifacts
env:
# Secret variables need to be mapped to environment variables explicitly
YT_STAGING_UPLOAD_TOKEN: ${{ secrets.YT_STAGING_UPLOAD_TOKEN }}
# Upload the generated wheels to anaconda.org/multibuild-wheels-staging
# using YT_STAGING_UPLOAD_TOKEN which is set as an environment variable
# in the travis CI configuration settings. The current token was generated
# by munkm at https://anaconda.org/multibuild-wheels-staging/settings/access
#
# Force a replacement if the remote file already exists
run: bash build_tools/github/upload_anaconda.sh
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ env:
global:
- REPO_DIR=yt
# Commit from your-project that you want to build
- BUILD_COMMIT=yt-3.6.1
- BUILD_COMMIT=yt-4.0.0
# Non-numpy or testing dependencies
- GEN_DEPENDS="setuptools sympy matplotlib"
- PLAT=x86_64
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ environment:
global:
REPO_DIR: yt
PACKAGE_NAME: yt
BUILD_COMMIT: yt-3.6.1
BUILD_COMMIT: yt-4.0.0
OTHER_BUILD_DEP: "cython"
OTHER_TEST_DEP: "nose"
GEN_DEP: "setuptools sympy matplotlib ipython"
Expand Down
30 changes: 30 additions & 0 deletions build_tools/github/build_wheels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -e
set -x

# OpenMP is not present on macOS by default
if [[ "$RUNNER_OS" == "macOS" ]]; then
# Make sure to use a libomp version binary compatible with the oldest
# supported version of the macos SDK as libomp will be vendored into the
# scikit-learn wheels for macos. The list of bottles can be found at:
# https://formulae.brew.sh/api/formula/libomp.json. Currently, the oldest
# supported macos version is: High Sierra / 10.13. When upgrading this, be
# sure to update the MACOSX_DEPLOYMENT_TARGET environment variable in
# wheels.yml accordingly.
wget https://homebrew.bintray.com/bottles/libomp-11.0.0.high_sierra.bottle.tar.gz
brew install libomp-11.0.0.high_sierra.bottle.tar.gz
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
export CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp"
export CFLAGS="$CFLAGS -I/usr/local/opt/libomp/include"
export CXXFLAGS="$CXXFLAGS -I/usr/local/opt/libomp/include"
export LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/local/opt/libomp/lib -L/usr/local/opt/libomp/lib -lomp"
fi

# The version of the built dependencies are specified
# in the pyproject.toml file, while the tests are run
# against the most recent version of the dependencies

python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
17 changes: 17 additions & 0 deletions build_tools/github/upload_anaconda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e
set -x

ANACONDA_ORG="multibuild-wheels-staging"
ANACONDA_TOKEN="$YT_STAGING_UPLOAD_TOKEN"

# Install Python 3.8 because of a bug with Python 3.9
export PATH=$CONDA/bin:$PATH
conda create -n upload -y python=3.8
source activate upload
conda install -y anaconda-client

# Force a replacement if the remote file already exists
anaconda -t $ANACONDA_TOKEN upload --force -u $ANACONDA_ORG dist/artifact/*
echo "Index: https://pypi.anaconda.org/$ANACONDA_ORG/simple"
2 changes: 1 addition & 1 deletion yt
Submodule yt updated 1264 files