Skip to content

Commit b09945b

Browse files
committed
Deploy universal2 and arm64 wheels on OSX.
Automatically generate ABI wheels on all platforms.
1 parent 37bc8e2 commit b09945b

File tree

2 files changed

+23
-52
lines changed

2 files changed

+23
-52
lines changed

.github/workflows/python-package-macos.yml

+20-52
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: ["macos-latest"]
15-
python-version: ["3.7.9"]
15+
python-version: ["3.x"]
1616

1717
steps:
1818
# v2 breaks `git describe` so v1 is needed.
@@ -24,70 +24,38 @@ jobs:
2424
- name: Print git describe
2525
run: |
2626
git describe
27-
- name: Set up Mac Python ${{ matrix.python-version }}
28-
# actions/setup-python can't be used as it builds less portable extensions.
29-
env:
30-
MB_PYTHON_VERSION: ${{ matrix.python-version }}
31-
run: |
32-
source .travis/install_python.sh
33-
install_python
34-
$PYTHON_EXE -m venv venv
35-
source venv/bin/activate
36-
echo "$PATH" >> $GITHUB_PATH
37-
- name: Print Python version
38-
run: |
39-
python -VV
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: ${{ matrix.python-version }}
4031
- name: Install Python dependencies
4132
run: |
4233
python -m pip install --upgrade pip
43-
pip install pytest pytest-cov pytest-benchmark wheel twine
44-
pip install git+https://github.com/HexDecimal/delocate.git@loader_path
34+
pip install wheel twine
4535
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
46-
- name: Build package.
47-
run: |
48-
python setup.py sdist develop bdist_wheel --py-limited-api=cp36
49-
- name: Test with pytest
50-
run: |
51-
pytest --no-window --cov-report=xml
52-
- uses: codecov/codecov-action@v1
53-
- name: Package binary files
36+
- name: Prepare package.
37+
# Downloads SDL2 for the later step.
5438
run: |
55-
delocate-wheel -v dist/*.whl
56-
delocate-listdeps --all dist/*.whl
39+
python setup.py check
40+
- name: Build wheels
41+
uses: pypa/[email protected]
42+
env:
43+
CIBW_BUILD: cp38-* pp*
44+
CIBW_ARCHS_MACOS: x86_64 arm64 universal2
45+
CIBW_BEFORE_BUILD_MACOS: pip install --force-reinstall git+https://github.com/HexDecimal/delocate.git@loader_path
46+
CIBW_BEFORE_TEST: pip install numpy
47+
CIBW_TEST_COMMAND: python -c "import tcod"
48+
CIBW_TEST_SKIP: "pp* *-macosx_arm64 *-macosx_universal2:arm64"
5749
- name: Archive wheel
5850
uses: actions/upload-artifact@v2
5951
with:
6052
name: wheel-macos
61-
path: dist/*.whl
53+
path: wheelhouse/*.whl
6254
retention-days: 1
6355
- name: Upload to PyPI
6456
if: github.event_name == 'release'
6557
env:
6658
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
6759
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
6860
run: |
69-
twine upload --skip-existing dist/*
70-
71-
isolated_test:
72-
name: Verify wheel dependencies
73-
needs: build
74-
runs-on: ${{ matrix.os }}
75-
strategy:
76-
matrix:
77-
os: ["macos-latest"]
78-
python-version: ["3.x"]
79-
steps:
80-
- name: Set up Python ${{ matrix.python-version }}
81-
uses: actions/setup-python@v2
82-
with:
83-
python-version: ${{ matrix.python-version }}
84-
- uses: actions/download-artifact@v2
85-
with:
86-
name: wheel-macos
87-
path: dist
88-
- name: Install tcod from wheel
89-
run: |
90-
python -m pip install dist/*.whl
91-
- name: Verify dependency correctness
92-
run: |
93-
python -c "import tcod"
61+
twine upload --skip-existing wheelhouse/*

setup.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
pyinstaller40 =
33
hook-dirs = tcod.__pyinstaller:get_hook_dirs
44

5+
[bdist_wheel]
6+
py-limited-api = cp36
7+
58
[aliases]
69
test=pytest
710

0 commit comments

Comments
 (0)