pacifica/pacifica-notifications

View on GitHub
.travis.yml

Summary

Maintainability
Test Coverage
language: python
python: 3.6
dist: bionic
stages:
  - lint
  - test
  - test-docs
  - test-docker
  - deploy
env:
  BROKER_URL: redis://localhost:6379/0
  PEEWEE_URL: postgres://postgres:@localhost/pacifica_metadata
script:
  - export NOTIFICATIONS_CPCONFIG="$PWD/server.conf"
  - cd tests
  - coverage run --include='*/pacifica/notifications/*' -m pytest -xsv
  - coverage report -m --fail-under 100
before_script:
  - pip install ansible
  - ansible-galaxy install pacifica.ansible_pacifica pacifica.ansible_travis
  - ansible-playbook ~/.ansible/roles/pacifica.ansible_travis/molecule/common/playbook.yml -i ~/.ansible/roles/pacifica.ansible_travis/molecule/common/inventory.yml -e "ansible_python_interpreter=/home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/python travis_virtualenv=python${TRAVIS_PYTHON_VERSION} github_repository=notifications"
  - pushd tests; python cherrypy_catch_test.py & echo $! > cherrypy-catch.pid; popd;
jobs:
  include:
    - stage: lint
      before_script: skip
      script: pre-commit run -a
    - python: 3.7
      before_script: skip
      script: pre-commit run -a
    - python: 3.8
      before_script: skip
      script: pre-commit run -a
    - stage: test
    - python: 3.7
    - python: 3.8
    - stage: test-docs
      python: 3.8
      before_script: skip
      script: >
        cd docs;
        sphinx-build -T -E -b readthedocs -d _build/doctrees-readthedocs -D language=en . _build/html;
        sphinx-build -T -b readthedocssinglehtmllocalmedia -d _build/doctrees-readthedocssinglehtmllocalmedia -D language=en . _build/localmedia;
        sphinx-build -b latex -D language=en -d _build/doctrees . _build/latex;
        sphinx-build -T -b epub -d _build/doctrees-epub -D language=en . _build/epub
    - stage: test-docker
      python: 3.8
      sudo: required
      services:
        - docker
      before_script: skip
      script:
        - |
          docker-compose build --pull;
          docker-compose pull;
          docker-compose up -d;
        - |
          python tests/cherrypy_catch_test.py &
        - |
          MAX_TRIES=60;
          HTTP_CODE=$(docker-compose exec metadataserver curl -sL -w "%{http_code}\\n" localhost:8121/keys -o /dev/null || true);
          while [[ $HTTP_CODE != 200 && $MAX_TRIES > 0 ]] ; do
            sleep 2;
            HTTP_CODE=$(docker-compose exec metadataserver curl -sL -w "%{http_code}\\n" localhost:8121/keys -o /dev/null || true);
            MAX_TRIES=$(( MAX_TRIES - 1 ));
          done;
          docker-compose exec metadataserver curl -sL -w "%{http_code}\\n" localhost:8121/keys
        - |
          docker-compose exec metadataserver /bin/bash -c 'cd /usr/src/app/tests; python test_files/loadit_test.py';
          curl http://127.0.0.1:8181/status/users/search/dmlb2001/simple;
          curl -X POST -H 'Http-Remote-User: dmlb2001' -H 'Content-Type: application/json' http://localhost:8070/eventmatch -d '{ "name": "My Event Match", "jsonpath": "$.data", "target_url": "http://localhost:8080" }';
          docker run -t --rm --network=pacifica-notifications_default pacifica/cli upload --logon 10 tests;
    - stage: deploy
      language: python
      python: 3.8
      before_script: skip
      script: skip
      deploy:
        skip_cleanup: true
        provider: pypi
        user: dmlb2000
        distributions: sdist bdist_wheel
        password:
          secure: unZRE1y5YPkan51bctexTG/KeVVe0deRKzg05sLNFTFzNPPxooOWDStb3AAKfzDl8+cGQmOyWDzQauDXlMUg9g3RPjmSKs5AzxxieP3VAg/gMuw/c5NyGgqcYjW+42ZzLf+xzpbbWddfyaqugvHJCm2MxN3XxC9SpejG3EqpQm2E7DTVq78R6tNrUe/tFybiO92ti6DDF7AZnfNdJkDMUm6mpZuIywyr3RJUv2hixllnUXHNFtbieLKubeSwLd6lXROA39GRUPz1/VrVJ8bFkP9iUufuBcxyAxI12MbFPt8JcVfFnQJaNkHRb+0YAY/Y+nSf21ix9jUNUB9TrbzKj0xAt8iuGt69E+r+idWzg7ruft9zVAOMzR2rJOUOLx6YZY+P430domlZMV2CzZYU265gbseq1sls2DLZwpbDWUo7ANfILEq6phj1h0W17+vlnLzuBufjj9oHWZNLoQnPITsuH0ZBjcmagC3Ck7HvfE8J9DbxWNu+XzNsb9dZRxykzAo65zj5uB/AfQ9h0KGqwYbKvih40RL3d0Xec3D3DjdFkH0n8cAGNhvptAvlfTWIoTD20xqWu0j48hv5882Gi1gVFT8kIqDLOYGbk45bBfj9j9zxdWsHGahQMYJH9ct/4IqE9ftq1PycMOLLAcq14IK7bMJIlyeATVjlmFfv8FM=
        on:
          tags: true
install:
- pip install -r requirements-dev.txt
- pip install .