From 20a8bca426b80be6e9db7c1d57938d81602425aa Mon Sep 17 00:00:00 2001 From: Nils Dijk Date: Wed, 16 Sep 2020 15:21:24 +0200 Subject: [PATCH] add integration files for circle ci This is based on the circle ci integration we have for citus, albeit highly simplified. --- .circleci/build.sh | 16 +++++++ .circleci/config.yml | 101 ++++++++++++++++++++++++++++++++++++++++++ .circleci/run_test.sh | 27 +++++++++++ .gitignore | 5 +++ 4 files changed, 149 insertions(+) create mode 100755 .circleci/build.sh create mode 100644 .circleci/config.yml create mode 100755 .circleci/run_test.sh diff --git a/.circleci/build.sh b/.circleci/build.sh new file mode 100755 index 000000000..6a9f14c74 --- /dev/null +++ b/.circleci/build.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -euxo pipefail +IFS=$'\n\t' + +status=0 + +basedir="$(pwd)" +installdir="${basedir}/install-${PG_MAJOR}" + +make install DESTDIR="${installdir}" +pushd "${installdir}" +find . -type f -print > "${basedir}/files.lst" +cat "${basedir}/files.lst" +tar cvf "${basedir}/install-${PG_MAJOR}.tar" $(cat "${basedir}/files.lst") +popd diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..9f2532c1d --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,101 @@ +version: 2.1 +orbs: + codecov: codecov/codecov@1.1.1 + +jobs: + check-style: + docker: + - image: 'citus/stylechecker:latest' + steps: + - checkout + - run: + name: 'Check Style' + command: | + citus_indent --check + - run: + name: 'Check if whitespace fixing changed anything, install editorconfig if it did' + command: | + git diff --exit-code + + build-11: + docker: + - image: 'citus/extbuilder:11.9' + steps: + - checkout + - run: + name: 'Configure, Build, and Install' + command: | + PG_MAJOR=11 .circleci/build.sh + - persist_to_workspace: + root: . + paths: + - install-11.tar + + build-12: + docker: + - image: 'citus/extbuilder:12.4' + steps: + - checkout + - run: + name: 'Configure, Build, and Install' + command: | + PG_MAJOR=12 .circleci/build.sh + - persist_to_workspace: + root: . + paths: + - install-12.tar + + test-11_checkinstall: + docker: + - image: 'citus/exttester:11.9' + working_directory: /home/circleci/project + steps: + - checkout + - attach_workspace: + at: . + - run: + name: 'Prepare Container & Install Extension' + command: | + chown -R circleci:circleci /home/circleci + tar xfv "${CIRCLE_WORKING_DIRECTORY}/install-${PG_MAJOR}.tar" --directory / + - run: + name: 'Run Test' + command: | + gosu circleci .circleci/run_test.sh installcheck + - codecov/upload: + flags: 'test_11,installcheck' + + test-12_checkinstall: + docker: + - image: 'citus/exttester:12.4' + working_directory: /home/circleci/project + steps: + - checkout + - attach_workspace: + at: . + - run: + name: 'Prepare Container & Install Extension' + command: | + chown -R circleci:circleci /home/circleci + tar xfv "${CIRCLE_WORKING_DIRECTORY}/install-${PG_MAJOR}.tar" --directory / + - run: + name: 'Run Test' + command: | + gosu circleci .circleci/run_test.sh installcheck + - codecov/upload: + flags: 'test_12,installcheck' + +workflows: + version: 2 + build_and_test: + jobs: + + - check-style + + - build-11 + - build-12 + + - test-11_checkinstall: + requires: [build-11] + - test-12_checkinstall: + requires: [build-12] diff --git a/.circleci/run_test.sh b/.circleci/run_test.sh new file mode 100755 index 000000000..f9e183b56 --- /dev/null +++ b/.circleci/run_test.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -euxo pipefail +IFS=$'\n\t' + +status=0 + +export PGPORT=${PGPORT:-55432} + +function cleanup { + pg_ctl -D /tmp/postgres stop + rm -rf /tmp/postgres +} +trap cleanup EXIT + +rm -rf /tmp/postgres +initdb -E unicode /tmp/postgres +echo "shared_preload_libraries = 'cstore_fdw'" >> /tmp/postgres/postgresql.conf +pg_ctl -D /tmp/postgres -o "-p ${PGPORT}" -l /tmp/postgres_logfile start || status=$? +if [ -z $status ]; then cat /tmp/postgres_logfile; fi + +make "${@}" || status=$? +diffs="regression.diffs" + +if test -f "${diffs}"; then cat "${diffs}"; fi + +exit $status diff --git a/.gitignore b/.gitignore index 21c5e32ea..0c643e590 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,8 @@ .vscode *.pb-c.* + +# ignore files that could be created by circleci automation +files.lst +install-*.tar +install-*/