.python38:
  image:
    name: python:3.8
    entrypoint: [""]
  tags:
    - docker

services:
  - name: "docker.elastic.co/elasticsearch/elasticsearch:6.8.0"
    alias: elasticsearch-68
    command: [ "bin/elasticsearch", "-Ediscovery.type=single-node" ]

variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

cache:
  paths:
    - .cache/pip

test:
 stage: test
 image:
   name: intelmq-builder
   entrypoint: [""]
 script:
    - "curl -XGET 'elasticsearch-68:9200'"
    - /usr/bin/redis-server &
    - python3 setup.py test
 artifacts:
   reports:
     junit: report.xml
 variables:
   INTELMQ_TEST_ELASTICSEARCH: "True"
 tags:
   - docker

build:
  extends: .python38
  stage: build
  script:
    - python setup.py sdist bdist_wheel
    - pip install dist/*
  artifacts:
    paths:
      - dist/*.whl

stages:
  - test
  - build