Try again

This commit is contained in:
Armen Zambrano G 2021-09-08 14:56:39 -04:00
parent fe1165544c
commit 8d55da4074
3 changed files with 40 additions and 23 deletions

View File

@ -2,6 +2,8 @@
name: Build packages name: Build packages
on: on:
- workflow_dispatch - workflow_dispatch
# XXX: Temp change while working on PR; remove with prettier changes
- pull_request
jobs: jobs:
build-sdist: build-sdist:
@ -137,24 +139,44 @@ 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:
runs-on: macos-10.15 runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
name: "build-macos (3.8-3.10 - arm64)" matrix:
os: [macos-10.15, macos-11.0]
name: "build-${{ matrix.os }} - arm64)"
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install pre-requisites
run: |
# brew install gnu-sed postgresql@13
brew install postgresql@13
brew services start postgresql
# gsed -i "s/^setup(name=\"psycopg2\"/setup(name=\"psycopg2-binary\"/" setup.py
# git diff
# This builds all possible Python versions (currently, 3.8 to 3.10) # This builds all possible Python versions (currently, 3.8 to 3.10)
- uses: pypa/cibuildwheel@v2.1.1 - uses: pypa/cibuildwheel@v2.1.1
with: with:
output-dir: dist output-dir: dist
# 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_MACOS: arm64 CIBW_ARCHS: arm64
# Skip testing the arm64 builds PACKAGE_NAME: psycopg2-binary
CIBW_TEST_SKIP: "*:arm64"
- name: Some tests
run: |
git diff
ls -l dist
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')"
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: packages_macos_arm64 name: packages_${{ matrix.os }}_arm64
path: | path: |
dist/*macosx_11_0_arm64.whl dist/*macosx_11_0_arm64.whl

View File

@ -8,8 +8,8 @@
set -euo pipefail set -euo pipefail
set -x set -x
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
prjdir="$( cd "${dir}/../.." && pwd )" prjdir="$(cd "${dir}/../.." && pwd)"
brew install gnu-sed postgresql@13 brew install gnu-sed postgresql@13
@ -17,13 +17,13 @@ brew install gnu-sed postgresql@13
brew services start postgresql brew services start postgresql
for i in $(seq 10 -1 0); do for i in $(seq 10 -1 0); do
eval pg_isready && break eval pg_isready && break
if [ $i == 0 ]; then if [ $i == 0 ]; then
echo "PostgreSQL service not ready, giving up" echo "PostgreSQL service not ready, giving up"
exit 1 exit 1
fi fi
echo "PostgreSQL service not ready, waiting a bit, attempts left: $i" echo "PostgreSQL service not ready, waiting a bit, attempts left: $i"
sleep 5 sleep 5
done done
# Find psycopg version # Find psycopg version
@ -35,15 +35,9 @@ mkdir -p "$distdir"
# Install required python packages # Install required python packages
pip install -U pip wheel delocate pip install -U pip wheel delocate
# Replace the package name
if [[ "${PACKAGE_NAME:-}" ]]; then
gsed -i "s/^setup(name=\"psycopg2\"/setup(name=\"${PACKAGE_NAME}\"/" \
"${prjdir}/setup.py"
fi
# Build the wheels # Build the wheels
wheeldir="${prjdir}/wheels" wheeldir="${prjdir}/wheels"
pip wheel -w ${wheeldir} . pip wheel --use-feature=in-tree-build -w ${wheeldir} .
delocate-listdeps ${wheeldir}/*.whl delocate-listdeps ${wheeldir}/*.whl
# Check where is the libpq. I'm gonna kill it for testing # Check where is the libpq. I'm gonna kill it for testing

View File

@ -45,6 +45,7 @@ except ImportError:
# for a consistent versioning pattern. # for a consistent versioning pattern.
PSYCOPG_VERSION = '2.9.1' PSYCOPG_VERSION = '2.9.1'
PSYCOPG_NAME = os.environ.get("PACKAGE_NAME", "psycopg2")
# note: if you are changing the list of supported Python version please fix # note: if you are changing the list of supported Python version please fix
@ -545,7 +546,7 @@ except Exception:
print("failed to read readme: ignoring...") print("failed to read readme: ignoring...")
readme = __doc__ readme = __doc__
setup(name="psycopg2", setup(name=PSYCOPG_NAME,
version=PSYCOPG_VERSION, version=PSYCOPG_VERSION,
author="Federico Di Gregorio", author="Federico Di Gregorio",
author_email="fog@initd.org", author_email="fog@initd.org",