|
| 1 | +name: Debug |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "debug" |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-wheels: |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + python-version: [3.5, 3.6, 3.7, 3.8, 3.9] |
| 14 | + os: [ubuntu-20.04] |
| 15 | + arch: [aarch64] |
| 16 | + exclude: |
| 17 | + # Python 3.5 is unable to properly |
| 18 | + # find the recent VS tooling |
| 19 | + # https://bugs.python.org/issue30389 |
| 20 | + - os: windows-latest |
| 21 | + python-version: 3.5 |
| 22 | + - os: windows-latest |
| 23 | + arch: aarch64 |
| 24 | + - os: macos-latest |
| 25 | + arch: aarch64 |
| 26 | + |
| 27 | + defaults: |
| 28 | + run: |
| 29 | + shell: bash |
| 30 | + |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v1 |
| 33 | + with: |
| 34 | + fetch-depth: 50 |
| 35 | + submodules: true |
| 36 | + |
| 37 | + - name: Set up QEMU |
| 38 | + if: matrix.arch == 'aarch64' |
| 39 | + uses: docker/setup-qemu-action@v1 |
| 40 | + |
| 41 | + - name: Set up Python ${{ matrix.python-version }} |
| 42 | + uses: actions/setup-python@v1 |
| 43 | + with: |
| 44 | + python-version: ${{ matrix.python-version }} |
| 45 | + |
| 46 | + - name: Install Python Deps |
| 47 | + run: | |
| 48 | + python -m pip install --upgrade setuptools pip wheel |
| 49 | +
|
| 50 | + - name: Build Wheels (linux) |
| 51 | + if: startsWith(matrix.os, 'ubuntu') |
| 52 | + env: |
| 53 | + PYTHON_VERSION: ${{ matrix.python-version }} |
| 54 | + ARCH: ${{ matrix.arch }} |
| 55 | + run: | |
| 56 | + case "${ARCH}" in |
| 57 | + x86_64) |
| 58 | + mlimg=manylinux1_x86_64 |
| 59 | + ;; |
| 60 | + aarch64) |
| 61 | + mlimg=manylinux2014_aarch64 |
| 62 | + ;; |
| 63 | + *) |
| 64 | + echo "Unsupported wheel arch: ${ARCH}" >&2 |
| 65 | + exit 1 |
| 66 | + ;; |
| 67 | + esac |
| 68 | +
|
| 69 | + docker run --rm \ |
| 70 | + -v "${GITHUB_WORKSPACE}":/github/workspace:rw \ |
| 71 | + --workdir=/github/workspace \ |
| 72 | + -e GITHUB_WORKSPACE=/github/workspace \ |
| 73 | + -e PYTHON_VERSION="${PYTHON_VERSION}" \ |
| 74 | + --entrypoint=/github/workspace/.github/workflows/build-manylinux-wheels.sh \ |
| 75 | + quay.io/pypa/${mlimg} |
| 76 | +
|
| 77 | + - name: Build Wheels (non-linux) |
| 78 | + if: "!startsWith(matrix.os, 'ubuntu')" |
| 79 | + run: | |
| 80 | + make clean |
| 81 | + python setup.py bdist_wheel |
| 82 | +
|
| 83 | + - name: Test Wheels (native) |
| 84 | + if: | |
| 85 | + !contains(github.event.pull_request.labels.*.name, 'skip wheel tests') |
| 86 | + && matrix.arch == 'x86_64' |
| 87 | + env: |
| 88 | + OS: ${{ matrix.os }} |
| 89 | + run: | |
| 90 | + if [ "${OS}" = "windows-latest" ]; then |
| 91 | + export PGINSTALLATION="${PGBIN}" |
| 92 | + fi |
| 93 | + "${GITHUB_WORKSPACE}/.github/workflows/test-wheels.sh" |
| 94 | +
|
| 95 | + - name: Test Wheels (emulated) |
| 96 | + if: | |
| 97 | + !contains(github.event.pull_request.labels.*.name, 'skip wheel tests') |
| 98 | + && matrix.arch != 'x86_64' |
| 99 | + env: |
| 100 | + PYTHON_VERSION: ${{ matrix.python-version }} |
| 101 | + PGVERSION: 13 |
| 102 | + DISTRO_NAME: focal |
| 103 | + ARCH: ${{ matrix.arch }} |
| 104 | + run: | |
| 105 | + sudo env DISTRO_NAME="${DISTRO_NAME}" PGVERSION="${PGVERSION}" \ |
| 106 | + .github/workflows/install-postgres.sh |
| 107 | + # Allow docker guest to connect to the database |
| 108 | + echo "port = 5433" | \ |
| 109 | + sudo tee --append /etc/postgresql/${PGVERSION}/main/postgresql.conf |
| 110 | + echo "listen_addresses = '*'" | \ |
| 111 | + sudo tee --append /etc/postgresql/${PGVERSION}/main/postgresql.conf |
| 112 | + echo "host all all 172.17.0.0/16 trust" | \ |
| 113 | + sudo tee --append /etc/postgresql/${PGVERSION}/main/pg_hba.conf |
| 114 | + if [ "${PGVERSION}" -ge "11" ]; then |
| 115 | + # Disable JIT to avoid unpredictable timings in tests. |
| 116 | + echo "jit = off" | \ |
| 117 | + sudo tee --append /etc/postgresql/${PGVERSION}/main/postgresql.conf |
| 118 | + fi |
| 119 | + sudo pg_ctlcluster ${PGVERSION} main restart |
| 120 | +
|
| 121 | + case "${ARCH}" in |
| 122 | + aarch64) |
| 123 | + img="docker.io/arm64v8/python:${PYTHON_VERSION}-buster" |
| 124 | + ;; |
| 125 | + *) |
| 126 | + echo "Unsupported wheel arch: ${ARCH}" >&2 |
| 127 | + exit 1 |
| 128 | + ;; |
| 129 | + esac |
| 130 | +
|
| 131 | + docker run --rm \ |
| 132 | + -v "${GITHUB_WORKSPACE}":/github/workspace:rw \ |
| 133 | + -e GITHUB_WORKSPACE=/github/workspace \ |
| 134 | + -e PYTHON_VERSION="${PYTHON_VERSION}" \ |
| 135 | + --workdir=/github/workspace/ \ |
| 136 | + ${img} \ |
| 137 | + /bin/bash -ex -c ' \ |
| 138 | + echo GITHUB_WORKSPACE=${GITHUB_WORKSPACE} >> /etc/environment \ |
| 139 | + && echo PGHOST=$(ip route | grep default | cut -f3 -d" " | uniq) \ |
| 140 | + >> /etc/environment \ |
| 141 | + && echo PGPORT=5433 >> /etc/environment \ |
| 142 | + && echo PGUSER=postgres >> /etc/environment \ |
| 143 | + && echo ENVIRON_FILE /etc/environment >> /etc/login.defs \ |
| 144 | + && useradd -m -s /bin/bash test \ |
| 145 | + && su -l test /github/workspace/.github/workflows/test-wheels.sh \ |
| 146 | + ' |
0 commit comments