Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate to GitHub Actions #107

Merged
merged 3 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .codeclimate.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish Python distributions
on:
push:
tags:
- '*'
workflow_dispatch:

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout sendgrid-python-smtpapi
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
eshanholtz marked this conversation as resolved.
Show resolved Hide resolved
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: [ release ]
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
50 changes: 50 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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-python-smtpapi
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
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -13,6 +14,8 @@ test-install:
test:
. venv/bin/activate; python -m unittest discover -v
. venv/bin/activate; python test/__init__.py
. venv/bin/activate; flake8 --statistics --count
. venv/bin/activate; coverage run test/__init__.py

clean: nopyc
rm -rf venv
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
:target: https://www.sendgrid.com
:alt: SendGrid Logo

|Travis Badge| |Twitter Follow| |Codecov branch| |Python Versions| |PyPI Version| |GitHub contributors| |MIT Licensed|
|Tests Badge| |Twitter Follow| |Codecov branch| |Python Versions| |PyPI Version| |GitHub contributors| |MIT Licensed|

**This module helps build SendGrid's SMTP API headers.**

Expand Down Expand Up @@ -121,8 +121,8 @@ License
.. _Review Pull Requests: https://github.com/sendgrid/smtpapi-python/blob/HEAD/CONTRIBUTING.md#code-reviews)
.. _The MIT License (MIT): https://github.com/sendgrid/smtpapi-python/blob/HEAD/LICENSE

.. |Travis Badge| image:: https://travis-ci.com/sendgrid/smtpapi-python.svg?branch=main
:target: https://travis-ci.com/sendgrid/smtpapi-python
.. |Tests Badge| image:: https://github.com/sendgrid/smtpapi-python/actions/workflows/tests.yml/badge.svg
:target: https://github.com/sendgrid/smtpapi-python/actions/workflows/tests.yml
.. |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/smtpapi-python/main.svg?style=flat-square&label=Codecov+Coverage
Expand Down
2 changes: 0 additions & 2 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,10 @@ def setUp(self):

self.required_files = [
'./Dockerfile',
'./.codeclimate.yml',
'./.env_sample',
'./ISSUE_TEMPLATE.md',
'./PULL_REQUEST_TEMPLATE.md',
'./.gitignore',
'./.travis.yml',
'./CHANGELOG.md',
'./CODE_OF_CONDUCT.md',
'./CONTRIBUTING.md',
Expand Down
8 changes: 0 additions & 8 deletions test/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ def test_env(self):
def test_gitignore(self):
self.assertTrue(os.path.isfile('./.gitignore'))

# ./.travis.yml
def test_travis(self):
self.assertTrue(os.path.isfile('./.travis.yml'))

# ./.codeclimate.yml
def test_codeclimate(self):
self.assertTrue(os.path.isfile('./.codeclimate.yml'))

# ./CHANGELOG.md
def test_changelog(self):
self.assertTrue(os.path.isfile('./CHANGELOG.md'))
Expand Down