image: hatsoftwares/test-ci:latest
stages:
  - sqlite
  - postgresql
before_script:
  - carton install
  - rm -f *db
sqlite1:
  stage: sqlite
  cache:
    key: "$CI_BUILD_REF_NAME"
    untracked: true
    paths:
      - local
  script:
    - make podcheck
    - MOJO_CONFIG=t/sqlite1.conf make test-sqlite
    - MOJO_CONFIG=t/sqlite1.conf make watch
    - MOJO_CONFIG=t/sqlite1.conf make cleanbdd
    - MOJO_CONFIG=t/sqlite1.conf make cleanfiles
    - MOJO_CONFIG=t/sqlite1.conf make stats
sqlite2:
  stage: sqlite
  cache:
    key: "$CI_BUILD_REF_NAME"
    untracked: true
    paths:
      - local
  script:
    - make podcheck
    - MOJO_CONFIG=t/sqlite2.conf make minion &
    - sleep 3
    - MOJO_CONFIG=t/sqlite2.conf make test-sqlite
    - MOJO_CONFIG=t/sqlite2.conf make watch
    - MOJO_CONFIG=t/sqlite2.conf make cleanbdd
    - MOJO_CONFIG=t/sqlite2.conf make cleanfiles
    - MOJO_CONFIG=t/sqlite2.conf make stats
sqlite3:
  stage: sqlite
  cache:
    key: "$CI_BUILD_REF_NAME"
    untracked: true
    paths:
      - local
  script:
    - make podcheck
    - service postgresql restart
    - sleep 10
    - service postgresql status
    - make create-pg-test-db
    - MOJO_CONFIG=t/sqlite3.conf make minion &
    - sleep 3
    - MOJO_CONFIG=t/sqlite3.conf make test-sqlite
    - MOJO_CONFIG=t/sqlite3.conf make watch
    - MOJO_CONFIG=t/sqlite3.conf make cleanbdd
    - MOJO_CONFIG=t/sqlite3.conf make cleanfiles
    - MOJO_CONFIG=t/sqlite3.conf make stats
  tags:
    - Debian
    - Jessie
postgresql1:
  stage: postgresql
  cache:
    key: "$CI_BUILD_REF_NAME"
    untracked: true
    paths:
      - local
  script:
    - make podcheck
    - service postgresql restart
    - sleep 10
    - service postgresql status
    - make create-pg-test-db
    - MOJO_CONFIG=t/postgresql1.conf make test-pg
    - MOJO_CONFIG=t/postgresql1.conf make watch
    - MOJO_CONFIG=t/postgresql1.conf make cleanbdd
    - MOJO_CONFIG=t/postgresql1.conf make cleanfiles
    - MOJO_CONFIG=t/postgresql1.conf make stats
postgresql2:
  stage: postgresql
  cache:
    key: "$CI_BUILD_REF_NAME"
    untracked: true
    paths:
      - local
  script:
    - make podcheck
    - service postgresql restart
    - sleep 10
    - service postgresql status
    - make create-pg-test-db
    - MOJO_CONFIG=t/postgresql2.conf make minion &
    - sleep 3
    - MOJO_CONFIG=t/postgresql2.conf make test-pg
    - MOJO_CONFIG=t/postgresql2.conf make watch
    - MOJO_CONFIG=t/postgresql2.conf make cleanbdd
    - MOJO_CONFIG=t/postgresql2.conf make cleanfiles
    - MOJO_CONFIG=t/postgresql2.conf make stats
postgresql3:
  stage: postgresql
  cache:
    key: "$CI_BUILD_REF_NAME"
    untracked: true
    paths:
      - local
  script:
    - make podcheck
    - service postgresql restart
    - sleep 10
    - service postgresql status
    - make create-pg-test-db
    - MOJO_CONFIG=t/postgresql3.conf make minion &
    - sleep 3
    - MOJO_CONFIG=t/postgresql3.conf make test-pg
    - MOJO_CONFIG=t/postgresql3.conf make watch
    - MOJO_CONFIG=t/postgresql3.conf make cleanbdd
    - MOJO_CONFIG=t/postgresql3.conf make cleanfiles
    - MOJO_CONFIG=t/postgresql3.conf make stats
  tags:
    - Debian
    - Jessie
