language: python
stages:
  - name: test
  - name: deploy
    if: tag is present
cache: pip
jobs:
  include:
    - stage: test
      python: "2.7"
      script:
        - bash tests/travis_test.sh
      after_script:
        - coverage xml
        - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
      services: rabbitmq
      addons:
        apt:
          packages:
            - rabbitmq-server
    - stage: test
      python: "3.5"
      script:
        - bash tests/travis_test.sh
      after_script:
        - coverage xml
        - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
      services: rabbitmq
      addons:
        apt:
          packages:
            - rabbitmq-server
    - stage: test
      python: "3.6"
      script:
        - bash tests/travis_test.sh
      after_script:
        - coverage xml
        - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
      services: rabbitmq
      addons:
        apt:
          packages:
            - rabbitmq-server
    - stage: test
      python: "3.7"
      script:
        - bash tests/travis_test.sh
      after_script:
        - coverage xml
        - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
      services: rabbitmq
      addons:
        apt:
          packages:
            - rabbitmq-server
    - stage: test
      python: "3.8"
      script:
        - bash tests/travis_test.sh
      after_script:
        - coverage xml
        - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
      services: rabbitmq
      addons:
        apt:
          packages:
            - rabbitmq-server
    - stage: test
      python: "3.9"
      script:
        - bash tests/travis_test.sh
      after_script:
        - coverage xml
        - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
      services: rabbitmq
      addons:
        apt:
          packages:
            - rabbitmq-server
    - stage: test
      python: "nightly"
      script:
        - bash tests/travis_test.sh
      after_script:
        - coverage xml
        - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
      services: rabbitmq
      addons:
        apt:
          packages:
            - rabbitmq-server
    - stage: test
      python: "pypy"
      script:
        - bash tests/travis_test.sh
      after_script:
        - coverage xml
        - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
      services: rabbitmq
      addons:
        apt:
          packages:
            - rabbitmq-server
    - stage: test
      python: "pypy3.5"
      script:
        - bash tests/travis_test.sh
      after_script:
        - coverage xml
        - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
      services: rabbitmq
      addons:
        apt:
          packages:
            - rabbitmq-server
    - stage: deploy
      python: "3.8"
      script:
        - bash tests/travis_build.sh
