diff --git a/.travis.yml b/.travis.yml index ee95ab265..94b3da4e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,50 +1,56 @@ language: node_js -sudo: true -dist: trusty +dist: bionic before_script: - node script/create-test-tables.js pg://postgres@127.0.0.1:5432/postgres - -before_install: - - if [ $TRAVIS_OS_NAME == "linux" ]; then - if [[ $(node -v) =~ v[1-9][0-9] ]]; then - source ./ci_scripts/build.sh; - fi - fi - + env: - CC=clang CXX=clang++ npm_config_clang=1 PGUSER=postgres PGDATABASE=postgres +node_js: + - lts/dubnium + - lts/erbium + - 13 + +addons: + postgresql: "10" + matrix: include: - - node_js: "lts/boron" - addons: - postgresql: "9.6" - - node_js: "lts/argon" - addons: - postgresql: "9.6" - - node_js: "10" + # different Node versions on PostgreSQL 9.5 that require precise + - node_js: lts/argon addons: - postgresql: "9.6" - - node_js: "12" - addons: - postgresql: "9.6" - - node_js: "lts/carbon" + postgresql: "9.5" + dist: precise + - node_js: lts/boron addons: - postgresql: "9.1" + postgresql: "9.5" dist: precise - - node_js: "lts/carbon" + - node_js: lts/carbon addons: - postgresql: "9.2" - - node_js: "lts/carbon" + postgresql: "9.5" + dist: precise + + # different PostgreSQL versions on Node LTS + - node_js: lts/erbium addons: postgresql: "9.3" - - node_js: "lts/carbon" + - node_js: lts/erbium addons: postgresql: "9.4" - - node_js: "lts/carbon" + - node_js: lts/erbium addons: postgresql: "9.5" - - node_js: "lts/carbon" + - node_js: lts/erbium addons: postgresql: "9.6" + + # PostgreSQL 9.1 and 9.2 only work on precise + - node_js: lts/carbon + addons: + postgresql: "9.1" + dist: precise + - node_js: lts/carbon + addons: + postgresql: "9.2" + dist: precise diff --git a/ci_scripts/build.sh b/ci_scripts/build.sh deleted file mode 100644 index 707bf4d55..000000000 --- a/ci_scripts/build.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -BUILD_DIR="$(pwd)" -source ./ci_scripts/install_openssl.sh 1.1.1b -sudo updatedb -source ./ci_scripts/install_libpq.sh -sudo updatedb -sudo ldconfig -cd $BUILD_DIR diff --git a/ci_scripts/install_libpq.sh b/ci_scripts/install_libpq.sh deleted file mode 100644 index 936c7d645..000000000 --- a/ci_scripts/install_libpq.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -set -e - -OPENSSL_DIR="$(pwd)/openssl-1.1.1b" -POSTGRES_VERSION="11.3" -POSTGRES_DIR="$(pwd)/postgres-${POSTGRES_VERSION}" -TMP_DIR="/tmp/postgres" -JOBS="-j$(nproc || echo 1)" - -if [ -d "${TMP_DIR}" ]; then - rm -rf "${TMP_DIR}" -fi - -mkdir -p "${TMP_DIR}" - -curl https://ftp.postgresql.org/pub/source/v${POSTGRES_VERSION}/postgresql-${POSTGRES_VERSION}.tar.gz | \ - tar -C "${TMP_DIR}" -xzf - - -cd "${TMP_DIR}/postgresql-${POSTGRES_VERSION}" - -if [ -d "${POSTGRES_DIR}" ]; then - rm -rf "${POSTGRES_DIR}" -fi -mkdir -p $POSTGRES_DIR - -./configure --prefix=$POSTGRES_DIR --with-openssl --with-includes=${OPENSSL_DIR}/include --with-libraries=${OPENSSL_DIR}/lib --without-readline - -cd src/interfaces/libpq; make; make install; cd - -cd src/bin/pg_config; make install; cd - -cd src/backend; make generated-headers; cd - -cd src/include; make install; cd - - -export PATH="${POSTGRES_DIR}/bin:${PATH}" -export CFLAGS="-I${POSTGRES_DIR}/include" -export LDFLAGS="-L${POSTGRES_DIR}/lib" -export LD_LIBRARY_PATH="${POSTGRES_DIR}/lib:$LD_LIBRARY_PATH" -export PKG_CONFIG_PATH="${POSTGRES_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH" diff --git a/ci_scripts/install_openssl.sh b/ci_scripts/install_openssl.sh deleted file mode 100644 index 24c0d3a5a..000000000 --- a/ci_scripts/install_openssl.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -if [ ${#} -lt 1 ]; then - echo "OpenSSL version required." 1>&2 - exit 1 -fi - -OPENSSL_VERSION="${1}" -OPENSSL_DIR="$(pwd)/openssl-${OPENSSL_VERSION}" -TMP_DIR="/tmp/openssl" -JOBS="-j$(nproc)" - -if [ -d "${TMP_DIR}" ]; then - rm -rf "${TMP_DIR}" -fi -mkdir -p "${TMP_DIR}" -curl -s https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz | \ - tar -C "${TMP_DIR}" -xzf - -pushd "${TMP_DIR}/openssl-${OPENSSL_VERSION}" -if [ -d "${OPENSSL_DIR}" ]; then - rm -rf "${OPENSSL_DIR}" -fi -./Configure \ - --prefix=${OPENSSL_DIR} \ - enable-crypto-mdebug enable-crypto-mdebug-backtrace \ - linux-x86_64 -make -s $JOBS -make install_sw -popd - -export PATH="${OPENSSL_DIR}/bin:${PATH}" -export CFLAGS="-I${OPENSSL_DIR}/include" -export LDFLAGS="-L${OPENSSL_DIR}/lib" -export LD_LIBRARY_PATH="${OPENSSL_DIR}/lib:$LD_LIBRARY_PATH" -export PKG_CONFIG_PATH="${OPENSSL_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH" diff --git a/script/create-test-tables.js b/script/create-test-tables.js index c887629ec..e2110313a 100644 --- a/script/create-test-tables.js +++ b/script/create-test-tables.js @@ -38,15 +38,35 @@ var con = new pg.Client({ password: args.password, database: args.database }) -con.connect() -var query = con.query('drop table if exists person') -con.query('create table person(id serial, name varchar(10), age integer)', (err, res) => { - console.log('Created table person') - console.log('Filling it with people') -}) -people.map(function (person) { - return con.query(new pg.Query("insert into person(name, age) values('" + person.name + "', '" + person.age + "')")) -}).pop().on('end', function () { - console.log('Inserted 26 people') - con.end() + +con.connect((err) => { + if (err) { + throw err + } + + con.query( + 'DROP TABLE IF EXISTS person;' + + ' CREATE TABLE person (id serial, name varchar(10), age integer)', + (err) => { + if (err) { + throw err + } + + console.log('Created table person') + console.log('Filling it with people') + + con.query( + 'INSERT INTO person (name, age) VALUES' + + people + .map((person) => ` ('${person.name}', ${person.age})`) + .join(','), + (err, result) => { + if (err) { + throw err + } + + console.log(`Inserted ${result.rowCount} people`) + con.end() + }) + }) })