
language: rust

addons:
  firefox: latest
  chrome: stable
  firefox-geckodriver: latest

rust:
    # Use nightly for now since wasm-bindgen is still only compiling in nightly
    - stable
    - beta
    - nightly


intstall:
    # Install chromedriver.
    - curl --retry 5 -LO https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip
    - unzip chromedriver_linux64.zip
    # Install geckodriver
    - curl --retry 5 -LO https://github.com/mozilla/geckodriver/releases/download/v0.27.0/geckodriver-v0.27.0-linux64.tar.gz
    - tar xf geckodriver-v0.27.0-linux64.tar.gz
    - cargo install wasm-pack

script:
    - GECKODRIVER=$(pwd)/geckodriver ./test.sh
    - CHROMEDRIVER=$(pwd)/chromedriver ./test.sh

after_success: |
    wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz &&
    tar xzf master.tar.gz &&
    cd kcov-master &&
    mkdir build &&
    cd build &&
    cmake .. &&
    make &&
    make install DESTDIR=../../kcov-build &&
    cd ../.. &&
    rm -rf kcov-master &&
    for file in target/debug/sauron-*; do [ -x "${file}" ] || continue; mkdir -p "target/cov/$(basename $file)"; ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file"; done &&
    bash <(curl -s https://codecov.io/bash) &&
    echo "Uploaded code coverage"
