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

move to Cibuildwheel workflow #274

Merged
merged 109 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
1e9af7a
Create python-cibuildwheel.yml
hendrikmuhs Jan 6, 2024
8078ff9
Update python-cibuildwheel.yml
hendrikmuhs Jan 6, 2024
c173d38
Update python-cibuildwheel.yml
hendrikmuhs Jan 6, 2024
9031553
Update python-cibuildwheel.yml
hendrikmuhs Jan 6, 2024
39cf77e
Update python-cibuildwheel.yml
hendrikmuhs Jan 6, 2024
25f73f1
Update python-cibuildwheel.yml
hendrikmuhs Jan 6, 2024
b6cb541
Update python-cibuildwheel.yml
hendrikmuhs Jan 6, 2024
431c311
Update python-cibuildwheel.yml
hendrikmuhs Jan 6, 2024
1dee218
add arm builds
hendrikmuhs Jan 6, 2024
c7d289b
Update python-cibuildwheel.yml
hendrikmuhs Jan 6, 2024
ffd78d8
Update python-cibuildwheel.yml
hendrikmuhs Jan 6, 2024
eb1e818
Update python-cibuildwheel.yml
hendrikmuhs Jan 6, 2024
349d327
Update python-cibuildwheel.yml
hendrikmuhs Jan 6, 2024
dc351f6
Delete .github/workflows/python.yml
hendrikmuhs Jan 7, 2024
94bcdf3
Delete .github/workflows/manylinux.yml
hendrikmuhs Jan 7, 2024
ec2be65
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
6760aba
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
902670c
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
4067042
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
222ee62
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
a467224
Update keyvi.yml
hendrikmuhs Jan 7, 2024
2225fb2
Create dependabot.yml
hendrikmuhs Jan 7, 2024
a0c5d17
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
7ebe8e2
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
f859b0f
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
5dd6fc5
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
c03e0a9
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
15db4b8
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
45778dc
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
396bd93
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
d637c26
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
2d9dee2
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
83f8650
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
9fde698
Update python-cibuildwheel.yml
hendrikmuhs Jan 7, 2024
8f85ace
simplify logic and enable arm and musllinux
hendrikmuhs Jan 8, 2024
f4cb365
Update python-cibuildwheel.yml
hendrikmuhs Jan 8, 2024
958267d
Update python-cibuildwheel.yml
hendrikmuhs Jan 8, 2024
82886c4
disable musl
hendrikmuhs Jan 8, 2024
935fab7
QEMU only for Linux on arm
hendrikmuhs Jan 8, 2024
77c2ff7
Update requirements.txt
hendrikmuhs Jan 8, 2024
be4eaf3
re-enable musllinux
hendrikmuhs Jan 8, 2024
adca64a
build all python versions
hendrikmuhs Jan 9, 2024
c643b5e
Update python-cibuildwheel.yml
hendrikmuhs Jan 9, 2024
eae42e8
Update python-cibuildwheel.yml
hendrikmuhs Jan 9, 2024
97c93ed
reenable pypy, but without tests
hendrikmuhs Jan 9, 2024
c0c45db
dont test everything on arm
hendrikmuhs Jan 9, 2024
5d7d28a
build musl and many in parallel
hendrikmuhs Jan 14, 2024
a4a8800
fix job name
hendrikmuhs Jan 14, 2024
7c42f6d
fix syntax
hendrikmuhs Jan 14, 2024
cd7a13f
debug arch flags
hendrikmuhs Jan 14, 2024
73b281a
enable debug log
hendrikmuhs Jan 14, 2024
3061b8e
read archflags and forward it to cmake
hendrikmuhs Jan 14, 2024
77ae09c
use cmake system processor instead of uname
hendrikmuhs Jan 14, 2024
9430235
install arm packages on mac x86_64 for cross-compilation
hendrikmuhs Jan 14, 2024
5cd77c4
fix loop and remove old install
hendrikmuhs Jan 14, 2024
9dab58e
use big_sur and reinstall
hendrikmuhs Jan 14, 2024
fe853b7
back to arm64_montery
hendrikmuhs Jan 14, 2024
defc581
set deployment target
hendrikmuhs Jan 14, 2024
56a3f6a
up deployment target
hendrikmuhs Jan 14, 2024
1d80039
up target
hendrikmuhs Jan 14, 2024
da1d6b5
try a different place
hendrikmuhs Jan 14, 2024
ff5f355
use python host
hendrikmuhs Jan 14, 2024
99dd179
more debug
hendrikmuhs Jan 14, 2024
82a322d
try arm homebrew
hendrikmuhs Jan 14, 2024
c4aae71
use other brew
hendrikmuhs Jan 14, 2024
81bf82d
debug
hendrikmuhs Jan 14, 2024
3ccad4a
no alias
hendrikmuhs Jan 14, 2024
c222b4a
get config
hendrikmuhs Jan 14, 2024
2e2b03f
add cmake module path
hendrikmuhs Jan 19, 2024
850a633
simplify
hendrikmuhs Jan 19, 2024
1405aeb
fix build option
hendrikmuhs Jan 19, 2024
705864f
fix quote
hendrikmuhs Jan 19, 2024
8586d4d
use env variable
hendrikmuhs Jan 19, 2024
b128453
set deployment target
hendrikmuhs Jan 19, 2024
29e061a
debug
hendrikmuhs Jan 19, 2024
208f046
remove quote
hendrikmuhs Jan 19, 2024
c85fa8b
more debug
hendrikmuhs Jan 19, 2024
86995cc
revert ls
hendrikmuhs Jan 19, 2024
19ad289
Update setup.py
hendrikmuhs Jan 20, 2024
3f9095b
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
73ac0d9
Update setup.py
hendrikmuhs Jan 20, 2024
129669f
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
5d33210
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
b8df946
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
725c340
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
98393f4
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
704f19e
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
d99b700
Update setup.py
hendrikmuhs Jan 20, 2024
b78c919
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
b16dc03
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
eaf2dba
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
fcdb5a9
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
e5f3d64
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
90dc503
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
d184953
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
6ddd884
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
33883e7
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
a5ff682
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
56f6b9f
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
140549b
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
64d51b9
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
56a3120
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
0ef6e4a
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
5106fe5
Update python-cibuildwheel.yml
hendrikmuhs Jan 20, 2024
16f7a92
revert custom opt
hendrikmuhs Jan 21, 2024
df27da2
reformat setup.py by introducing ruff formatting
hendrikmuhs Jan 27, 2024
ec67486
reference requirements.txt file
hendrikmuhs Jan 27, 2024
5975c71
remove pyproject.toml, replacement has to be done in a follow up
hendrikmuhs Jan 27, 2024
faf7e03
Update python-cibuildwheel.yml
hendrikmuhs Jan 27, 2024
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
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion .github/workflows/keyvi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: actions/checkout@v2

- name: ccache
uses: hendrikmuhs/ccache-action@v1.1
uses: hendrikmuhs/ccache-action@v1.2.11
with:
key: ${{ matrix.os }}-${{ matrix.type }}

Expand Down
59 changes: 0 additions & 59 deletions .github/workflows/manylinux.yml

This file was deleted.

183 changes: 183 additions & 0 deletions .github/workflows/python-cibuildwheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
name: Python cibuildwheel

on:
push:
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
build_wheels:
name: cibuildwheel ${{ matrix.os }}/${{ matrix.arch }}/${{ matrix.flavor }}/${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
# separate archs, so they use individual caches
arch: [ 'x86_64', 'arm64' ]
flavor: ['cpython', 'pypy']
# separate musl and many on linux, for mac we just skip one of those
target: [ 'many', 'musl' ]
exclude:
- os: macos-12
target: musl
- os: ubuntu-22.04
target: musl
flavor: pypy
- os: macos-12
arch: arm64
flavor: pypy
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
if: ${{ (runner.os == 'Linux') && (matrix.arch == 'arm64') }}
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.11
with:
key: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.target }}-${{ matrix.flavor }}-python

- name: Sets env for x86_64
run: |
echo "CIBW_ARCHS_LINUX=auto64" >> $GITHUB_ENV
echo "CIBW_ARCHS_MACOS=x86_64" >> $GITHUB_ENV
if: matrix.arch == 'x86_64'

- name: Sets env for arm64
run: |
echo "CIBW_ARCHS_LINUX=aarch64" >> $GITHUB_ENV
echo "CIBW_ARCHS_MACOS=arm64" >> $GITHUB_ENV
if: matrix.arch == 'arm64'

- name: Skip manylinux for musllinux target
if: ${{ (runner.os == 'Linux') && (matrix.target == 'musl') }}
run: |
echo "CIBW_SKIP=*manylinux*" >> $GITHUB_ENV

- name: Skip musllinux for manylinux target
if: ${{ (runner.os == 'Linux') && (matrix.target == 'many') }}
run: |
echo "CIBW_SKIP=*musllinux*" >> $GITHUB_ENV

- name: Skip pypy for cpython
if: ${{ matrix.flavor == 'cpython' }}
run: |
echo "CIBW_SKIP=${{ env.CIBW_SKIP }} pp*" >> $GITHUB_ENV

- name: Skip cpython for pypy
if: ${{ matrix.flavor == 'pypy' }}
run: |
echo "CIBW_SKIP=${{ env.CIBW_SKIP }} cp*" >> $GITHUB_ENV

- name: install mac dependencies
if: ${{ runner.os == 'macOS' }}
run: |
brew update && \
brew install ccache

- name: install mac dependencies X86_64
if: ${{ (runner.os == 'macOS') && (matrix.arch == 'x86_64') }}
run: |
brew update && \
brew install zlib snappy boost

- name: install mac dependencies arm64
if: ${{ (runner.os == 'macOS') && (matrix.arch == 'arm64') }}
run: |
set -e
echo "MACOSX_DEPLOYMENT_TARGET=12.3.0" >> $GITHUB_ENV
echo "_CMAKE_PREFIX_PATH=${{ github.workspace }}/arm64-homebrew" >> $GITHUB_ENV
echo "CIBW_REPAIR_WHEEL_COMMAND_MACOS=DYLD_LIBRARY_PATH=${{ github.workspace }}/arm64-homebrew delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" >> $GITHUB_ENV
mkdir arm64-homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C arm64-homebrew
PACKAGES=( icu4c xz lz4 zstd zlib snappy boost )
for PACKAGE in "${PACKAGES[@]}"
do
response=$(arm64-homebrew/bin/brew fetch --force --bottle-tag=arm64_monterey $PACKAGE | grep Downloaded )
download_path=$(echo $response | xargs -n 1 | tail -1)
arm64-homebrew/bin/brew reinstall -vd $download_path
done
arm64-homebrew/bin/brew config
ls /Users/runner/work/keyvi/keyvi/arm64-homebrew

- name: Build python wheels for ${{ matrix.os }} on ${{ matrix.arch }}
uses: pypa/cibuildwheel@v2.16.2
env:
# Skip CPython 3.6 and CPython 3.7
CIBW_SKIP: ${{ env.CIBW_SKIP }} cp36-* cp37-*

# skip testing all python versions on linux arm, only test 3.12
# skip tests on pypy, currently fails for indexer tests
CIBW_TEST_SKIP: "*p{38,39,310,311}-m*linux_aarch64 pp*"

# (many)linux custom docker images
CIBW_MANYLINUX_X86_64_IMAGE: 'keyvidev/manylinux-builder-x86_64'
CIBW_MANYLINUX_AARCH64_IMAGE: 'keyvidev/manylinux-builder-aarch64'
CIBW_MUSLLINUX_X86_64_IMAGE: 'keyvidev/musllinux-builder-x86_64'
CIBW_MUSLLINUX_AARCH64_IMAGE: 'keyvidev/musllinux-builder-aarch64'

# ccache using path
CIBW_ENVIRONMENT_MACOS: PATH=/usr/local/opt/ccache/libexec:$PATH
CIBW_ENVIRONMENT_LINUX: PATH=/usr/local/bin:/usr/lib/ccache:$PATH CCACHE_DIR=/host${{ github.workspace }}/.ccache CCACHE_CONFIGPATH=/host/home/runner/.config/ccache/ccache.conf

# python dependencies
CIBW_BEFORE_BUILD: pip install -r python/requirements.txt

# testing
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: >
python -m pytest {package}/tests &&
python -m pytest {package}/integration-tests

# for debugging set this to 1,2 or 3
# CIBW_BUILD_VERBOSITY: 2
with:
package-dir: python

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

build_sdist:
name: sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install Linux deps
run: |
sudo apt-get update && \
sudo apt-get install -y libsnappy-dev libzzip-dev zlib1g-dev libboost-all-dev ccache
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.11
with:
key: ${{ matrix.os }}-sdist-python

- name: Build SDist
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cd python && \
python -m pip install -r requirements.txt && \
python setup.py sdist -d wheelhouse && \
python -m pip uninstall -y autowrap && \
python -m pip install wheelhouse/*.tar.gz -v && \
python -m pytest tests && \
python -m pip uninstall -y keyvi

- uses: actions/upload-artifact@v3
with:
path: python/wheelhouse/*.tar.gz

upload_all:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}
116 changes: 0 additions & 116 deletions .github/workflows/python.yml

This file was deleted.

7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
cmake_minimum_required(VERSION 3.9)
project(keyvi)

EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE )
message( STATUS "Architecture: ${ARCHITECTURE}" )

#### Build Type
if (CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)
Expand All @@ -22,9 +19,9 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set (_KEVYI_COMPILE_OPTIONS "-Wall")
set (_KEYVI_COMPILE_DEFINITIONS "RAPIDJSON_HAS_STDSTRING")

if(${ARCHITECTURE} STREQUAL "x86_64")
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set (_KEYVI_CXX_FLAGS "-msse4.2")
message( STATUS "Architecture: ${ARCHITECTURE} detected: added -msse4.2 compile flag")
message( STATUS "Architecture: ${CMAKE_SYSTEM_PROCESSOR} detected: added -msse4.2 compile flag")
endif()

set (_OS_LIBRARIES "")
Expand Down
Loading
Loading