From 9fc985b3da5d6f5aa7d1adfd7acb2d68a79cbe76 Mon Sep 17 00:00:00 2001 From: Armen Date: Thu, 9 Sep 2021 16:12:50 -0400 Subject: [PATCH 1/5] Small change --- scripts/build/build_macos.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/build/build_macos.sh b/scripts/build/build_macos.sh index b974c867..9f47a590 100755 --- a/scripts/build/build_macos.sh +++ b/scripts/build/build_macos.sh @@ -54,11 +54,11 @@ if [[ $(uname -m) != 'arm64' ]]; then fi cp ${wheeldir}/*.whl ${distdir} -# kill the libpq to make sure tests don't depend on it -mv "$LIBPQ" "${LIBPQ}-bye" - # XXX: Move this code into a test script if [[ $(uname -m) != 'arm64' ]]; then + # kill the libpq to make sure tests don't depend on it + mv "$LIBPQ" "${LIBPQ}-bye" + # Install and test the built wheel pip install ${PACKAGE_NAME:-psycopg2} --no-index -f "$distdir" @@ -74,7 +74,7 @@ if [[ $(uname -m) != 'arm64' ]]; then # fi python -c "import tests; tests.unittest.main(defaultTest='tests.test_suite')" -fi -# just because I'm a boy scout -mv "${LIBPQ}-bye" "$LIBPQ" + # just because I'm a boy scout + mv "${LIBPQ}-bye" "$LIBPQ" +fi From 8adcdcb1f7d41fc6fb3b2a42f33ffc6c9027aacf Mon Sep 17 00:00:00 2001 From: Armen Date: Thu, 9 Sep 2021 16:23:59 -0400 Subject: [PATCH 2/5] One more try --- .github/workflows/m1.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/m1.yml b/.github/workflows/m1.yml index d9211f82..b406c315 100644 --- a/.github/workflows/m1.yml +++ b/.github/workflows/m1.yml @@ -3,7 +3,6 @@ name: Build packages (M1) on: - push - jobs: # This only uploads the arm64 wheels for Apple M1 Silicon usage build-macos-arm64: @@ -23,7 +22,7 @@ jobs: # Read about options here https://cibuildwheel.readthedocs.io/en/stable/options env: CIBW_ARCHS: arm64 - # XXX: temp: faster + # XXX: temp: only one version to build CIBW_BUILD: cp39-macosx_arm64 # It silences a warning since we can't test on Apple Silicon runners CIBW_TEST_SKIP: "*-macosx_arm64" @@ -32,6 +31,7 @@ jobs: - run: | ls -l + ls -l wheelhouse - name: Upload artifacts uses: actions/upload-artifact@v2 @@ -40,11 +40,11 @@ jobs: path: ./wheelhouse/*.whl build-macos: - runs-on: macos-10.15 + runs-on: macos-11.0 strategy: fail-fast: false matrix: - python-version: ['3.8'] + python-version: "3.8" steps: - name: Checkout repos @@ -61,7 +61,9 @@ jobs: PACKAGE_NAME: psycopg2-binary PSYCOPG2_TESTDB: postgres PSYCOPG2_TEST_FAST: 1 - + ARCHFLAGS: "-arch arm64" + _PYTHON_HOST_PLATFORM: macosx-11.0-arm64 + - run: | ls -l ls -l wheels From 4913603536997bed79cef080d0a5ebf7b32074da Mon Sep 17 00:00:00 2001 From: Armen Date: Thu, 9 Sep 2021 16:26:23 -0400 Subject: [PATCH 3/5] Less changes --- .github/workflows/m1.yml | 1 + .github/workflows/packages.yml | 40 +++++----------------------------- 2 files changed, 6 insertions(+), 35 deletions(-) diff --git a/.github/workflows/m1.yml b/.github/workflows/m1.yml index b406c315..77da0609 100644 --- a/.github/workflows/m1.yml +++ b/.github/workflows/m1.yml @@ -1,4 +1,5 @@ --- +# This is temporary; We will need to move to packages.yml name: Build packages (M1) on: - push diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index ff3ae21c..ac2d658d 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -3,7 +3,6 @@ name: Build packages on: - workflow_dispatch - jobs: build-sdist: strategy: @@ -51,16 +50,15 @@ jobs: --health-timeout 5s --health-retries 5 - build-manylinux: strategy: fail-fast: false matrix: include: - - {tag: manylinux2014, arch: x86_64} - - {tag: manylinux2014, arch: i686} - - {tag: manylinux_2_24, arch: aarch64} - - {tag: manylinux_2_24, arch: ppc64le} + - { tag: manylinux2014, arch: x86_64 } + - { tag: manylinux2014, arch: i686 } + - { tag: manylinux_2_24, arch: aarch64 } + - { tag: manylinux_2_24, arch: ppc64le } runs-on: ubuntu-20.04 steps: @@ -107,13 +105,12 @@ jobs: --health-timeout 5s --health-retries 5 - build-macos: runs-on: macos-10.15 strategy: fail-fast: false matrix: - python-version: ['3.6', '3.7', '3.8', '3.9'] + python-version: ["3.6", "3.7", "3.8", "3.9"] steps: - name: Checkout repos @@ -137,30 +134,3 @@ jobs: name: packages_macos path: | 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 From de4fe1ea4b55c84e2f86f250acbde410942cef78 Mon Sep 17 00:00:00 2001 From: Armen Date: Thu, 9 Sep 2021 16:33:18 -0400 Subject: [PATCH 4/5] Only Python 3.8 --- .github/workflows/m1.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/m1.yml b/.github/workflows/m1.yml index 77da0609..cac18c69 100644 --- a/.github/workflows/m1.yml +++ b/.github/workflows/m1.yml @@ -42,10 +42,6 @@ jobs: build-macos: runs-on: macos-11.0 - strategy: - fail-fast: false - matrix: - python-version: "3.8" steps: - name: Checkout repos @@ -54,7 +50,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: 3.8 - name: Build packages run: ./scripts/build/build_macos.sh From e8ddb29c2dfb2ddd871c1142a1a5d65825fcbb5e Mon Sep 17 00:00:00 2001 From: Armen Date: Thu, 9 Sep 2021 16:42:03 -0400 Subject: [PATCH 5/5] A tiny bit more --- scripts/build/build_macos.sh | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/scripts/build/build_macos.sh b/scripts/build/build_macos.sh index 9f47a590..453152ac 100755 --- a/scripts/build/build_macos.sh +++ b/scripts/build/build_macos.sh @@ -54,27 +54,24 @@ if [[ $(uname -m) != 'arm64' ]]; then fi cp ${wheeldir}/*.whl ${distdir} -# XXX: Move this code into a test script -if [[ $(uname -m) != 'arm64' ]]; then - # kill the libpq to make sure tests don't depend on it - mv "$LIBPQ" "${LIBPQ}-bye" +# kill the libpq to make sure tests don't depend on it +[[ -z "${LIBPQ:-}" ]] && mv "$LIBPQ" "${LIBPQ}-bye" - # Install and test the built wheel - 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 - python -c "import psycopg2; print(psycopg2.__version__)" - python -c "import psycopg2; print(psycopg2.__libpq_version__)" - python -c "import psycopg2; print(psycopg2.extensions.libpq_version())" +# Print psycopg and libpq versions +python -c "import psycopg2; print(psycopg2.__version__)" +python -c "import psycopg2; print(psycopg2.__libpq_version__)" +python -c "import psycopg2; print(psycopg2.extensions.libpq_version())" - # fail if we are not using the expected libpq library - # Disabled as we just use what's available on the system on macOS - # if [[ "${WANT_LIBPQ:-}" ]]; then - # python -c "import psycopg2, sys; sys.exit(${WANT_LIBPQ} != psycopg2.extensions.libpq_version())" - # fi +# fail if we are not using the expected libpq library +# Disabled as we just use what's available on the system on macOS +# if [[ "${WANT_LIBPQ:-}" ]]; then +# python -c "import psycopg2, sys; sys.exit(${WANT_LIBPQ} != psycopg2.extensions.libpq_version())" +# fi - python -c "import tests; tests.unittest.main(defaultTest='tests.test_suite')" +python -c "import tests; tests.unittest.main(defaultTest='tests.test_suite')" - # just because I'm a boy scout - mv "${LIBPQ}-bye" "$LIBPQ" -fi +# just because I'm a boy scout +[[ -z "${LIBPQ:-}" ]] && mv "${LIBPQ}-bye" "$LIBPQ"