[postgis-tickets] r16848 - Add Travis build matrix using prebuilt Docker images
Daniel Baston
dbaston at gmail.com
Fri Sep 28 07:13:34 PDT 2018
Author: dbaston
Date: 2018-09-28 07:13:34 -0700 (Fri, 28 Sep 2018)
New Revision: 16848
Added:
trunk/.github/codecov_env.bash
trunk/ci/travis/
trunk/ci/travis/run_tests.sh
Modified:
trunk/.travis.yml
trunk/liblwgeom/lwspheroid.c
Log:
Add Travis build matrix using prebuilt Docker images
Added: trunk/.github/codecov_env.bash
===================================================================
--- trunk/.github/codecov_env.bash (rev 0)
+++ trunk/.github/codecov_env.bash 2018-09-28 14:13:34 UTC (rev 16848)
@@ -0,0 +1,223 @@
+#!/usr/bin/env bash
+
+# Apache License Version 2.0, January 2004
+# https://github.com/codecov/codecov-bash/blob/master/LICENSE
+
+set -e +o pipefail
+
+VERSION="0b37652"
+
+add(){
+ if [ ! -z "$1" ];
+ then
+ echo -n "-e $1 "
+ fi
+}
+
+add "CODECOV_ENV"
+add "CODECOV_TOKEN"
+add "CODECOV_URL"
+add "CODECOV_SLUG"
+add "VCS_COMMIT_ID"
+add "VCS_BRANCH_NAME"
+add "VCS_PULL_REQUEST"
+add "VCS_SLUG"
+add "VCS_TAG"
+add "CI_BUILD_URL"
+add "CI_BUILD_ID"
+add "CI_JOB_ID"
+
+if [ "$JENKINS_URL" != "" ];
+then
+ add "JENKINS_URL"
+ add "ghprbSourceBranch"
+ add "GIT_BRANCH"
+ add "ghprbActualCommit"
+ add "GIT_COMMIT"
+ add "CHANGE_ID"
+ add "BRANCH_NAME"
+ add "BUILD_NUMBER"
+ add "ghprbPullId"
+ add "BUILD_URL"
+
+elif [ "$CI" = "true" ] && [ "$TRAVIS" = "true" ] && [ "$SHIPPABLE" != "true" ];
+then
+ add "CI"
+ add "TRAVIS"
+ add "SHIPPABLE"
+ add "TRAVIS_BRANCH"
+ add "TRAVIS_COMMIT"
+ add "TRAVIS_JOB_NUMBER"
+ add "TRAVIS_PULL_REQUEST"
+ add "TRAVIS_JOB_ID"
+ add "TRAVIS_REPO_SLUG"
+ add "TRAVIS_TAG"
+ add "TRAVIS_OS_NAME"
+
+elif [ "$CI" = "true" ] && [ "$CI_NAME" = "codeship" ];
+then
+ add "CI"
+ add "CI_NAME"
+ add "CI_BRANCH"
+ add "CI_BUILD_NUMBER"
+ add "CI_BUILD_URL"
+ add "CI_COMMIT_ID"
+
+elif [ "$TEAMCITY_VERSION" != "" ];
+then
+ add "TEAMCITY_VERSION"
+ add "TEAMCITY_BUILD_BRANCH"
+ add "TEAMCITY_BUILD_ID"
+ add "TEAMCITY_BUILD_URL"
+ add "TEAMCITY_BUILD_COMMIT"
+ add "TEAMCITY_BUILD_COMMIT"
+ add "BUILD_VCS_NUMBER"
+ add "TEAMCITY_BUILD_REPOSITORY"
+
+elif [ "$CI" = "true" ] && [ "$CIRCLECI" = "true" ];
+then
+ add "CI"
+ add "CIRCLECI"
+ add "CIRCLE_BRANCH"
+ add "CIRCLE_BUILD_NUM"
+ add "CIRCLE_NODE_INDEX"
+ add "CIRCLE_PROJECT_USERNAME"
+ add "CIRCLE_PROJECT_REPONAME"
+ add "CIRCLE_REPOSITORY_URL"
+ add "CIRCLE_PR_NUMBER"
+ add "CIRCLE_SHA1"
+ add "CIRCLE_ARTIFACTS"
+ add "CIRCLE_TEST_REPORTS"
+
+elif [ "$BUDDYBUILD_BRANCH" != "" ];
+then
+ add "BUDDYBUILD_BRANCH"
+ add "BUDDYBUILD_BUILD_NUMBER"
+ add "BUDDYBUILD_BUILD_ID"
+ add "BUDDYBUILD_APP_ID"
+
+elif [ "${bamboo_planRepository_revision}" != "" ];
+then
+ add "bamboo_planRepository_revision"
+ add "bamboo_planRepository_branch"
+ add "bamboo_buildNumber"
+ add "bamboo_buildResultsUrl"
+ add "bamboo_planRepository_repositoryUrl"
+
+elif [ "$CI" = "true" ] && [ "$BITRISE_IO" = "true" ];
+then
+ add "CI"
+ add "BITRISE_IO"
+ add "BITRISE_GIT_BRANCH"
+ add "BITRISE_BUILD_NUMBER"
+ add "BITRISE_BUILD_URL"
+ add "BITRISE_PULL_REQUEST"
+ add "BITRISE_GIT_COMMIT"
+
+elif [ "$CI" = "true" ] && [ "$SEMAPHORE" = "true" ];
+then
+ add "CI"
+ add "SEMAPHORE"
+ add "BRANCH_NAME"
+ add "SEMAPHORE_BUILD_NUMBER"
+ add "SEMAPHORE_CURRENT_THREAD"
+ add "PULL_REQUEST_NUMBER"
+ add "SEMAPHORE_REPO_SLUG"
+ add "REVISION"
+ add "SEMAPHORE_TRIGGER_SOURCE"
+
+elif [ "$CI" = "true" ] && [ "$BUILDKITE" = "true" ];
+then
+ add "CI"
+ add "BUILDKITE"
+ add "BUILDKITE_BRANCH"
+ add "BUILDKITE_BUILD_NUMBER"
+ add "BUILDKITE_JOB_ID"
+ add "BUILDKITE_BUILD_URL"
+ add "BUILDKITE_PROJECT_SLUG"
+ add "BUILDKITE_COMMIT"
+
+elif [ "$CI" = "drone" ];
+then
+ add "CI"
+ add "DRONE_BRANCH"
+ add "DRONE_BUILD_NUMBER"
+ add "DRONE_BUILD_LINK"
+ add "DRONE_PULL_REQUEST"
+ add "DRONE_JOB_NUMBER"
+ add "DRONE_TAG"
+ add "CI_BUILD_URL"
+
+elif [ "$HEROKU_TEST_RUN_BRANCH" != "" ];
+then
+ add "HEROKU_TEST_RUN_BRANCH"
+ add "HEROKU_TEST_RUN_ID"
+
+elif [ "$CI" = "True" ] && [ "$APPVEYOR" = "True" ];
+then
+ add "CI"
+ add "APPVEYOR"
+ add "APPVEYOR_REPO_BRANCH"
+ add "APPVEYOR_JOB_ID"
+ add "APPVEYOR_PULL_REQUEST_NUMBER"
+ add "APPVEYOR_ACCOUNT_NAME"
+ add "APPVEYOR_PROJECT_SLUG"
+ add "APPVEYOR_BUILD_VERSION"
+ add "APPVEYOR_REPO_NAME"
+ add "APPVEYOR_REPO_COMMIT"
+
+elif [ "$CI" = "true" ] && [ "$WERCKER_GIT_BRANCH" != "" ];
+then
+ add "CI"
+ add "WERCKER_GIT_BRANCH"
+ add "WERCKER_MAIN_PIPELINE_STARTED"
+ add "WERCKER_GIT_OWNER"
+ add "WERCKER_GIT_REPOSITORY"
+ add "WERCKER_GIT_COMMIT"
+
+elif [ "$CI" = "true" ] && [ "$MAGNUM" = "true" ];
+then
+ add "CI"
+ add "MAGNUM"
+ add "CI_BRANCH"
+ add "CI_BUILD_NUMBER"
+ add "CI_COMMIT"
+
+elif [ "$SHIPPABLE" = "true" ];
+then
+ add "SHIPPABLE"
+ add "HEAD_BRANCH"
+ add "BRANCH"
+ add "BUILD_NUMBER"
+ add "BUILD_URL"
+ add "PULL_REQUEST"
+ add "REPO_FULL_NAME"
+ add "COMMIT"
+
+elif [ "$TDDIUM" != "" ];
+then
+ add "TDDIUM"
+ add "TDDIUM_CURRENT_COMMIT"
+ add "TDDIUM_CURRENT_BRANCH"
+ add "TDDIUM_TID"
+ add "TDDIUM_PR_ID"
+
+elif [ "$GREENHOUSE" = "true" ];
+then
+ add "GREENHOUSE"
+ add "GREENHOUSE_BRANCH"
+ add "GREENHOUSE_BUILD_NUMBER"
+ add "GREENHOUSE_BUILD_URL"
+ add "GREENHOUSE_PULL_REQUES"
+ add "GREENHOUSE_COMMIT"
+ add "GREENHOUSE_EXPORT_DIR"
+
+elif [ "$GITLAB_CI" != "" ];
+then
+ add "GITLAB_CI"
+ add "CI_BUILD_REF_NAME"
+ add "CI_BUILD_ID"
+ add "CI_BUILD_REPO"
+ add "CI_BUILD_REF"
+
+fi
Modified: trunk/.travis.yml
===================================================================
--- trunk/.travis.yml 2018-09-27 21:50:36 UTC (rev 16847)
+++ trunk/.travis.yml 2018-09-28 14:13:34 UTC (rev 16848)
@@ -1,78 +1,32 @@
-env:
- matrix:
- - CFLAGS="-g -O1" MATRIX_EVAL="touch check-no-trailing-blanks"
- - CFLAGS="-g -O2 -fstack-protector -Wformat -Werror=format-security" LDFLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro"
- - CFLAGS="-g -O3 -mtune=generic -fno-omit-frame-pointer -Werror -Wall -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-unknown-warning-option -Wno-cast-function-type"
- - CFLAGS="-g -O0 --coverage -fprofile-arcs -ftest-coverage" LDFLAGS="--coverage -fprofile-arcs -ftest-coverage" CONFIGURE_FLAGS="--enable-debug"
+services:
+ - docker
-addons:
- apt:
- sources:
- - sourceline: 'deb http://apt.postgresql.org/pub/repos/apt bionic-pgdg 11'
- key_url: 'https://www.postgresql.org/media/keys/ACCC4CF8.asc'
- packages:
- - eatmydata
+sudo: false
+language: c
-before_install:
- - eval "${MATRIX_EVAL}"
- - sudo sh -c "echo /usr/lib/x86_64-linux-gnu/libeatmydata.so >> /etc/ld.so.preload"
- - sudo service postgresql stop
+env:
+ - tag=latest
+ - tag=pg11-geos37-gdal23-proj52
+ - tag=pg10-geos36-gdal23-proj49
+ - tag=pg96-geos36-gdal22-proj49
+ - tag=pg95-geos36-gdal22-proj49
+ - tag=pg94-geos35-gdal111-proj48
- - curl -sSfL https://github.com/mapbox/logbt/archive/v2.0.3.tar.gz | sudo tar --gunzip --extract --strip-components=1 --exclude="*md" --exclude="test*" --directory=/usr/local
- - curl -sSfL https://raw.githubusercontent.com/mapbox/logbt/30c554dd37b6c96c23fc424f75910fc6d6696f00/bin/logbt | sudo tee /usr/local/bin/logbt > /dev/null
- - sudo logbt --setup
+matrix:
+ allow_failures:
+ - env: tag=latest
- - sudo apt-get remove postgresql-9.4 postgresql-9.5 postgresql-9.6 postgresql-10 postgresql-client-9.4 postgresql-client-9.5 postgresql-client-9.6 postgresql-client-10
- - sudo add-apt-repository --yes ppa:ubuntugis/ppa
- - sudo add-apt-repository --yes ppa:ubuntugis/ubuntugis-unstable
- - sudo sh -c "echo deb http://archive.ubuntu.com/ubuntu/ cosmic main restricted universe multiverse >> /etc/apt/sources.list"
- - sudo apt-get update -qq
- - mkdir -p /home/travis/deb && touch /home/travis/deb/__ && sudo cp -n /home/travis/deb/* /var/cache/apt/archives || true
- - sudo apt-get install -y --allow-unauthenticated --no-install-recommends --no-install-suggests postgresql-11 postgresql-client-11 postgresql-server-dev-11 postgresql-11-dbgsym libproj-dev libprotobuf-c-dev protobuf-c-compiler libc++abi-dev libc++-dev libgcc1-dbg libsfcgal1 libsfcgal-dev libxml2-utils libcunit1-dev xsltproc docbook-xsl docbook-mathml dblatex libgeos-dev libjson-c-dev libgdal-dev gdb libc6-dbg gcc
+script:
+ - echo "FROM postgis/postgis-build-env:${tag}" > Dockerfile
+ - echo "ADD --chown=postgres:postgres . /src/postgis" >> Dockerfile
+ - echo "CMD ci/travis/run_tests.sh && bash .github/codecov.bash" >> Dockerfile
+ - docker build -t pgtest .
+ - ci_env=`bash .github/codecov_env.bash`
+ - docker run $ci_env --name pgtest-${TRAVIS_BUILD_NUMBER} pgtest
- - cp -n /var/cache/apt/archives/* /home/travis/deb || true
-
- - echo "postgres soft core unlimited" | sudo tee -a /etc/security/limits.conf
- - echo "postgres hard core unlimited" | sudo tee -a /etc/security/limits.conf
- - echo "pg_ctl_options = '-c'" | sudo tee /etc/postgresql/11/main/pg_ctl.conf
- - sudo service postgresql stop
- - sudo chown -hRL --from=postgres travis:travis /etc /var /tmp
- - sudo usermod -u 1000 postgres
- - sudo adduser travis ssl-cert
- - sudo service postgresql start
- - sudo service postgresql status
- - sudo -u postgres createuser --superuser travis
-
- - sudo ldconfig
-
-after_failure:
- - sudo head -n1000 /var/log/postgresql/postgresql-11-main.log
-
after_success:
- - bash .github/codecov.bash
+ - docker rm pgtest-${TRAVIS_BUILD_NUMBER}
-language: c
-
-compiler: gcc
-
-dist: xenial
-
-cache:
- ccache: true
- directories:
- - /home/travis/deb
-
-script:
- - ./autogen.sh
- - ./configure CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" $CONFIGURE_FLAGS || cat config.log
- - make -j
- - chmod 755 /home/travis
- - logbt -- make check "RUNTESTFLAGS=--verbose"
- - logbt -- make check "RUNTESTFLAGS='--dumprestore --verbose'"
- - sudo make install
- - logbt -- make installcheck "RUNTESTFLAGS=--verbose"
- - logbt -- make installcheck "RUNTESTFLAGS=--dumprestore --verbose"
-
notifications:
email: false
irc:
Added: trunk/ci/travis/run_tests.sh
===================================================================
--- trunk/ci/travis/run_tests.sh (rev 0)
+++ trunk/ci/travis/run_tests.sh 2018-09-28 14:13:34 UTC (rev 16848)
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+set -e
+
+WARNINGS="-Werror -Wall -Wextra -Wformat -Werror=format-security"
+WARNINGS_DISABLED="-Wno-unused-parameter -Wno-implicit-fallthrough -Wno-unknown-warning-option -Wno-cast-function-type"
+
+CFLAGS_STD="-g -O2 -mtune=generic -fno-omit-frame-pointer ${WARNINGS} ${WARNINGS_DISABLED}"
+LDFLAGS_STD="-Wl,-Bsymbolic-functions -Wl,-z,relro"
+
+CFLAGS_COV="-g -O0 --coverage"
+LDFLAGS_COV="--coverage"
+
+/usr/local/pgsql/bin/pg_ctl -l /tmp/logfile start
+./autogen.sh
+
+CFLAGS="${CFLAGS_STD}" LDFLAGS="${LDFLAGS_COV}" ./configure
+make -j2
+make check
+
+CFLAGS="${CFLAGS_COV}" LDFLAGS="${LDFLAGS_COV}" ./configure
+make -j2
+make check
Modified: trunk/liblwgeom/lwspheroid.c
===================================================================
--- trunk/liblwgeom/lwspheroid.c 2018-09-27 21:50:36 UTC (rev 16847)
+++ trunk/liblwgeom/lwspheroid.c 2018-09-28 14:13:34 UTC (rev 16848)
@@ -495,7 +495,7 @@
{
GEOGRAPHIC_POINT a, b;
POINT2D p;
- int i;
+ uint32_t i;
double area = 0.0;
GBOX gbox2d;
int in_south = LW_FALSE;
More information about the postgis-tickets
mailing list