dist: trusty

language: node_js

node_js:
  - "6"

before_install:
  - wget https://ftp.mozilla.org/pub/firefox/nightly/latest-mozilla-central/jsshell-linux-x86_64.zip
  - unzip jsshell-linux-x86_64.zip -d spidermoney
  - sudo apt-get install -y libjavascriptcoregtk-3.0-bin
  - wget https://aka.ms/chakracore/cc_linux_x64_1_5_2 -O chakra-core.tar.gz
  - tar xvzf chakra-core.tar.gz

before_script:
  - script/bootstrap
  - mkdir -p builds/out-adv
  - bin/cljsc src/test/cljs "{:optimizations :advanced
                              :output-wrapper true
                              :verbose true
                              :compiler-stats true
                              :parallel-build true
                              :output-dir \"builds/out-adv\"
                              :npm-deps {:lodash \"4.17.4\"}
                              :closure-warnings {:non-standard-jsdoc :off :global-this :off}
                              :language-in :es6
                              :language-out :es5
                              :install-deps true
                              :foreign-libs [{:file \"src/test/cljs/calculator_global.js\"
                                              :provides [\"calculator\"]
                                              :global-exports {calculator Calculator}}
                                             {:file \"src/test/cljs/es6_dep.js\"
                                              :module-type :es6
                                              :provides [\"es6_calc\"]}
                                             {:file \"src/test/cljs/calculator_amd.js\"
                                              :module-type :amd
                                              :provides [\"calculator_amd\"]
                                              :requires [\"es6_calc\"]}
                                             {:file \"src/test/cljs/es6_default_hello.js\"
                                              :provides [\"es6_default_hello\"]
                                              :module-type :es6}]}" > builds/out-adv/core-advanced-test.js

script:
  - lein test
  - jsc builds/out-adv/core-advanced-test.js | tee test-out.txt
  - grep '0 failures, 0 errors.' test-out.txt
  - ./spidermoney/js -f builds/out-adv/core-advanced-test.js | tee test-out.txt
  - grep '0 failures, 0 errors.' test-out.txt
  - jjs builds/out-adv/core-advanced-test.js | tee test-out.txt
  - grep '0 failures, 0 errors.' test-out.txt
  - ./ChakraCoreFiles/bin/ch builds/out-adv/core-advanced-test.js | tee test-out.txt
  - grep '0 failures, 0 errors.' test-out.txt
  - script/test-self-host | tee test-out.txt
  - grep '0 failures, 0 errors.' test-out.txt
  - script/test-self-parity | tee test-out.txt
  - grep '0 failures, 0 errors.' test-out.txt
