OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-cogserver / .circleci / config.yml

130 lines · yaml ref:
version: 2.0

jobs:
  cogserver:
    docker:
      - image: $CIRCLE_PROJECT_USERNAME/opencog-deps
        user: root
        environment:
          CCACHE_DIR: /ws/ccache
    working_directory: /ws/cogserver
    steps:
      - attach_workspace:
          at: /ws
      - run:
          name: Start restoring ccache
          command: date +%d-%m-%Y > /tmp/date
      - restore_cache:
          keys:
            - ccache-{{ checksum "/tmp/date" }}
            - ccache-
      - run:
          name: Checkout, Build, Install CogUtil
          command: |
            git clone --depth 1 https://github.com/$CIRCLE_PROJECT_USERNAME/cogutil /ws/cogutil
            mkdir -p /ws/cogutil/build
            cd /ws/cogutil/build && cmake .. && make -j2 && make -j2 install
            ldconfig

      - run:
          name: Checkout, Build, Install AtomSpace
          command: |
            git clone --depth 1 https://github.com/$CIRCLE_PROJECT_USERNAME/atomspace /ws/atomspace
            mkdir -p /ws/atomspace/build
            cd /ws/atomspace/build && cmake .. && make -j2 && make -j2 install
            ldconfig

      # Storage needed for s-expression handling in cogserver.
      - run:
          name: Checkout, Build, Install Storage
          command: |
            git clone --depth 1 https://github.com/$CIRCLE_PROJECT_USERNAME/atomspace-storage /ws/atomspace-storage
            mkdir -p /ws/atomspace-storage/build
            cd /ws/atomspace-storage/build && cmake .. && make -j2 && make -j2 install
            ldconfig

      # The checkout directive only works if there is a deploy key
      # configured in github. Most repos have this, but some do not.
      # Work around this by doing the clone manually. This is all
      # read-only anyway, so I have no clue why the special key was
      # needed.
      #
      # Without the deploy key, one gets the cryptic error message
      # Either git or ssh (required by git to clone through SSH) is Not Installed in the Image
      # apt-get installing openssh-client says 'access denied', which
      # tells us that the deploy key is missing.
      #
      # - checkout
      - run:
          name:  Checkout CogServer
          command: |
            git clone --depth 1 https://github.com/$CIRCLE_PROJECT_USERNAME/cogserver /ws/cogserver

      - run:
          name: CMake Configure CogServer
          command: mkdir build && cd build && cmake ..
      - run:
          name: Build CogServer
          command: cd build && make -j2
      - run:
          name: Build CogServer tests
          command: cd build && make -j2 tests
      - run:
          name: Run CogServer tests
          command: cd build && make -j2 check ARGS=-j2
      - run:
          name: Install CogServer
          command: cd build && make -j2 install && ldconfig
      - run:
          name: Print test log
          command: cat build/tests/Testing/Temporary/LastTest.log
          when: always

      # CogStorage depends on a working Cogserver.
      - run:
          name: Checkout CogStorageNode
          command: git clone --depth 1 https://github.com/$CIRCLE_PROJECT_USERNAME/atomspace-cog /ws/atomspace-cog
      - run:
          name: Build CogStorageNode
          command: |
            mkdir -p /ws/atomspace-cog/build
            cd /ws/atomspace-cog/build && cmake .. && make -j2
            ldconfig
      - run:
          name: Run CogStorageNode tests
          command: cd /ws/atomspace-cog/build && make -j2 check ARGS=-j2
      - run:
          name: Install CogStorageNode
          command: cd /ws/atomspace-cog/build && make -j2 install && ldconfig

      - persist_to_workspace:
          root: /ws/
          paths:
            - cogutil
            - atomspace
            - cogserver
            - atomspace-cog
            - ccache

  package: #Place holder
    docker:
      - image: $CIRCLE_PROJECT_USERNAME/opencog-deps
        user: root
    working_directory: /ws/cogserver
    steps:
      - attach_workspace:
          at: /ws/
      - run:
          name: Start storing ccache
          command: date +%d-%m-%Y > /tmp/date
      - save_cache:
          key: ccache-{{ checksum "/tmp/date" }}
          paths:
            - /ws/ccache

workflows:
  version: 2
  build-test-package:
    jobs:
      - cogserver