Skip to content

Commit d8a0e1e

Browse files
darkgl0wbrianc
authored andcommitted
Update CI to allow tests to pass on Node.js >= 10.16.0 (brianc#1912)
* Add CI build environment scripts * Update Travis configuration * Don't publish CI scripts to npm * Add Node.js 12 to CI matrix
1 parent 2c7be86 commit d8a0e1e

File tree

5 files changed

+96
-1
lines changed

5 files changed

+96
-1
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ script/
77
*.swp
88
test/
99
.travis.yml
10+
ci_scripts/

.travis.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
language: node_js
2-
sudo: false
2+
sudo: true
33
dist: trusty
4+
45
before_script:
56
- node script/create-test-tables.js pg://[email protected]:5432/postgres
7+
8+
before_install:
9+
- if [ $TRAVIS_OS_NAME == "linux" ]; then
10+
if [[ $(node -v) =~ v[1-9][0-9] ]]; then
11+
source ./ci_scripts/build.sh;
12+
fi
13+
fi
14+
615
env:
716
- CC=clang CXX=clang++ npm_config_clang=1 PGUSER=postgres PGDATABASE=postgres
817

@@ -17,6 +26,9 @@ matrix:
1726
- node_js: "10"
1827
addons:
1928
postgresql: "9.6"
29+
- node_js: "12"
30+
addons:
31+
postgresql: "9.6"
2032
- node_js: "lts/carbon"
2133
addons:
2234
postgresql: "9.1"

ci_scripts/build.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
BUILD_DIR="$(pwd)"
4+
source ./ci_scripts/install_openssl.sh 1.1.1b
5+
sudo updatedb
6+
source ./ci_scripts/install_libpq.sh
7+
sudo updatedb
8+
sudo ldconfig
9+
cd $BUILD_DIR

ci_scripts/install_libpq.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
OPENSSL_DIR="$(pwd)/openssl-1.1.1b"
6+
POSTGRES_VERSION="11.3"
7+
POSTGRES_DIR="$(pwd)/postgres-${POSTGRES_VERSION}"
8+
TMP_DIR="/tmp/postgres"
9+
JOBS="-j$(nproc || echo 1)"
10+
11+
if [ -d "${TMP_DIR}" ]; then
12+
rm -rf "${TMP_DIR}"
13+
fi
14+
15+
mkdir -p "${TMP_DIR}"
16+
17+
curl https://ftp.postgresql.org/pub/source/v${POSTGRES_VERSION}/postgresql-${POSTGRES_VERSION}.tar.gz | \
18+
tar -C "${TMP_DIR}" -xzf -
19+
20+
cd "${TMP_DIR}/postgresql-${POSTGRES_VERSION}"
21+
22+
if [ -d "${POSTGRES_DIR}" ]; then
23+
rm -rf "${POSTGRES_DIR}"
24+
fi
25+
mkdir -p $POSTGRES_DIR
26+
27+
./configure --prefix=$POSTGRES_DIR --with-openssl --with-includes=${OPENSSL_DIR}/include --with-libraries=${OPENSSL_DIR}/lib --without-readline
28+
29+
cd src/interfaces/libpq; make; make install; cd -
30+
cd src/bin/pg_config; make install; cd -
31+
cd src/backend; make generated-headers; cd -
32+
cd src/include; make install; cd -
33+
34+
export PATH="${POSTGRES_DIR}/bin:${PATH}"
35+
export CFLAGS="-I${POSTGRES_DIR}/include"
36+
export LDFLAGS="-L${POSTGRES_DIR}/lib"
37+
export LD_LIBRARY_PATH="${POSTGRES_DIR}/lib:$LD_LIBRARY_PATH"
38+
export PKG_CONFIG_PATH="${POSTGRES_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH"

ci_scripts/install_openssl.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/sh
2+
3+
if [ ${#} -lt 1 ]; then
4+
echo "OpenSSL version required." 1>&2
5+
exit 1
6+
fi
7+
8+
OPENSSL_VERSION="${1}"
9+
OPENSSL_DIR="$(pwd)/openssl-${OPENSSL_VERSION}"
10+
TMP_DIR="/tmp/openssl"
11+
JOBS="-j$(nproc)"
12+
13+
if [ -d "${TMP_DIR}" ]; then
14+
rm -rf "${TMP_DIR}"
15+
fi
16+
mkdir -p "${TMP_DIR}"
17+
curl -s https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz | \
18+
tar -C "${TMP_DIR}" -xzf -
19+
pushd "${TMP_DIR}/openssl-${OPENSSL_VERSION}"
20+
if [ -d "${OPENSSL_DIR}" ]; then
21+
rm -rf "${OPENSSL_DIR}"
22+
fi
23+
./Configure \
24+
--prefix=${OPENSSL_DIR} \
25+
enable-crypto-mdebug enable-crypto-mdebug-backtrace \
26+
linux-x86_64
27+
make -s $JOBS
28+
make install_sw
29+
popd
30+
31+
export PATH="${OPENSSL_DIR}/bin:${PATH}"
32+
export CFLAGS="-I${OPENSSL_DIR}/include"
33+
export LDFLAGS="-L${OPENSSL_DIR}/lib"
34+
export LD_LIBRARY_PATH="${OPENSSL_DIR}/lib:$LD_LIBRARY_PATH"
35+
export PKG_CONFIG_PATH="${OPENSSL_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH"

0 commit comments

Comments
 (0)