From: Daniele Varrazzo Date: Sun, 28 Aug 2022 16:56:08 +0000 (+0100) Subject: ci: run CRDB tests in CI X-Git-Tag: 3.1~2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b74f5d4ef08f6efe353f48fdbc900a41c0d5b18;p=thirdparty%2Fpsycopg.git ci: run CRDB tests in CI --- diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9dc03fdb7..fa5ec0794 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -239,3 +239,64 @@ jobs: # }}} + + crdb: # {{{ + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + include: + - {crdb: "latest-v22.1", python: "3.10", impl: "c", libpq: "newest"} + - {crdb: "latest-v21.2", python: "3.9", impl: "python", libpq: ""} + + env: + PSYCOPG_IMPL: ${{ matrix.impl }} + PSYCOPG_TEST_DSN: "host=127.0.0.1 port=26257 user=root dbname=defaultdb" + PYTEST_ADDOPTS: --color yes + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + + - name: Run CockroachDB + # Note: this would love to be a service, but I don't see a way to pass + # the args to the docker run command line. + run: | + docker pull cockroachdb/cockroach:${{ matrix.crdb }} + docker run --rm -d --name crdb -p 26257:26257 \ + cockroachdb/cockroach:${{ matrix.crdb }} start-single-node --insecure + + - name: Install the newest libpq version available + if: ${{ matrix.libpq == 'newest' }} + run: | + set -x + rel=$(lsb_release -c -s) + echo "deb http://apt.postgresql.org/pub/repos/apt ${rel}-pgdg main" \ + | sudo tee -a /etc/apt/sources.list.d/pgdg.list + sudo apt-get -qq update + pqver=$(apt-cache show libpq5 | grep ^Version: | head -1 \ + | awk '{print $2}') + sudo apt-get -qq -y install "libpq-dev=${pqver}" "libpq5=${pqver}" + + - name: Install tox + run: pip install tox + + - name: Run tests (Python implementation) + if: ${{ matrix.impl == 'python' }} + run: tox -c psycopg -e ${{ matrix.python }} + + - name: Run tests (C implementation) + if: ${{ matrix.impl == 'c' }} + # skip tests failing on importing psycopg_c.pq on subprocess + # they only fail on Travis, work ok locally under tox too. + run: tox -c psycopg_c -e ${{ matrix.python }} -- -m 'not subprocess' + + - name: Stop CockroachDB + run: docker kill crdb + + + # }}}