Skip to content

Commit cad19b9

Browse files
authored
chore: migrate to GitHub Actions (#107)
1 parent 4339c9a commit cad19b9

File tree

8 files changed

+106
-80
lines changed

8 files changed

+106
-80
lines changed

.codeclimate.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish Python distributions
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
workflow_dispatch:
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout sendgrid-python-smtpapi
14+
uses: actions/checkout@v2
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: '3.6'
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install build
25+
pip install wheel
26+
python setup.py sdist bdist_wheel
27+
28+
- name: Publish package to PyPI
29+
uses: pypa/gh-action-pypi-publish@release/v1
30+
with:
31+
user: __token__
32+
password: ${{ secrets.PYPI_TOKEN }}
33+
34+
notify-on-failure:
35+
name: Slack notify on failure
36+
if: ${{ failure() }}
37+
needs: [ release ]
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: rtCamp/action-slack-notify@v2
41+
env:
42+
SLACK_COLOR: 'danger'
43+
SLACK_ICON_EMOJI: ':github:'
44+
SLACK_MESSAGE: ${{ format('Failed to release {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }}
45+
SLACK_TITLE: Release Failure
46+
SLACK_USERNAME: GitHub Actions
47+
SLACK_MSG_AUTHOR: twilio-dx
48+
SLACK_FOOTER: Posted automatically using GitHub Actions
49+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
50+
MSG_MINIMAL: true

.github/workflows/tests.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Run Tests
2+
on:
3+
push:
4+
branches: [ '*' ]
5+
pull_request:
6+
branches: [ main ]
7+
schedule:
8+
# Run automatically at 8AM PST Monday-Friday
9+
- cron: '0 15 * * 1-5'
10+
workflow_dispatch:
11+
12+
jobs:
13+
tests:
14+
name: Run Tests
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 20
17+
strategy:
18+
matrix:
19+
python-version: [ '2.7', '3.5', '3.6', '3.7', '3.8', '3.9' ]
20+
steps:
21+
- name: Checkout sendgrid-python-smtpapi
22+
uses: actions/checkout@v2
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
- name: Build & Test
32+
run: make install test-install test
33+
34+
notify-on-failure:
35+
name: Slack notify on failure
36+
if: ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
37+
needs: [ tests ]
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: rtCamp/action-slack-notify@v2
41+
env:
42+
SLACK_COLOR: 'danger'
43+
SLACK_ICON_EMOJI: ':github:'
44+
SLACK_MESSAGE: ${{ format('Failed running build on {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }}
45+
SLACK_TITLE: Build Failure
46+
SLACK_USERNAME: GitHub Actions
47+
SLACK_MSG_AUTHOR: twilio-dx
48+
SLACK_FOOTER: Posted automatically using GitHub Actions
49+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
50+
MSG_MINIMAL: true

.travis.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
venv:
44
@python --version || (echo "Python is not installed, please install Python 2 or Python 3"; exit 1);
5+
pip install virtualenv
56
virtualenv --python=python venv
67

78
install: venv
@@ -13,6 +14,8 @@ test-install:
1314
test:
1415
. venv/bin/activate; python -m unittest discover -v
1516
. venv/bin/activate; python test/__init__.py
17+
. venv/bin/activate; flake8 --statistics --count
18+
. venv/bin/activate; coverage run test/__init__.py
1619

1720
clean: nopyc
1821
rm -rf venv

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
:target: https://www.sendgrid.com
33
:alt: SendGrid Logo
44

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

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

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

124-
.. |Travis Badge| image:: https://travis-ci.com/sendgrid/smtpapi-python.svg?branch=main
125-
:target: https://travis-ci.com/sendgrid/smtpapi-python
124+
.. |Tests Badge| image:: https://github.com/sendgrid/smtpapi-python/actions/workflows/tests.yml/badge.svg
125+
:target: https://github.com/sendgrid/smtpapi-python/actions/workflows/tests.yml
126126
.. |Twitter Follow| image:: https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow
127127
:target: https://twitter.com/sendgrid
128128
.. |Codecov branch| image:: https://img.shields.io/codecov/c/github/sendgrid/smtpapi-python/main.svg?style=flat-square&label=Codecov+Coverage

test/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,10 @@ def setUp(self):
106106

107107
self.required_files = [
108108
'./Dockerfile',
109-
'./.codeclimate.yml',
110109
'./.env_sample',
111110
'./ISSUE_TEMPLATE.md',
112111
'./PULL_REQUEST_TEMPLATE.md',
113112
'./.gitignore',
114-
'./.travis.yml',
115113
'./CHANGELOG.md',
116114
'./CODE_OF_CONDUCT.md',
117115
'./CONTRIBUTING.md',

test/test_project.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ def test_env(self):
2626
def test_gitignore(self):
2727
self.assertTrue(os.path.isfile('./.gitignore'))
2828

29-
# ./.travis.yml
30-
def test_travis(self):
31-
self.assertTrue(os.path.isfile('./.travis.yml'))
32-
33-
# ./.codeclimate.yml
34-
def test_codeclimate(self):
35-
self.assertTrue(os.path.isfile('./.codeclimate.yml'))
36-
3729
# ./CHANGELOG.md
3830
def test_changelog(self):
3931
self.assertTrue(os.path.isfile('./CHANGELOG.md'))

0 commit comments

Comments
 (0)