diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index dd2104f..0000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,7 +0,0 @@ -engines: - pep8: - enabled: true - -ratings: - paths: - - "**.py" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..99109c8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Publish Python distributions +on: + push: + tags: + - '*' + workflow_dispatch: + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout sendgrid-python-http-client + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.6' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + pip install wheel + python setup.py sdist bdist_wheel + + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + + notify-on-failure: + name: Slack notify on failure + if: ${{ failure() }} + needs: [ deploy ] + runs-on: ubuntu-latest + steps: + - uses: rtCamp/action-slack-notify@v2 + env: + SLACK_COLOR: 'danger' + SLACK_ICON_EMOJI: ':github:' + SLACK_MESSAGE: ${{ format('Failed to release {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }} + SLACK_TITLE: Release Failure + SLACK_USERNAME: GitHub Actions + SLACK_MSG_AUTHOR: twilio-dx + SLACK_FOOTER: Posted automatically using GitHub Actions + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + MSG_MINIMAL: true diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..e4ca29f --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,50 @@ +name: Run Tests +on: + push: + branches: [ '*' ] + pull_request: + branches: [ main ] + schedule: + # Run automatically at 8AM PST Monday-Friday + - cron: '0 15 * * 1-5' + workflow_dispatch: + +jobs: + tests: + name: Run Tests + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + python-version: [ '2.7', '3.5', '3.6', '3.7', '3.8', '3.9' ] + steps: + - name: Checkout sendgrid-http-client + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Build & Test + run: make install test-install test + + notify-on-failure: + name: Slack notify on failure + if: ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} + needs: [ tests ] + runs-on: ubuntu-latest + steps: + - uses: rtCamp/action-slack-notify@v2 + env: + SLACK_COLOR: 'danger' + SLACK_ICON_EMOJI: ':github:' + SLACK_MESSAGE: ${{ format('Failed running build on {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }} + SLACK_TITLE: Build Failure + SLACK_USERNAME: GitHub Actions + SLACK_MSG_AUTHOR: twilio-dx + SLACK_FOOTER: Posted automatically using GitHub Actions + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + MSG_MINIMAL: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f4aef1d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -dist: xenial -language: python -cache: pip -python: -- '2.7' -- '3.4' -- '3.5' -- '3.6' -- '3.7' -- '3.8' -- '3.9' -before_install: -- pip install pycodestyle coverage codecov -- if [[ "$TRAVIS_PYTHON_VERSION" == 2.7* ]]; then pip install mock; fi -install: -- pip install virtualenv --upgrade -- make install -- make test-install -script: -- pycodestyle --exclude=venv -- coverage run -m unittest discover -after_script: -- codecov -- make test -- coverage run tests/test_unit.py -after_success: -- codecov -deploy: - provider: pypi - user: __token__ - password: "$PYPI_TOKEN" - skip_cleanup: true - on: - branch: main - condition: "$TRAVIS_TEST_RESULT = 0" - tags: true - python: '3.6' -notifications: - slack: - if: branch = main - on_pull_requests: false - on_success: never - on_failure: change - rooms: - secure: LQ9fGMn/Hfj//uFbQh8t/3yw2Ymq9WUWpErnWEZf++/cmrNNqvu/qaRTgadqzdHFIzqzO9A/HF88t+IRpih8aHmNBp4Sa1IXjWtNniXs9qZIGSL74kEgMpY+PIF5zO8LBKaAmZ1/h3NmAsJa616EMdpksr/Uk/WTs/98cmBrOxpdKrkqHtbf4WK5oJcakdeaGd9o9WWt8n2QoMAFoYSFV1BUDVyni3HJTTx+eLOXwInqWP+rRYBomVVyyYvJ1IOZWkZlnLY5BvudOpyzAeYI3KKpDw1O4Z0SlIEh2TmtakxgIK5qxnrDJ7B265dH2S5bk3oqjBNb1VA9Hiz/m02GB+pbJtiftYNCcTXN9pnIJHEhfRxpTTf+QMJrVPpHC+t3LUtpAZX8frcZKtDwkVxrG9y0WTEa4qZpWM0qisyHB72Q2rVXnWHWs1TxIsxYJCxzJ0bLB256LxLkvNxPFyNMmcmDFG0n4wVSWhems5+Dh1H191k9BaSMedtRrMu7CVPkessaEo2o/mpIYF4Xe7Y871VqGEPyzA1NG1Vttb18N0ZGUjxoqW4EuQrGxMY1/WWao91pTY0G8O8k5yyp12AkuzwhJXWQcjRsCG15YrarZmOxMsVG04BKGuFkiprV/0SRFg3sU+FUcBDv7Bvqg2JpKyzwhsEr+MleYquHCjg3/ZI= diff --git a/Makefile b/Makefile index 9a9a676..03bba25 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ venv: @python --version || (echo "Python is not installed, please install Python 2 or Python 3"; exit 1); + pip install virtualenv virtualenv --python=python venv install: venv diff --git a/README.rst b/README.rst index 59f6541..f0cd923 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ .. image:: https://github.com/sendgrid/sendgrid-python/raw/HEAD/twilio_sendgrid_logo.png :target: https://www.sendgrid.com -|Build Status| |Twitter Follow| |Codecov branch| |Code Climate| |Python Versions| |PyPI Version| |GitHub contributors| |MIT licensed| +|Test Status| |Twitter Follow| |Codecov branch| |Code Climate| |Python Versions| |PyPI Version| |GitHub contributors| |MIT licensed| **The default branch name for this repository has been changed to `main` as of 07/27/2020.** @@ -157,8 +157,8 @@ License .. _The MIT License (MIT): https://github.com/sendgrid/python-http-client/blob/HEAD/LICENSE .. _this is an incredible opportunity to join our #DX team: https://sendgrid.com/careers/role/1421152/?gh_jid=1421152 -.. |Build Status| image:: https://travis-ci.com/sendgrid/python-http-client.svg?branch=main - :target: https://travis-ci.com/sendgrid/python-http-client +.. |Test Status| image:: https://github.com/sendgrid/python-http-client/actions/workflows/tests.yml/badge.svg + :target: https://github.com/sendgrid/python-http-client/actions/workflows/tests.yaml .. |Twitter Follow| image:: https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow :target: https://twitter.com/sendgrid .. |Codecov branch| image:: https://img.shields.io/codecov/c/github/sendgrid/python-http-client/main.svg?style=flat-square&label=Codecov+Coverage diff --git a/tests/test_repofiles.py b/tests/test_repofiles.py index 1de1990..de55605 100644 --- a/tests/test_repofiles.py +++ b/tests/test_repofiles.py @@ -8,8 +8,6 @@ class RepoFiles(unittest.TestCase): ['./docker-compose.yml', './docker/docker-compose.yml'], ['./.env_sample'], ['./.gitignore'], - ['./.travis.yml'], - ['./.codeclimate.yml'], ['./CHANGELOG.md'], ['./CODE_OF_CONDUCT.md'], ['./CONTRIBUTING.md'],