stages:
  - test
  - build

stress_test:
  stage: test
  services:
    - name: rabbitmq:3-management
      alias: rabbitmq
  before_script:
    - python setup.py install
  script:
    - coverage run -m stress_tests
    - COOLAMQP_FORCE_SELECT_LISTENER=1 coverage run --append -m stress_tests
    - coverage xml
    - coverage report
  coverage: /TOTAL.*\s+(\d+\%)/

pages:
  image: zoo.smok.co/build/build:latest
  stage: build
  script:
    - cd docs
    - make html
    - cd ..
    - mv docs/_build/html public
  artifacts:
    paths:
      - public


build_python:
  stage: build
  before_script:
    - pip install --break-system-packages --upgrade setuptools pip twine
  script:
    - python setup.py bdist_wheel
    - mv dist/*.whl .
  artifacts:
    paths:
      - "*.whl"
  after_script:
    - TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python3 -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi *.whl
  only:
    - tags
  except:
    - branches

