Skip to content

Commit

Permalink
Test new CircleCI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmp85 committed May 15, 2019
1 parent e9d00e9 commit 72e33c2
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 1 deletion.
107 changes: 107 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,107 @@
version: 2.1

jobs:
build:
docker:
- {image: 'citusdata/extbuilder:debug'}
shell: /bin/bash -euxo pipefail
environment:
IFS: $'\n\t'
steps:
- run:
name: 'Create workspace'
command: |
mkdir -p ./workspace/install "${HOME}/build"
- {checkout: {path: './workspace/src'}}
- run:
name: 'Build'
command: |
pushd ./workspace/src
mkdir ./debian
echo '10
11' > ./debian/pgversions
export CFLAGS='-Werror -ggdb -Og'
makeflags="-j$(nproc)"
pg_buildext -m "${makeflags}" install "${HOME}/build/pgsql-%v" pgsql-%v
popd
mv ./workspace/src/debian/pgsql-* ./workspace/install
rm -rf .workspace/src/.git .workspace/src/debian
- {persist_to_workspace: {root: './workspace', paths: [.]}}
test:
docker:
- {image: 'citusdata/exttester-10:reporting'}
working_directory: /home/circleci/project
shell: /bin/bash -euxo pipefail
environment:
IFS: $'\n\t'
steps:
- {attach_workspace: {at: ./workspace}}
- run:
name: 'Install extension'
command: |
apt-get update
apt-get install -y --no-install-recommends libprotobuf-c1 locales-all bc
cp -R ./workspace/install/pgsql-${PG_MAJOR}/* /
chown -R circleci:circleci /home/circleci
- run:
name: 'Run tests'
shell: /usr/local/bin/gosu circleci /bin/bash -euxo pipefail
command: |
SRC_DIR="$(pwd)/workspace/src"
echo 'shared_preload_libraries=cstore_fdw' > /tmp/postgres-extra.conf
ulimit -c unlimited
REGRESS_OPTS="--temp-instance=${HOME}/tmp_check --launcher=${SRC_DIR}/log_test_times --temp-config=/tmp/postgres-extra.conf"
if [ -z ${PGXS_SCHEDULE+x} ]; then
SUITE_NAME='regress'
else
SUITE_NAME=$(basename "${PGXS_SCHEDULE%.*}")
REGRESS_OPTS="${REGRESS_OPTS} --schedule=${PGXS_SCHEDULE}"
fi
export OUTPUT_DIR="${SRC_DIR}/${SUITE_NAME}-results"
REGRESS_OPTS="${REGRESS_OPTS} --outputdir=${OUTPUT_DIR}"
mkdir -p "${OUTPUT_DIR}"/{sql,expected}
export REGRESS_OPTS
export PG_CONFIG="/usr/lib/postgresql/${PG_MAJOR}/bin/pg_config"
export PG_REGRESS_DIFF_OPTS='-dU3 -w'
pushd "${SRC_DIR}"
exec 3>&1
exec 1>&>(tee "${OUTPUT_DIR}/out.txt">&3)
exec 4>&2
exec 2>&>(tee "${OUTPUT_DIR}/err.txt">&4)
start_time=$(date +%s.%N)
echo "began $(date -d @${start_time} --iso-8601=s)"
status=0
echo "inputdir ${SRC_DIR}"
make installcheck || status=$?
end_time=$(date +%s.%N)
echo "ended $(date -d @${end_time} --iso-8601=s)"
echo "elapsed $(echo "${end_time}-${start_time}" | bc -l)"
exec 1>&3-
exec 2>&4-
exit $status
workflows:
version: 2
build_and_test:
jobs:
- build
- {test: {requires: [build]}}
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -46,7 +46,7 @@ ifeq (,$(findstring $(MAJORVERSION), 9.3 9.4 9.5 9.6 10 11))
endif

cstore.pb-c.c: cstore.proto
protoc-c --c_out=. cstore.proto
protoc-c --c_out=. --proto_path=$(srcdir) $(srcdir)/cstore.proto

installcheck: remove_cstore_files

Expand Down
6 changes: 6 additions & 0 deletions log_test_times
@@ -0,0 +1,6 @@
#!/bin/bash
export TIMEFORMAT="${PGAPPNAME/#pg_regress\//} %6R"

OUTPUT_DIR="${OUTPUT_DIR:-.}"

{ { time "$@" 1>&3- 2>&4-; } 2>> "${OUTPUT_DIR}/timing.txt"; } 3>&1 4>&2

0 comments on commit 72e33c2

Please sign in to comment.