diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2023-04-02 17:33:56 +0200 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2023-04-02 17:56:29 +0200 |
commit | 333b3b7ac45099f7b86ab35ac89152293ac7451d (patch) | |
tree | 2d958ace4b5f7418aa06c961333ddaf865039765 /.github/workflows/packages.yml | |
parent | 7a8f4d62229bb1a6404719a7740e468087ddbeff (diff) | |
download | psycopg2-333b3b7ac45099f7b86ab35ac89152293ac7451d.tar.gz |
ci: use cibuildwheel to build linux wheel packages2.9.6
Diffstat (limited to '.github/workflows/packages.yml')
-rw-r--r-- | .github/workflows/packages.yml | 69 |
1 files changed, 39 insertions, 30 deletions
diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 07fe215..a7fde4d 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -52,20 +52,14 @@ jobs: --health-retries 5 - build-manylinux: + build-linux: if: true strategy: fail-fast: false matrix: - include: - - {tag: manylinux2014, arch: x86_64} - - {tag: manylinux2014, arch: i686} - - {tag: manylinux2014, arch: aarch64} - - {tag: manylinux2014, arch: ppc64le} - - {tag: musllinux_1_1, arch: x86_64} - - {tag: musllinux_1_1, arch: i686} - - {tag: musllinux_1_1, arch: aarch64} - - {tag: musllinux_1_1, arch: ppc64le} + platform: [manylinux, musllinux] + arch: [x86_64, i686, aarch64, ppc64le] + pyver: [cp37, cp38, cp39, cp310, cp311] runs-on: ubuntu-latest steps: @@ -75,31 +69,46 @@ jobs: - name: Set up QEMU for multi-arch build uses: docker/setup-qemu-action@v2 - - name: Build packages - run: >- - docker run --rm - -e PLAT=${{ matrix.tag }}_${{ matrix.arch }} - -e PACKAGE_NAME=psycopg2-binary - -e PYVERS="cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311" - -e PSYCOPG2_TESTDB=postgres - -e PSYCOPG2_TESTDB_HOST=172.17.0.1 - -e PSYCOPG2_TESTDB_USER=postgres - -e PSYCOPG2_TESTDB_PASSWORD=password - -e PSYCOPG2_TEST_FAST=1 - -v `pwd`:/src - --workdir /src - quay.io/pypa/${{ matrix.tag }}_${{ matrix.arch }} - ./scripts/build/build_${{ matrix.tag }}.sh + - name: Cache libpq build + uses: actions/cache@v3 + with: + path: /tmp/libpq.build + key: libpq-${{ env.LIBPQ_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }} - - name: Upload artifacts - uses: actions/upload-artifact@v3 + - name: Build wheels + uses: pypa/cibuildwheel@v2.12.0 + env: + CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 + CIBW_MANYLINUX_I686_IMAGE: manylinux2014 + CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 + CIBW_MANYLINUX_PPC64LE_IMAGE: manylinux2014 + CIBW_BUILD: ${{matrix.pyver}}-${{matrix.platform}}_${{matrix.arch}} + CIBW_ARCHS_LINUX: auto aarch64 ppc64le + CIBW_BEFORE_ALL_LINUX: ./scripts/build/wheel_linux_before_all.sh + CIBW_REPAIR_WHEEL_COMMAND: >- + ./scripts/build/strip_wheel.sh {wheel} + && auditwheel repair -w {dest_dir} {wheel} + CIBW_TEST_COMMAND: >- + export PYTHONPATH={project} && + python -c "import tests; tests.unittest.main(defaultTest='tests.test_suite')" + CIBW_ENVIRONMENT: >- + PACKAGE_NAME=psycopg2-binary + LIBPQ_BUILD_PREFIX=/host/tmp/libpq.build + PATH="$LIBPQ_BUILD_PREFIX/bin:$PATH" + LD_LIBRARY_PATH="$LIBPQ_BUILD_PREFIX/lib:$LIBPQ_BUILD_PREFIX/lib64" + PSYCOPG2_TESTDB=postgres + PSYCOPG2_TESTDB_HOST=172.17.0.1 + PSYCOPG2_TESTDB_USER=postgres + PSYCOPG2_TESTDB_PASSWORD=password + PSYCOPG2_TEST_FAST=1 + + - uses: actions/upload-artifact@v3 with: - path: | - dist/*.whl + path: ./wheelhouse/*.whl services: postgresql: - image: postgres:13 + image: postgres:14 env: POSTGRES_PASSWORD: password ports: |