Skip to content

Commit

Permalink
new build wheels action
Browse files Browse the repository at this point in the history
  • Loading branch information
Socrats committed Apr 30, 2021
1 parent ce64e23 commit 5e3ee6a
Showing 1 changed file with 153 additions and 0 deletions.
153 changes: 153 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: Wheels

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
- develop
# tags:
# - v*
# release:
# types:
# - published

env:
CIBW_TEST_COMMAND: pytest


jobs:
build_sdist:
name: Build source distribution (sdist)
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/heads/docs') != true
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Setup CMake
uses: jwlawson/actions-setup-cmake@v1.8

- name: Build SDist
run: pipx run build --sdist

- name: Run check-manifest
run: |
python -m check_manifest
- name: Build sdist
run: |
python -m build --sdist --outdir wheelhouse
- name: Install from sdist
run: |
pip install --user wheelhouse/*.tar.gz
- name: Check sdist metadata
run: |
python -m twine check wheelhouse/*
- name: Upload sdist
uses: actions/upload-artifact@v2
with:
name: wheels
path: wheelhouse/*.tar.gz


build_wheels:
name: Wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest] # Windows wheels currently not supported very well by scikit-build

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
# architecture: ${{ matrix.python-arch }}

- name: Setup CMake
uses: jwlawson/actions-setup-cmake@v1.8

- name: Install system dependencies macOS
shell: bash
if: runner.os == 'macOS'
run: |
brew install libomp
echo "LIBOMP=$(brew --prefix libomp)" >> $GITHUB_ENV
brew install eigen
echo "EIGEN=$(brew --prefix eigen)" >> $GITHUB_ENV
brew install gfortran
echo "GFORTRAN=$(brew --prefix gfortran)" >> $GITHUB_ENV
- name: Install system dependencies Linux
shell: bash
if: runner.os == 'Linux'
run: |
sudo apt-get install libomp-dev
sudo apt install libeigen3-dev
echo "Eigen3_DIR='/usr/include/eigen3/cmake'" >> $GITHUB_ENV
- uses: joerick/cibuildwheel@v1.10.0
env:
# Python 2.7 on Windows with workaround not supported by scikit-build
CIBW_SKIP: cp27-win*
CIBW_BEFORE_ALL_MACOS: |
brew install libomp
brew install eigen
brew install gfortran
brew install openblas
echo "LIBOMP=$(brew --prefix libomp)" >> $GITHUB_ENV
echo "EIGEN=$(brew --prefix eigen)" >> $GITHUB_ENV
echo "GFORTRAN=$(brew --prefix gfortran)" >> $GITHUB_ENV
echo "OPENBLAS=$(brew --prefix openblas)" >> $GITHUB_ENV
CIBW_BEFORE_ALL_LINUX: |
sudo apt-get install libomp-dev
sudo apt install libeigen3-dev
CIBW_ENVIRONMENT_LINUX: "-DEigen3_DIR='/usr/include/eigen3/cmake'"
CIBW_ENVIRONMENT_MACOS: "-DEigen3_DIR='$(brew --prefix eigen)/cmake'"


- name: Verify clean directory
run: git diff --exit-code
shell: bash

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


# upload_all:
# name: Upload if release
# needs: [build_wheels, build_sdist]
# runs-on: ubuntu-latest
# if: github.event_name == 'release' && github.event.action == 'published'
#
# steps:
# - uses: actions/setup-python@v2
#
# - uses: actions/download-artifact@v2
# with:
# name: artifact
# path: dist
#
# - uses: pypa/gh-action-pypi-publish@v1.4.2
# with:
# user: __token__
# password: ${{ secrets.pypi_password }}

0 comments on commit 5e3ee6a

Please sign in to comment.