config.yml

106 lines | 2.787 kB Blame History Raw Download
defaults: &defaults
  working_directory: ~/repo
  environment:
    MAVEN_OPTS: -Xmx2048m

version: 2
jobs:
  build:
    <<: *defaults
    docker:
      - image: killbill/kbbuild:0.1.0
    steps:
      - checkout
      - restore_cache:
          key: v1-dependencies-{{ checksum "pom.xml" }}
      - run: mvn -DskipTests=true clean install dependency:go-offline
      - save_cache:
          paths:
            - ~/.m2
          key: v1-dependencies-{{ checksum "pom.xml" }}

  test-h2:
    <<: *defaults
    docker:
      - image: killbill/kbbuild:0.1.0
    steps:
      - checkout
      - restore_cache:
          key: v1-dependencies-{{ checksum "pom.xml" }}
      - run: mvn clean install -Ptravis
      - run:
          name: Save test results
          command: |
            mkdir -p ~/junit/
            find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/junit/ \;
          when: always
      - store_test_results:
          path: ~/junit
      - store_artifacts:
          path: ~/junit
  test-mysql:
    <<: *defaults
    docker:
      - image: killbill/kbbuild:0.1.0
      - image: killbill/mariadb:0.18
        environment:
        - MYSQL_ROOT_PASSWORD=root
    steps:
      - checkout
      - restore_cache:
          key: v1-dependencies-{{ checksum "pom.xml" }}
      - run:
          name: Setup latest DDL
          command: ./bin/db-helper -a create --driver mysql -u root -p root -t yes -h 127.0.0.1
      - run: mvn clean install -Plocaltest-mysql
      - run:
          name: Save test results
          command: |
            mkdir -p ~/junit/
            find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/junit/ \;
          when: always
      - store_test_results:
          path: ~/junit
      - store_artifacts:
          path: ~/junit
  test-postgresql:
    <<: *defaults
    docker:
      - image: killbill/kbbuild:0.1.0
      - image: killbill/postgresql:0.18
        environment:
        - POSTGRES_PASSWORD=postgres
    steps:
      - checkout
      - restore_cache:
          key: v1-dependencies-{{ checksum "pom.xml" }}
      - run:
          name: Setup latest DDL
          command: ./bin/db-helper -a create --driver postgres -u postgres -p postgres -t yes
      - run: mvn clean install -Plocaltest-postgresql
      - run:
          name: Save test results
          command: |
            mkdir -p ~/junit/
            find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/junit/ \;
          when: always
      - store_test_results:
          path: ~/junit
      - store_artifacts:
          path: ~/junit

workflows:
  version: 2
  build-and-test:
    jobs:
      - build
      - test-h2:
          requires:
            - build
      - test-mysql:
          requires:
            - build
      - test-postgresql:
          requires:
            - build