From 6d99aa2f29a240c3ba110a33644fdb6af6ed87c8 Mon Sep 17 00:00:00 2001 From: Armen Zambrano G Date: Thu, 9 Sep 2021 09:20:37 -0400 Subject: [PATCH] Upload repaired_wheels --- .github/workflows/packages.yml | 21 +++++++++++++-------- scripts/build/build_macos.sh | 10 +++++++--- scripts/build/test_macos_arm64.sh | 13 ++++++++++++- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index c8850efb..cbba2288 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -140,32 +140,37 @@ jobs: # This only uploads the arm64 wheels for Apple M1 Silicon usage build-macos-arm64: - runs-on: ${{ matrix.os }} + runs-on: macos-11.0 strategy: fail-fast: false - matrix: - os: [macos-10.15, macos-11.0] - name: "build-${{ matrix.os }} - arm64" + name: "build-macos-11 - arm64" steps: - uses: actions/checkout@v2 - name: Install pre-requisites + # This skips updating brew when installing a package + env: HOMEBREW_NO_AUTO_UPDATE=1 run: | brew install postgresql@13 brew services start postgresql # This builds all possible Python versions (currently, 3.8 to 3.10) - uses: pypa/cibuildwheel@v2.1.1 - with: - output-dir: dist # Read about options here https://cibuildwheel.readthedocs.io/en/stable/options env: CIBW_ARCHS: arm64 + # This changes the default in order to place the wheel in "repaired_wheels" + CIBW_REPAIR_WHEEL_COMMAND: delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -w repaired_wheels {wheel} # This allows substitution within setup.py PACKAGE_NAME: psycopg2-binary + + - run: | + ls -l + ls -l dist + ls -l repaired_wheels - name: Upload artifacts uses: actions/upload-artifact@v2 with: - name: packages_${{ matrix.os }}_arm64 + name: packages_macos_arm64 path: | - dist/*macosx_11_0_arm64.whl + repaired_wheels/*.whl diff --git a/scripts/build/build_macos.sh b/scripts/build/build_macos.sh index d2e1631f..b21aa8ad 100755 --- a/scripts/build/build_macos.sh +++ b/scripts/build/build_macos.sh @@ -33,7 +33,9 @@ distdir="${prjdir}/dist/psycopg2-$version" mkdir -p "$distdir" # Install required python packages -pip install -U pip wheel delocate +pip install -U pip wheel +# Running it after installing wheel will save building the wheel +pip install -U delocate # Build the wheels wheeldir="${prjdir}/wheels" @@ -46,8 +48,10 @@ if [[ -z "${LIBPQ:-}" ]]; then fi delocate-wheel ${wheeldir}/*.whl -# https://github.com/MacPython/wiki/wiki/Spinning-wheels#question-will-pip-give-me-a-broken-wheel -delocate-addplat --rm-orig -x 10_9 -x 10_10 ${wheeldir}/*.whl +if [[ $(uname -m) != 'arm64' ]]; then + # https://github.com/MacPython/wiki/wiki/Spinning-wheels#question-will-pip-give-me-a-broken-wheel + delocate-addplat --rm-orig -x 10_9 -x 10_10 ${wheeldir}/*.whl +fi cp ${wheeldir}/*.whl ${distdir} # kill the libpq to make sure tests don't depend on it diff --git a/scripts/build/test_macos_arm64.sh b/scripts/build/test_macos_arm64.sh index fdfe0be7..e327bd75 100755 --- a/scripts/build/test_macos_arm64.sh +++ b/scripts/build/test_macos_arm64.sh @@ -9,4 +9,15 @@ set -euo pipefail set -x -url= \ No newline at end of file +tempdir=$(mktemp -d /tmp/psycopg2.$$) +venv="$tempdir/venv" +unzip "$1" -d "$tempdir" + +# XXX: It would be ideal to run this script against various Python versions +python3 -m venv "$venv" +source "$venv/bin/activate" +pip install psycopg2-binary --no-index -f dist +python -c "import psycopg2; print(psycopg2.__version__)" +python -c "import psycopg2; print(psycopg2.__libpq_version__)" +python -c "import psycopg2; print(psycopg2.extensions.libpq_version())" +python -c "import tests; tests.unittest.main(defaultTest='tests.test_suite')"