Skip to content

Commit c4127f9

Browse files
committed
Add GitHub Actions for MacOS.
Needed to add a definition for MacOS to build the vendored zlib correctly.
1 parent b0eee10 commit c4127f9

3 files changed

Lines changed: 50 additions & 1 deletion

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Python package (MacOS)
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: ['macos-11.0']
12+
python-version: ['3.5']
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0 # Needed for git describe to find tags.
18+
- name: Checkout submodules
19+
run: |
20+
git submodule update --init --recursive --depth 1
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install Python dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
python -m pip install pytest pytest-cov pytest-benchmark delocate wheel twine
29+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
30+
- name: Build package.
31+
run: |
32+
python setup.py sdist develop bdist_wheel --py-limited-api=cp35
33+
- name: Package binary files
34+
run: |
35+
delocate-wheel -v dist/*.whl
36+
delocate-listdeps --all dist/*.whl
37+
- name: Test with pytest
38+
run: |
39+
pytest --no-window
40+
- name: Upload to PyPI
41+
if: startsWith(github.ref, 'refs/tags/') # Only run on tags.
42+
env:
43+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
44+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
45+
run: |
46+
twine upload --skip-existing dist/*

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Python package
4+
name: Python package (Linux)
55

66
on: [push, pull_request]
77

build_libtcod.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ def fix_header(filepath: str) -> None:
287287
extra_link_args += ["-rpath", "%s/.." % SDL2_BUNDLE_PATH]
288288
extra_link_args += ["-rpath", "/usr/local/opt/llvm/lib/"]
289289

290+
# Fix "implicit declaration of function 'close'" in zlib.
291+
define_macros.append(("HAVE_UNISTD_H", 1))
292+
290293
if sys.platform not in ["win32", "darwin"]:
291294
extra_parse_args += (
292295
subprocess.check_output(

0 commit comments

Comments
 (0)