Merge branch 'ci/build-m1-wheel' of github.com:armenzg/psycopg2 into ci/build-m1-wheel

This commit is contained in:
Armen Zambrano G 2021-09-10 12:55:31 -04:00
commit 50d74a38c7
3 changed files with 26 additions and 62 deletions

View File

@ -1,9 +1,9 @@
--- ---
# This is temporary; We will need to move to packages.yml
name: Build packages (M1) name: Build packages (M1)
on: on:
- push - push
jobs: jobs:
# This only uploads the arm64 wheels for Apple M1 Silicon usage # This only uploads the arm64 wheels for Apple M1 Silicon usage
build-macos-arm64: build-macos-arm64:
@ -23,7 +23,7 @@ jobs:
# Read about options here https://cibuildwheel.readthedocs.io/en/stable/options # Read about options here https://cibuildwheel.readthedocs.io/en/stable/options
env: env:
CIBW_ARCHS: arm64 CIBW_ARCHS: arm64
# XXX: temp: faster # XXX: temp: only one version to build
CIBW_BUILD: cp39-macosx_arm64 CIBW_BUILD: cp39-macosx_arm64
# It silences a warning since we can't test on Apple Silicon runners # It silences a warning since we can't test on Apple Silicon runners
CIBW_TEST_SKIP: "*-macosx_arm64" CIBW_TEST_SKIP: "*-macosx_arm64"
@ -32,6 +32,7 @@ jobs:
- run: | - run: |
ls -l ls -l
ls -l wheelhouse
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
@ -40,11 +41,7 @@ jobs:
path: ./wheelhouse/*.whl path: ./wheelhouse/*.whl
build-macos: build-macos:
runs-on: macos-10.15 runs-on: macos-11.0
strategy:
fail-fast: false
matrix:
python-version: ['3.8']
steps: steps:
- name: Checkout repos - name: Checkout repos
@ -53,7 +50,7 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python-version }} python-version: 3.8
- name: Build packages - name: Build packages
run: ./scripts/build/build_macos.sh run: ./scripts/build/build_macos.sh
@ -62,8 +59,8 @@ jobs:
PSYCOPG2_TESTDB: postgres PSYCOPG2_TESTDB: postgres
PSYCOPG2_TEST_FAST: 1 PSYCOPG2_TEST_FAST: 1
ARCHFLAGS: "-arch arm64" ARCHFLAGS: "-arch arm64"
_PYTHON_HOST_PLATFORM: "macosx-11.0-arm64" _PYTHON_HOST_PLATFORM: macosx-11.0-arm64
- run: | - run: |
ls -l ls -l
ls -l wheels ls -l wheels

View File

@ -3,7 +3,6 @@ name: Build packages
on: on:
- workflow_dispatch - workflow_dispatch
jobs: jobs:
build-sdist: build-sdist:
strategy: strategy:
@ -51,16 +50,15 @@ jobs:
--health-timeout 5s --health-timeout 5s
--health-retries 5 --health-retries 5
build-manylinux: build-manylinux:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- {tag: manylinux2014, arch: x86_64} - { tag: manylinux2014, arch: x86_64 }
- {tag: manylinux2014, arch: i686} - { tag: manylinux2014, arch: i686 }
- {tag: manylinux_2_24, arch: aarch64} - { tag: manylinux_2_24, arch: aarch64 }
- {tag: manylinux_2_24, arch: ppc64le} - { tag: manylinux_2_24, arch: ppc64le }
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
@ -107,13 +105,12 @@ jobs:
--health-timeout 5s --health-timeout 5s
--health-retries 5 --health-retries 5
build-macos: build-macos:
runs-on: macos-10.15 runs-on: macos-10.15
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: ['3.6', '3.7', '3.8', '3.9'] python-version: ["3.6", "3.7", "3.8", "3.9"]
steps: steps:
- name: Checkout repos - name: Checkout repos
@ -137,30 +134,3 @@ jobs:
name: packages_macos name: packages_macos
path: | path: |
dist/*/*${{ matrix.platform }}.whl dist/*/*${{ matrix.platform }}.whl
# This only uploads the arm64 wheels for Apple M1 Silicon usage
build-macos-arm64:
runs-on: macos-11.0
name: "build-macos (3.8-3.10, arm64)"
steps:
- uses: actions/checkout@v2
- name: Start postgresql service
# This skips updating brew when installing a package
env:
HOMEBREW_NO_AUTO_UPDATE: 1
run: |
brew services start postgresql
# This builds all possible Python versions (currently, 3.8 to 3.10)
- uses: pypa/cibuildwheel@v2.1.1
# Read about options here https://cibuildwheel.readthedocs.io/en/stable/options
env:
CIBW_ARCHS: arm64
# This allows substitution within setup.py
PACKAGE_NAME: psycopg2-binary
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: packages_macos_arm64
path: ./wheelhouse/*.whl

View File

@ -55,26 +55,23 @@ fi
cp ${wheeldir}/*.whl ${distdir} cp ${wheeldir}/*.whl ${distdir}
# kill the libpq to make sure tests don't depend on it # kill the libpq to make sure tests don't depend on it
mv "$LIBPQ" "${LIBPQ}-bye" [[ -z "${LIBPQ:-}" ]] && mv "$LIBPQ" "${LIBPQ}-bye"
# XXX: Move this code into a test script # Install and test the built wheel
if [[ $(uname -m) != 'arm64' ]]; then pip install ${PACKAGE_NAME:-psycopg2} --no-index -f "$distdir"
# Install and test the built wheel
pip install ${PACKAGE_NAME:-psycopg2} --no-index -f "$distdir"
# Print psycopg and libpq versions # Print psycopg and libpq versions
python -c "import psycopg2; print(psycopg2.__version__)" python -c "import psycopg2; print(psycopg2.__version__)"
python -c "import psycopg2; print(psycopg2.__libpq_version__)" python -c "import psycopg2; print(psycopg2.__libpq_version__)"
python -c "import psycopg2; print(psycopg2.extensions.libpq_version())" python -c "import psycopg2; print(psycopg2.extensions.libpq_version())"
# fail if we are not using the expected libpq library # fail if we are not using the expected libpq library
# Disabled as we just use what's available on the system on macOS # Disabled as we just use what's available on the system on macOS
# if [[ "${WANT_LIBPQ:-}" ]]; then # if [[ "${WANT_LIBPQ:-}" ]]; then
# python -c "import psycopg2, sys; sys.exit(${WANT_LIBPQ} != psycopg2.extensions.libpq_version())" # python -c "import psycopg2, sys; sys.exit(${WANT_LIBPQ} != psycopg2.extensions.libpq_version())"
# fi # fi
python -c "import tests; tests.unittest.main(defaultTest='tests.test_suite')" python -c "import tests; tests.unittest.main(defaultTest='tests.test_suite')"
fi
# just because I'm a boy scout # just because I'm a boy scout
mv "${LIBPQ}-bye" "$LIBPQ" [[ -z "${LIBPQ:-}" ]] && mv "${LIBPQ}-bye" "$LIBPQ"