Skip to content

Commit

Permalink
Release workflow updates
Browse files Browse the repository at this point in the history
* Add musllinux support
* Build 32-bit packages for Windows (fixes #834)
* Don't ship Cython-generated *.c files in wheels
  • Loading branch information
elprans committed Nov 16, 2021
1 parent 18f2aa4 commit 220d1d5
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 20 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/install-postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ elif [ "${ID}" = "centos" ]; then
"postgresql${PGVERSION}-server" \
"postgresql${PGVERSION}-contrib"
ln -s "/usr/pgsql-${PGVERSION}/bin/pg_config" "/usr/local/bin/pg_config"
elif [ "${ID}" = "alpine" ]; then
apk add shadow postgresql postgresql-dev postgresql-contrib
else
echo "install-postgres.sh: Unsupported distro: ${distro}" >&2
exit 1
fi

useradd -m -s /bin/bash apgtest
24 changes: 8 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,13 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
cibw_python: ["cp37-*", "cp38-*", "cp39-*", "cp310-*"]
cibw_arch: ["auto64"]
cibw_python: ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp310-*"]
cibw_arch: ["auto64", "auto32"]
exclude:
- os: macos-latest
cibw_arch: "auto32"
- os: ubuntu-latest
cibw_arch: "auto32"

defaults:
run:
Expand All @@ -90,24 +95,11 @@ jobs:
fetch-depth: 50
submodules: true

- uses: pypa/cibuildwheel@v2.1.1
- uses: pypa/cibuildwheel@v2.2.2
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_BEFORE_ALL_LINUX: >
yum -y install libffi-devel
&& env PGVERSION=12 .github/workflows/install-postgres.sh
&& useradd -m -s /bin/bash apgtest
CIBW_TEST_EXTRAS: "test"
CIBW_TEST_COMMAND: >
python {project}/tests/__init__.py
CIBW_TEST_COMMAND_WINDOWS: >
python {project}\tests\__init__.py
CIBW_TEST_COMMAND_LINUX: >
PY=`which python`
&& chmod -R go+rX "$(dirname $(dirname $(dirname $PY)))"
&& su -p -l apgtest -c "$PY {project}/tests/__init__.py"

- uses: actions/upload-artifact@v2
with:
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ clean:
rm -fr dist/ doc/_build/
rm -fr asyncpg/pgproto/*.c asyncpg/pgproto/*.html
rm -fr asyncpg/pgproto/codecs/*.html
rm -fr asyncpg/pgproto/*.so
rm -fr asyncpg/protocol/*.c asyncpg/protocol/*.html
rm -fr asyncpg/protocol/*.so build *.egg-info
rm -fr asyncpg/protocol/codecs/*.html
Expand Down
24 changes: 24 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[project]
requires-python = ">=3.6"

[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
build-frontend = "build"
test-extras = "test"

[tool.cibuildwheel.macos]
test-command = "python {project}/tests/__init__.py"

[tool.cibuildwheel.windows]
test-command = "python {project}\\tests\\__init__.py"

[tool.cibuildwheel.linux]
before-all = ".github/workflows/install-postgres.sh"
test-command = """\
PY=`which python` \
&& chmod -R go+rX "$(dirname $(dirname $(dirname $PY)))" \
&& su -l apgtest -c "$PY {project}/tests/__init__.py" \
"""
10 changes: 7 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,13 @@ def finalize_options(self):
author_email='hello@magic.io',
url='https://github.com/MagicStack/asyncpg',
license='Apache License, Version 2.0',
packages=['asyncpg'],
provides=['asyncpg'],
include_package_data=True,
packages=setuptools.find_packages(
exclude=['tests', 'tools'],
),
package_data={
# Cython sources needed for tracebacks
"": ["*.pyx", "*.pxd", "*.pxi"],
},
ext_modules=[
setuptools.extension.Extension(
"asyncpg.pgproto.pgproto",
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ def suite():


if __name__ == '__main__':
runner = unittest.runner.TextTestRunner()
runner = unittest.runner.TextTestRunner(verbosity=2)
result = runner.run(suite())
sys.exit(not result.wasSuccessful())

0 comments on commit 220d1d5

Please sign in to comment.