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

CI - Fix tests to allow running concurrently #83

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
66 changes: 33 additions & 33 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
rm -rf dist/
python -m pip install build
python -m build --sdist

echo "sdist_artifact_name=$(ls ./dist)" >> "$GITHUB_OUTPUT"
echo "package_version=$(ls ./dist | sed -En 's/cffi-(.+)\.tar\.gz/\1/p')" >> "$GITHUB_OUTPUT"

Expand Down Expand Up @@ -76,21 +76,21 @@ jobs:

- spec: cp39-manylinux_x86_64
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp310-manylinux_x86_64
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp311-manylinux_x86_64
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp312-manylinux_x86_64
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp313-manylinux_x86_64

- spec: cp313t-manylinux_x86_64
skip_artifact_upload: 'true'

- spec: cp38-manylinux_i686
omit: ${{ env.skip_ci_redundant_jobs }}

Expand All @@ -108,10 +108,10 @@ jobs:

- spec: cp313-manylinux_i686
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp39-musllinux_x86_64
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp310-musllinux_x86_64
omit: ${{ env.skip_ci_redundant_jobs }}

Expand All @@ -120,9 +120,9 @@ jobs:

- spec: cp312-musllinux_x86_64
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp313-musllinux_x86_64

- spec: cp39-musllinux_i686
omit: ${{ env.skip_ci_redundant_jobs }}

Expand All @@ -134,14 +134,14 @@ jobs:

#- spec: cp312-musllinux_i686 # busted as of 2024-05-17
# omit: ${{ env.skip_ci_redundant_jobs }}

#- spec: cp313-musllinux_i686 # busted as of 2024-05-17

- spec: cp39-musllinux_aarch64
foreign_arch: true
test_args: '{package}/src/c'
omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }}

- spec: cp310-musllinux_aarch64
foreign_arch: true
test_args: '{package}/src/c'
Expand All @@ -156,12 +156,12 @@ jobs:
foreign_arch: true
test_args: '{package}/src/c'
omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }}

- spec: cp313-musllinux_aarch64
foreign_arch: true
# test_args: '{package}/src/c'
omit: ${{ env.skip_slow_jobs}}

- spec: cp38-manylinux_aarch64
foreign_arch: true
test_args: '{package}/src/c'
Expand All @@ -186,12 +186,12 @@ jobs:
foreign_arch: true
test_args: '{package}/src/c'
omit: ${{ env.skip_slow_jobs || env.skip_ci_redundant_jobs }}

- spec: cp313-manylinux_aarch64
foreign_arch: true
# test_args: '{package}/src/c'
omit: ${{ env.skip_slow_jobs }}

- spec: cp38-manylinux_ppc64le
foreign_arch: true
test_args: '{package}/src/c'
Expand Down Expand Up @@ -221,7 +221,7 @@ jobs:
foreign_arch: true
test_args: '{package}/src/c'
omit: ${{ env.skip_slow_jobs }}

- spec: cp38-manylinux_s390x
foreign_arch: true
test_args: '{package}/src/c'
Expand Down Expand Up @@ -298,13 +298,13 @@ jobs:
CIBW_MUSLLINUX_AARCH64_IMAGE: ${{ matrix.musllinux_img || 'musllinux_1_1' }}
CIBW_PRERELEASE_PYTHONS: 'True'
CIBW_FREE_THREADED_SUPPORT: 'True'
CIBW_TEST_REQUIRES: pytest setuptools # 3.12+ no longer includes distutils, just always ensure setuptools is present
CIBW_TEST_COMMAND: PYTHONUNBUFFERED=1 python -m pytest ${{ matrix.test_args || '{project}' }} # default to test all
CIBW_TEST_REQUIRES: pytest pytest-xdist setuptools # 3.12+ no longer includes distutils, just always ensure setuptools is present
CIBW_TEST_COMMAND: PYTHONUNBUFFERED=1 python -m pytest -n auto ${{ matrix.test_args || '{project}' }} # default to test all
run: |
set -eux

mkdir cffi

tar zxf ${{ steps.fetch_sdist.outputs.download-path }}/cffi*.tar.gz --strip-components=1 -C cffi
python -m pip install --upgrade "${{ matrix.cibw_version || 'cibuildwheel' }}"

Expand Down Expand Up @@ -417,19 +417,19 @@ jobs:
env:
CIBW_BUILD: ${{ matrix.spec }}
CIBW_PRERELEASE_PYTHONS: 'True'
CIBW_TEST_REQUIRES: pytest setuptools
CIBW_TEST_COMMAND: pip install pip --upgrade; cd {project}; PYTHONUNBUFFERED=1 pytest
CIBW_TEST_REQUIRES: pytest pytest-xdist setuptools
CIBW_TEST_COMMAND: pip install pip --upgrade; cd {project}; PYTHONUNBUFFERED=1 pytest -n auto
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '10.9' }}
SDKROOT: ${{ matrix.sdkroot || 'macosx' }}
run: |
set -eux

mkdir cffi

tar zxf ${{ steps.fetch_sdist.outputs.download-path }}/cffi*.tar.gz --strip-components=1 -C cffi

python3 -m cibuildwheel --output-dir dist cffi

echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT"

- name: upload artifacts
Expand Down Expand Up @@ -508,21 +508,21 @@ jobs:
env:
CIBW_BUILD: ${{ matrix.spec }}
CIBW_PRERELEASE_PYTHONS: 'True'
CIBW_TEST_REQUIRES: pytest setuptools
CIBW_TEST_COMMAND: 'python -m pytest {package}/src/c'
CIBW_TEST_REQUIRES: pytest pytest-xdist setuptools
CIBW_TEST_COMMAND: 'python -m pytest -n auto {package}/src/c'
# FIXME: /testing takes ~45min on Windows and has some failures...
# CIBW_TEST_COMMAND='python -m pytest {package}/src/c {project}/testing'
# CIBW_TEST_COMMAND='python -m pytest -n auto {package}/src/c {project}/testing'
run: |
set -eux

mkdir cffi

tar zxf cffi*.tar.gz --strip-components=1 -C cffi

python -m pip install --upgrade pip
pip install "${{ matrix.cibw_version || 'cibuildwheel'}}"
python -m cibuildwheel --output-dir dist cffi

echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT"

shell: bash
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ Testing/development tips

To run tests under CPython, run the following in the source root directory:

pip install pytest
pip install pytest pytest-xdist virtualenv
pip install -e . # editable install of CFFI for local development
pytest c/ testing/
pytest


[Documentation]: http://cffi.readthedocs.org/
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,18 @@ Downloads = "https://github.com/python-cffi/cffi/releases"
Contact = "https://groups.google.com/forum/#!forum/python-cffi"
"Source Code" = "https://github.com/python-cffi/cffi"
"Issue Tracker" = "https://github.com/python-cffi/cffi/issues"

[tool.pytest.ini_options]
addopts ="""
-r a
--verbose
--strict-markers
--durations-min 1
--durations 10
--color yes
--showlocals
"""
testpaths = [
"src/c",
"testing/",
]
Loading
Loading