Skip to content

Commit

Permalink
Pull request cython#22: Fannkuch test fixes rebased
Browse files Browse the repository at this point in the history
* commit '0cbe8d46df78fe73ddc216823984ff7327a9725f': (286 commits)
  Fixed problems from rebase
  Use HPyIter_Next
  Fixed float issues on GraalPy
  Fixed issues reintroduced on fannkuch
  Made float test work for HPy
  Make coverage work, start work on float
  Fixed most errors for fannkuch benchmark
  Fix: use API_CALL_TUPLE_DICT for __Pyx_PyObject_Call
  Remove helper funcs HPySlice_New and HPy_GetSlice
  Use HPyList_Insert for LIST_INSERT
  Introduce SEQUENCE_(GET/SET)_SLICE
  Use HPy_GetItem_i for LIST_GET_ITEM
  Merge decl of __Pyx__PyObject_PopNewIndex
  Use HPy_GetItem_i for TUPLE_GET_ITEM(_SAFE)
  Prefer SEQUENCE_SET_SLICE over __Pyx_PyObject_SetSlice if possible
  Fixed segfaults on CPython ABI
  Fix: wrong usage of HPy_Call
  Fix compilation warnings
  Also define __pyx_vectorcallfunc if CYTHON_METH_FASTCALL
  Fix operator precedence issues with expanded macros
  ...
  • Loading branch information
Du Toit Spies authored and fangerer committed Jan 31, 2024
2 parents f7a04ee + 0cbe8d4 commit c014b4f
Show file tree
Hide file tree
Showing 122 changed files with 3,299 additions and 1,317 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,30 +59,30 @@ jobs:

# Ubuntu sub-jobs:
# ================
# GCC 11 (with latest language standards)
# GCC 11 (with broad language standards)
- os: ubuntu-20.04
python-version: 3.8
python-version: "3.9"
backend: c
env: { GCC_VERSION: 11, EXTRA_CFLAGS: "-std=c99" }
extra_hash: "-c99"
- os: ubuntu-20.04
python-version: 3.11
python-version: "3.11"
backend: c
env: { GCC_VERSION: 11, EXTRA_CFLAGS: "-std=c17" }
extra_hash: "-gcc11"
- os: ubuntu-20.04
python-version: 3.11
python-version: "3.11"
backend: cpp
env: { GCC_VERSION: 11, EXTRA_CFLAGS: "-std=c++20" }
extra_hash: "-gcc11"
# compile all modules
- os: ubuntu-20.04
python-version: 3.7
python-version: "3.7"
backend: c
env: { CYTHON_COMPILE_ALL: 1 }
extra_hash: "-all"
- os: ubuntu-20.04
python-version: 3.7
python-version: "3.7"
backend: cpp
env: { CYTHON_COMPILE_ALL: 1 }
extra_hash: "-all"
Expand All @@ -98,18 +98,18 @@ jobs:
extra_hash: "-all"
# Linting
- os: ubuntu-20.04
python-version: 3.9
python-version: "3.9"
backend: "c,cpp"
env: { TEST_CODE_STYLE: 1, NO_CYTHON_COMPILE: 1 }
extra_hash: "-codestyle"
# Limited API
- os: ubuntu-20.04
python-version: 3.7
python-version: "3.7"
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
- os: ubuntu-20.04
python-version: 3.8
python-version: "3.8"
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
Expand All @@ -132,23 +132,23 @@ jobs:
extra_hash: "-limited_api"
# Type specs
- os: ubuntu-20.04
python-version: 3.9
python-version: "3.9"
backend: c
env: { EXTRA_CFLAGS: "-DCYTHON_USE_TYPE_SPECS=1" }
extra_hash: "-typespecs"
- os: ubuntu-20.04
python-version: 3.8
python-version: "3.8"
backend: c
env: { EXTRA_CFLAGS: "-DCYTHON_USE_TYPE_SPECS=1" }
extra_hash: "-typespecs"
- os: ubuntu-20.04
python-version: 3.7
python-version: "3.7"
backend: c
env: { EXTRA_CFLAGS: "-DCYTHON_USE_TYPE_SPECS=1" }
extra_hash: "-typespecs"
# Stackless
- os: ubuntu-20.04
python-version: 3.8
python-version: "3.8"
backend: c
env: { STACKLESS: true, PY: 3 }
extra_hash: "-stackless"
Expand Down
92 changes: 63 additions & 29 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ on:
paths:
#- Cython/Build/**
- .github/workflows/wheels.yml
- pyproject.toml
- MANIFEST.in
- setup.*
push:
paths:
#- Cython/Build/**
- .github/workflows/wheels.yml
- pyproject.toml
- MANIFEST.in
- setup.*
workflow_dispatch:
Expand All @@ -38,52 +46,77 @@ permissions:
contents: write # to create GitHub release (softprops/action-gh-release)

jobs:
generate-wheels-matrix:
# Create a matrix of all architectures & versions to build.
# This enables the next step to run cibuildwheel in parallel.
# From https://iscinumpy.dev/post/cibuildwheel-2-10-0/#only-210
name: Generate wheels matrix
if: >-
github.event_name == 'push' ||
github.event_name == 'release' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'Build System'))
runs-on: ubuntu-latest
outputs:
include: ${{ steps.set-matrix.outputs.include }}
steps:
- uses: actions/checkout@v4
- name: Install cibuildwheel
# Nb. keep cibuildwheel version pin consistent with job below
run: pipx install cibuildwheel==2.16.2
- id: set-matrix
run: |
MATRIX=$(
{
cibuildwheel --print-build-identifiers --prerelease-pythons --platform linux \
| jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \
&& cibuildwheel --print-build-identifiers --prerelease-pythons --platform macos \
| jq -nRc '{"only": inputs, "os": "macos-latest"}' \
&& cibuildwheel --print-build-identifiers --prerelease-pythons --platform windows \
| jq -nRc '{"only": inputs, "os": "windows-2019"}'
} | jq -sc
)
echo "$MATRIX"
echo "include=$MATRIX" >> $GITHUB_OUTPUT
build_wheels:
name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }}
name: Wheel ${{ matrix.only }}
if: >-
github.event_name == 'push' ||
github.event_name == 'release' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'Build System'))
runs-on: ${{ matrix.buildplat[0] }}
needs: generate-wheels-matrix
runs-on: ${{ matrix.os }}

strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
# Github Actions doesn't support pairing matrix values together, let's improvise
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
buildplat:
- [ubuntu-20.04, manylinux_x86_64]
- [ubuntu-20.04, manylinux_aarch64]
- [ubuntu-20.04, manylinux_i686]
- [ubuntu-20.04, musllinux_x86_64]
- [ubuntu-20.04, musllinux_aarch64]
- [macos-11, macosx_*]
- [windows-2019, win_amd64]
- [windows-2019, win32]
python: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"] # Note: Wheels not needed for PyPy
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }}

steps:
- name: Checkout Cython
uses: actions/checkout@v3

- name: Set up QEMU
if: contains(matrix.buildplat[1], '_aarch64')
uses: docker/setup-qemu-action@v1
if: runner.os == 'Linux' && !contains(matrix.only, 'x86') && !contains(matrix.only, 'i686')
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Build wheels
uses: pypa/[email protected]
env:
# TODO: Build Cython with the compile-all flag?
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
CIBW_PRERELEASE_PYTHONS: True
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ENVIRONMENT: CFLAGS='-O3 -g0 -mtune=generic -pipe -fPIC' LDFLAGS='-fPIC'
# TODO: Cython tests take a long time to complete
# consider running a subset in the future?
#CIBW_TEST_COMMAND: python {project}/runtests.py -vv --no-refnanny
# Nb. keep cibuildwheel version pin consistent with generate-matrix job above
uses: pypa/[email protected]
with:
only: ${{ matrix.only }}
# TODO: Cython tests take a long time to complete
# consider running a subset in the future?
#CIBW_TEST_COMMAND: python {project}/runtests.py -vv

- name: Release
uses: softprops/action-gh-release@v1
Expand All @@ -96,12 +129,13 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.python }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }}
name: ${{ matrix.only }}
path: ./wheelhouse/*.whl

build_sdist_pure_wheel:
name: Build sdist and pure wheel
if: >-
github.event_name == 'push' ||
github.event_name == 'release' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
Expand All @@ -122,7 +156,7 @@ jobs:
run: |
pip install --upgrade wheel setuptools
python setup.py sdist
python setup.py bdist_wheel --no-cython-compile --universal
python setup.py bdist_wheel --no-cython-compile
- uses: actions/upload-artifact@v3
with:
Expand Down
Loading

0 comments on commit c014b4f

Please sign in to comment.