general:
  artifacts:
    - build

machine:
  xcode:
    version: "8.0"
  # https://discuss.circleci.com/t/is-there-a-way-to-force-building-on-os-x/4079/13
  environment:
    XCODE_SCHEME: phony
    XCODE_WORKSPACE: phony
    BOOT_JVM_OPTIONS: |
      -client
      -XX:+TieredCompilation
      -XX:TieredStopAtLevel=1
      -Xmx2g
      -XX:+UseConcMarkSweepGC
      -XX:+CMSClassUnloadingEnabled
      -Xverify:none

dependencies:
  cache_directories:
    - "tmp"
    - "~/.boot/cache/lib"
    - "~/.boot/cache/bin"
    - "/usr/local/bin/yarn"
    - "/usr/local/bin/yarnpkg"
    - "/usr/local/bin/wget"
    - "/usr/local/bin/boot"
    - "/usr/local/lib/node_modules"
    - "/usr/local/Cellar"
  pre:
    - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash && export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
    - nvm install v9.2.0
    - if [[ ! -e /usr/local/bin/yarn ]]; then brew install yarn; fi
    - if [[ ! -e /usr/local/bin/wget ]]; then brew install wget; fi
    - |
      if [[ ! -e /usr/local/bin/boot ]];
      then
        wget https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh
        mv boot.sh boot && chmod a+x boot && sudo mv boot /usr/local/bin;
      fi
    - if [[ ! -e tmp/node ]]; then boot release-ci; fi
  override:
    - boot > /dev/null
    - yarn install

test:
  override:
    - yarn lint
    - yarn type:check
    - yarn test
    - boot test
    - boot release-ci
    - ./build/lumo -c src/test/cljs:src/test/lumo:src/test/cljs_cp -D org.clojure/test.check:0.10.0-alpha2 scripts/lumo_test.cljs --test-cli-option true
  post:
    - chmod a+x build/lumo
    - zip -j build/lumo.zip build/lumo
