config.yml

103 lines | 2.961 kB Blame History Raw Download
defaults: &defaults
  docker:
      - image: killbill/kbbuild:latest
  working_directory: ~/repo
  environment:
    MAVEN_OPTS: -Xmx2048m

version: 2
jobs:
  build:
    <<: *defaults
    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
    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
    steps:
      - checkout
      - restore_cache:
          key: v1-dependencies-{{ checksum "pom.xml" }}
      - run:
          name: Setup MySQL
          command: |
            sudo /etc/init.d/mysql start
            echo 'create database killbill' | mysql -h localhost -uroot -proot
            curl -s http://docs.killbill.io/0.18/ddl.sql | mysql -h localhost -uroot -proot -D killbill
      - 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
    steps:
      - checkout
      - restore_cache:
          key: v1-dependencies-{{ checksum "pom.xml" }}
      - run:
          name: Setup PostgreSQL
          command: |
            sudo /etc/init.d/postgresql start
            sudo -i -u postgres
            echo 'create database killbill' | psql
            curl https://raw.githubusercontent.com/killbill/killbill/killbill-0.18.0/util/src/main/resources/org/killbill/billing/util/ddl-postgresql.sql | psql -d killbill
            curl -s http://docs.killbill.io/0.18/ddl.sql | psql -d killbill
            echo "alter user postgres with password 'postgres'" | psql
      - 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