image: shockrah/freechat:0.3
variables:
  CARGO_HOME: $CI_PROJECT_DIR/.cargo

cache:
  key: "$CI_JOB_NAME"
  untracked: true
  paths:
    - $CARGO_HOME
    - $CI_PROJECT_DIR/server/target


before_script:
  - export PATH="$CARGO_HOME/bin:$PATH"

build-release:
  stage: build
  only:
    - testing

  script:
    - cd server/
    - diesel setup --database-url $DATABASE_URL
    - cargo build --release


api-test:
  stage: test
  needs: ["build-release"]
  only:
    - testing
  script:
    - cd server/
    - cargo test --release

