diff --git a/.github/workflows/python_build.yaml b/.github/workflows/python_build.yaml index 6d9af4a3..0d2f5365 100644 --- a/.github/workflows/python_build.yaml +++ b/.github/workflows/python_build.yaml @@ -10,9 +10,9 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 - name: install dev requirements - run: python -m pip install -r requirements-dev.txt + run: python scripts/install-dev-reqs.py - name: build sdist - run: python -m build --sdist && twine check ./dist/* + run: python scripts/build-sdist.py - name: upload sdist uses: actions/upload-artifact@v4 with: @@ -58,11 +58,6 @@ jobs: with: name: sdist path: ./dist/ - - uses: tj-actions/glob@v20 - # FIXME? use a more programmatic or integrated solution here - id: sdist_glob - with: - files: ./dist/* # Used to host cibuildwheel - uses: actions/setup-python@v3 @@ -71,11 +66,11 @@ jobs: uses: docker/setup-qemu-action@v3 - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.16.3 + run: python scripts/_run-cibw.py install - name: Build wheels # https://github.com/pypa/cibuildwheel/issues/173#issuecomment-1501236916 - run: python -m cibuildwheel ${{ steps.sdist_glob.outputs.paths }} --output-dir ./dist + run: python scripts/_run-cibw.py build dist/ env: CIBW_BUILD: ${{ matrix.cibw_build }} CIBW_ARCHS: ${{ matrix.cibw_archs }} diff --git a/requirements-dev.txt b/requirements-dev.txt index d6f2b699..0bd4b727 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,7 @@ cffi >= 1.14.5 setuptools >= 49.5.0 -wheel >= 0.30.0 -# Beyond "build" requirements +wheel >= 0.28.0 + +# Beyond nominal "build" requirements build >= 0.6.0 twine >= 1.15.0 diff --git a/scripts/_run-cibw.py b/scripts/_run-cibw.py new file mode 100755 index 00000000..c6b52428 --- /dev/null +++ b/scripts/_run-cibw.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +import os +from pathlib import Path +import subprocess +import sys + +CIBW_VER = os.environ.get('_CIBW_VER', '2.16.3') + +if sys.argv[1] == 'install': + subprocess.check_call([ + sys.executable, '-m', 'pip', + 'install', f'cibuildwheel == {CIBW_VER}' + ]) + +elif sys.argv[1] == 'build': + target = Path(sys.argv[2]) + subprocess.check_call([ + sys.executable, '-m', 'cibuildwheel', + *target.glob('*'), + '--output-dir', target + ]) + +else: + raise RuntimeError() diff --git a/scripts/build-sdist.py b/scripts/build-sdist.py new file mode 100755 index 00000000..05a04095 --- /dev/null +++ b/scripts/build-sdist.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +from pathlib import Path +import subprocess +import sys + +subprocess.check_call([ + sys.executable, '-m', 'build', + '--sdist' +)] + +subprocess.check_call([ + sys.executable, '-m', 'twine', + 'check', *Path('dist').glob('*') +]) diff --git a/scripts/install-dev-reqs.py b/scripts/install-dev-reqs.py new file mode 100755 index 00000000..ee4decb2 --- /dev/null +++ b/scripts/install-dev-reqs.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 +from pathlib import Path +import subprocess +import sys + +subprocess.check_call([ + sys.executable, '-m', 'pip', + 'install', + '-r', Path(__file__).parent / '..' / 'requirements-dev.txt' +])