version: 2
jobs:
  test_crystal_0_31:
    docker:
      - image: "crystallang/crystal:0.31.0"
    environment:
      DOCS_PATH: "docs"
      GIT_USER: "icyleaf"
      GIT_EMAIL: "icyleaf.cn@gmail.com"
      GIT_REPO: "git@github.com:icyleaf/halite.git"
      GH_REF: "https://github.com/icyleaf/halite"
      GH_URL: "https://icyleaf.github.io/halite"
    working_directory: ~/halite
    steps:
      - checkout
      - run:
          name: "Crystal Version"
          command: crystal version
      - run:
          name: "Specs"
          command: crystal spec
      - deploy:
          name: "API documents"
          command: |
            if [ "${CIRCLE_BRANCH}" == "master" ] && [ ! "${CIRCLE_PR_NUMBER}" ]; then
              echo "Generate API documents"
              ./.circleci/generate_docs.sh
              echo "Upload API documents"
              ./.circleci/upload_docs.sh
            fi
workflows:
  version: 2
  build_test_deploy:
    jobs:
      - test_crystal_0_31:
          filters:
            branches:
              ignore:
                - gh-pages

version: 2
jobs:
  test_crystal_0_32:
    docker:
      - image: "crystallang/crystal:0.32.0"
    environment:
      DOCS_PATH: "docs"
      GIT_USER: "icyleaf"
      GIT_EMAIL: "icyleaf.cn@gmail.com"
      GIT_REPO: "git@github.com:icyleaf/halite.git"
      GH_REF: "https://github.com/icyleaf/halite"
      GH_URL: "https://icyleaf.github.io/halite"
    working_directory: ~/halite
    steps:
      - checkout
      - run:
          name: "Crystal Version"
          command: crystal version
      - run:
          name: "Specs"
          command: crystal spec
      - deploy:
          name: "API documents"
          command: |
            if [ "${CIRCLE_BRANCH}" == "master" ] && [ ! "${CIRCLE_PR_NUMBER}" ]; then
              echo "Generate API documents"
              ./.circleci/generate_docs.sh
              echo "Upload API documents"
              ./.circleci/upload_docs.sh
            fi
workflows:
  version: 2
  build_test_deploy:
    jobs:
      - test_crystal_0_32:
          filters:
            branches:
              ignore:
                - gh-pages

Set Crystal 0.32 as base image
test: Set Crystal 0.32 as base image
