# CircleCI config for automated test builds triggered from Github.
version: 2
jobs:
  build:
    docker:
      - image: postgres:latest
    environment:
      - PGHOST: "/tmp"
    steps:
      - checkout
      - run:
          name: Install
          command: apt update && apt install -y python g++ libpq-dev postgresql build-essential make autoconf dh-autoreconf autoconf-archive automake cppcheck
      - run:
          name: Prepare postgres
          command: |
              mkdir /tmp/db &&
              chown postgres /tmp/db &&
              su postgres -c '/usr/lib/postgresql/*/bin/initdb --pgdata /tmp/db --auth trust --nosync'
      - run:
          name: Run postgres
          command: (su postgres -c '/usr/lib/postgresql/*/bin/postgres -D /tmp/db -k /tmp' &) && sleep 5
      - run:
          name: Create postgres user
          command: su postgres -c "createuser -w -d root"
      - run:
          name: Set up database
          command: createdb root
      - run:
          name: Autogen
          command: NOCONFIGURE=1 ./autogen.sh
      - run:
          name: Configure
          command: |
              ./configure \
                  CXXFLAGS='-std=c++17' \
                  --enable-maintainer-mode \
                  --enable-audit \
                  --enable-shared --disable-static
      - run:
          name: Make
          command: make
      - run:
          name: Test
          command: PGDATA=db/data make check

# CircleCI config for automated test builds triggered from Github.
version: 2
jobs:
  build:
    docker:
      - image: postgres:latest
    environment:
      - PGHOST: "/tmp"
    steps:
      - checkout
      - run:
          name: Install
          command: apt update && apt install -y python g++ libpq-dev postgresql build-essential make autoconf dh-autoreconf autoconf-archive automake cppcheck
      - run:
          name: Prepare postgres
          command: |
              mkdir /tmp/db &&
              chown postgres /tmp/db &&
              su postgres -c '/usr/lib/postgresql/*/bin/initdb --pgdata /tmp/db --auth trust --nosync'
      - run:
          name: Run postgres
          command: (su postgres -c '/usr/lib/postgresql/*/bin/postgres -D /tmp/db -k /tmp' &) && sleep 5
      - run:
          name: Create postgres user
          command: su postgres -c "createuser -w -d root"
      - run:
          name: Set up database
          command: createdb root
      - run:
          name: Autogen
          command: NOCONFIGURE=1 ./autogen.sh
      - run:
          name: Configure
          command: |
              ./configure \
                  CXXFLAGS='-std=c++17' \
                  --disable-documentation \
                  --enable-maintainer-mode \
                  --enable-audit \
                  --enable-shared --disable-static
      - run:
          name: Make
          command: make
      - run:
          name: Test
          command: PGDATA=db/data make check

Disable documentation in CircleCI build.
Disable documentation in CircleCI build.

That was a step too far: to build documentation, you need a bunch of
tools installed.
