Skip to content

Commit

Permalink
Configure GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophWWagner committed Apr 7, 2023
1 parent 75fb855 commit 6edc463
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 14 deletions.
86 changes: 73 additions & 13 deletions .github/workflows/build-dev-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ env:
CIBW_SKIP: pp* cp2*

jobs:
build_wheel:
name: Build ${{ matrix.cibw-build }} using Python ${{ matrix.python-version }} on ${{ matrix.os }}
###############################################################################
build_wheel_x86_x64:
name: Build ${{ matrix.cibw-build }} on x64_x86 ${{ matrix.os }} using Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -37,26 +38,85 @@ jobs:
# Numpy C-API 0x13
- python-version: "3.9"
cibw-build: "cp36* cp37* cp38* cp39*"
cibw-archs-linux: "x86_64 i686 aarch64"
cibw-archs-macos: "x86_64 arm64"
cibw-archs-linux: "x86_64 i686"
cibw-archs-macos: "x86_64"
cibw-archs-windows: "AMD64 x86"
fastmat-generic: 1
pip-requires: "cython>=0.29 numpy==1.19.3 scipy==1.5.4 cibuildwheel==1.9 twine"
# Numpy C-API 0x14
- python-version: "3.10"
cibw-build: "cp310*"
cibw-archs-linux: "x86_64 aarch64"
cibw-archs-macos: "x86_64 arm64"
cibw-archs-linux: "x86_64"
cibw-archs-macos: "x86_64"
cibw-archs-windows: "AMD64"
fastmat-generic: 0
pip-requires: "cython>=0.29 numpy==1.21.6 scipy==1.7.3 cibuildwheel==2.12.1 twine"
# Numpy C-API 0x16
- python-version: "3.11"
cibw-build: "cp311*"
cibw-archs-linux: "x86_64 aarch64"
cibw-archs-macos: "x86_64 arm64"
cibw-archs-linux: "x86_64"
cibw-archs-macos: "x86_64"
cibw-archs-windows: "AMD64"
fastmat-generic: 0
pip-requires: "cython>=0.29 numpy==1.24.2 scipy==1.10.1 cibuildwheel==2.12.1 twine"

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Build the wheels
env:
CIBW_BUILD: ${{ matrix.cibw-build }}
CIBW_ARCHS_LINUX: ${{ matrix.cibw-archs-linux }}
CIBW_ARCHS_MACOS: ${{ matrix.cibw-archs-macos }}
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw-archs-windows }}
CIBW_ENVIRONMENT: "FASTMAT_COMPILER_OPTIONS='-march=x86-64 -mtune=core2'"
CIBW_BEFORE_BUILD: "python -m pip install --only-binary :all: ${{ matrix.pip-requires }}"
run: |
python -m pip install --upgrade pip
python -m pip install --only-binary :all: ${{ matrix.pip-requires }}
cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

- name: Upload the Results
shell: bash
run: |
ls -l wheelhouse
if [[ ${{ github.event_name }} == "push" ]]; then
echo "Uploading to pypi"
elif [[ ${{ github.event_name }} == "pull_request" ]]; then
echo "Testing build"
fi
###############################################################################
build_wheel_arm64:
name: Build ${{ matrix.cibw-build }} on arm64 ${{ matrix.os }} using Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest"]
python-version: ["3.9", "3.10", "3.11"]
include:
# Numpy C-API 0x13
- python-version: "3.9"
cibw-build: "cp36* cp37* cp38* cp39*"
cibw-archs-linux: "aarch64"
cibw-archs-macos: "arm64"
pip-requires: "cython>=0.29 numpy==1.19.3 scipy==1.5.4 cibuildwheel==1.9 twine"
# Numpy C-API 0x14
- python-version: "3.10"
cibw-build: "cp310*"
cibw-archs-linux: "aarch64"
cibw-archs-macos: "arm64"
pip-requires: "cython>=0.29 numpy==1.21.6 scipy==1.7.3 cibuildwheel==2.12.1 twine"
# Numpy C-API 0x16
- python-version: "3.11"
cibw-build: "cp311*"
cibw-archs-linux: "aarch64"
cibw-archs-macos: "arm64"
pip-requires: "cython>=0.29 numpy==1.24.2 scipy==1.10.1 cibuildwheel==2.12.1 twine"

steps:
Expand All @@ -72,9 +132,8 @@ jobs:
CIBW_ARCHS_LINUX: ${{ matrix.cibw-archs-linux }}
CIBW_ARCHS_MACOS: ${{ matrix.cibw-archs-macos }}
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw-archs-windows }}
CIBW_ENVIRONMENT: "FASTMAT_GENERIC=${{ matrix.fastmat-generic }}"
CIBW_ENVIRONMENT: "FASTMAT_COMPILER_OPTIONS=-march=arm64"
CIBW_BEFORE_BUILD: "python -m pip install --only-binary :all: ${{ matrix.pip-requires }}"
FASTMAT_GENERIC: ${{ matrix.fastmat-generic }}
run: |
python -m pip install --upgrade pip
python -m pip install --only-binary :all: ${{ matrix.pip-requires }}
Expand All @@ -94,6 +153,7 @@ jobs:
echo "Testing build"
fi
###############################################################################
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,11 @@ def __init__(self, *args, **kwargs):

# Build for generic (legacy) architectures when enviroment variable
# (FASTMAT_GENERIC) is defined
if 'FASTMAT_GENERIC' in os.environ and bool(int(os.environ['FASTMAT_GENERIC'])):
if 'FASTMAT_COMPILER_OPTIONS' in os.environ:
marchFlag = os.environ['FASTMAT_COMPILER_OPTIONS']
mtuneFlag = ''
WARNING("Passing special build options: " + marchFlag)
elif 'FASTMAT_GENERIC' in os.environ and bool(int(os.environ['FASTMAT_GENERIC'])):
marchFlag = '-march=x86-64'
mtuneFlag = '-mtune=core2'
WARNING("Building package for generic architectures")
Expand Down

0 comments on commit 6edc463

Please sign in to comment.