Update CI to allow tests to pass on Node.js >= 10.16.0 (#1912)

* Add CI build environment scripts

* Update Travis configuration

* Don't publish CI scripts to npm

* Add Node.js 12 to CI matrix
This commit is contained in:
darkgl0w 2019-07-16 21:14:41 +02:00 committed by Brian C
parent 2c7be86104
commit d8a0e1e950
5 changed files with 96 additions and 1 deletions

View File

@ -7,3 +7,4 @@ script/
*.swp
test/
.travis.yml
ci_scripts/

View File

@ -1,8 +1,17 @@
language: node_js
sudo: false
sudo: true
dist: trusty
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
@ -17,6 +26,9 @@ matrix:
- node_js: "10"
addons:
postgresql: "9.6"
- node_js: "12"
addons:
postgresql: "9.6"
- node_js: "lts/carbon"
addons:
postgresql: "9.1"

9
ci_scripts/build.sh Normal file
View File

@ -0,0 +1,9 @@
#!/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

View File

@ -0,0 +1,38 @@
#!/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"

View File

@ -0,0 +1,35 @@
#!/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"