machine:
  environment:
    ANDROID_NDK_HOME: $ANDROID_NDK
    SPEC_ROOT: spec/www
    TESTS_PATH: tests/tests.js
    CORDOVA_PARAMEDIC_CMD: cordova-paramedic --platform android --plugin . --timeout 3600000

dependencies:
  pre:
    - npm install -g cordova-paramedic
    - npm install -g cordova

test:

  pre:
    - emulator -avd circleci-android22 -no-audio -no-window:
        background: true
        parallel: true
    - circle-android wait-for-boot

  override:
    - cordova-paramedic --platform android --plugin . || echo error-ignored
    - cp $SPEC_ROOT/spec/self-test.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
    - cp $SPEC_ROOT/spec/db-tx-string-test.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
    - cp $SPEC_ROOT/spec/db-tx-sql-select-value-test.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
    - cp $SPEC_ROOT/spec/basic-db-tx-sql-storage-results.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
    - cp $SPEC_ROOT/spec/db-sql-operations-test.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
    - cp $SPEC_ROOT/spec/sql-batch-test.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
    - cp $SPEC_ROOT/spec/db-tx-sql-features-test.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
    - cp spec/www/spec/regexp-test.js tests/tests.js && cordova-paramedic --platform android --plugin . --timeout 3600000
    - cp $SPEC_ROOT/spec/db-simultaneous-tx-access-test.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
    - cp $SPEC_ROOT/spec/db-tx-multiple-update-test.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
    - cp $SPEC_ROOT/spec/tx-semantics-test.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
    - cp $SPEC_ROOT/spec/db-tx-error-handling-test.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
    - cp $SPEC_ROOT/spec/db-tx-value-bindings-test.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
    - cp $SPEC_ROOT/spec/db-tx-error-mapping-test.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
    - cp $SPEC_ROOT/spec/ext-tx-blob-test.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
    - cp $SPEC_ROOT/spec/db-open-close-delete-test.js $TESTS_PATH && $CORDOVA_PARAMEDIC_CMD
