Skip to content

Commit 7b37332

Browse files
authored
Merge pull request #50 from darkgl0w/rework-ci-config
Rework CI config
2 parents 2313d6e + 4ca4cfd commit 7b37332

File tree

4 files changed

+92
-1
lines changed

4 files changed

+92
-1
lines changed

.travis.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
language: node_js
22

3+
dist: xenial
4+
35
node_js:
46
- "10"
57
- "8"
@@ -8,8 +10,15 @@ node_js:
810
services:
911
- postgresql
1012

11-
before_script:
13+
sudo: true
14+
15+
before_install:
1216
- psql -d postgres -c 'CREATE TABLE users(id serial PRIMARY KEY, username VARCHAR (50) NOT NULL);' -U postgres
17+
- if [ $TRAVIS_OS_NAME == "linux" ]; then
18+
if [[ $(node -v) =~ v[1-9][0-9] ]]; then
19+
source ./ci_scripts/build.sh;
20+
fi
21+
fi
1322

1423
notifications:
1524
email:

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)