language: rust
rust:
  - nightly

env:
  global:
  - SCHANI_TEST=schani

matrix:
  include:
  - rust: nightly
    env: SCHANI_TEST=schani_import
  - rust: nightly
    env: SCHANI_TEST=schani_processor
  - rust: nightly
    env: SCHANI_TEST=schani_store
  fast_finish: true

branches:
  only:
  - master

services:
  - mysql

cache: cargo

before_script:
  - cd $SCHANI_TEST

  # Prepare DB
  - mysql -u root -e "create database schani_import;"
  - mysql -u root -e "CREATE USER 'schani'@'localhost' IDENTIFIED BY '123456';"
  - mysql -u root -e "GRANT ALL ON schani_import.* TO 'schani'@'localhost';"

script:
  - echo Testing $SCHANI_TEST

  # Copy testing env file if one exists
  - if [[ -f .env.testing ]]; then cp .env.testing .env; fi

  # Migrate
  - if [[ "$SCHANI_TEST" = "schani_import" ]]; then diesel migration run; fi
  - if [[ "$SCHANI_TEST" = "schani_import" ]]; then diesel migration run; fi
  - if [[ "$SCHANI_TEST" = "schani_import" ]]; then diesel migration redo; fi

  # Build
  - cargo build --verbose

  # Test
  - cargo test --verbose
language: rust
rust:
  - stable
  - beta
  - nightly

env:
  global:
  - SCHANI_TEST=schani

matrix:
  include:
  - rust: nightly
    env: SCHANI_TEST=schani_import
  - rust: nightly
    env: SCHANI_TEST=schani_processor
  - rust: nightly
    env: SCHANI_TEST=schani_store
  fast_finish: true

branches:
  only:
  - master

services:
  - mysql

cache: cargo

before_script:
  - cd $SCHANI_TEST

  # Prepare DB
  - mysql -u root -e "create database schani_import;"
  - mysql -u root -e "CREATE USER 'schani'@'localhost' IDENTIFIED BY '123456';"
  - mysql -u root -e "GRANT ALL ON schani_import.* TO 'schani'@'localhost';"

script:
  - echo Testing $SCHANI_TEST

  # Copy testing env file if one exists
  - if [[ -f .env.testing ]]; then cp .env.testing .env; fi

  # Migrate
  - if [[ "$SCHANI_TEST" = "schani_import" ]]; then diesel migration run; fi
  - if [[ "$SCHANI_TEST" = "schani_import" ]]; then diesel migration run; fi
  - if [[ "$SCHANI_TEST" = "schani_import" ]]; then diesel migration redo; fi

  # Build
  - cargo build --verbose

  # Test
  - cargo test --verbose
Build against stable, beta where possible
Build against stable, beta where possible

Signed-off-by: Christoph Wurst <7abde52c298496fa169fb750f91f213a282142af@winzerhof-wurst.at>
