Skip to content

Commit 744ca8c

Browse files
authored
chore: migrate to GitHub Actions (#1027)
1 parent 1565945 commit 744ca8c

10 files changed

+106
-65
lines changed

.codeclimate.yml

-3
This file was deleted.

.github/workflows/release.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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
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+
26+
- name: Publish package to PyPI
27+
uses: pypa/gh-action-pypi-publish@release/v1
28+
with:
29+
user: __token__
30+
password: ${{ secrets.PYPI_TOKEN }}
31+
32+
notify-on-failure:
33+
name: Slack notify on failure
34+
if: ${{ failure() }}
35+
needs: [ release ]
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: rtCamp/action-slack-notify@v2
39+
env:
40+
SLACK_COLOR: 'danger'
41+
SLACK_ICON_EMOJI: ':github:'
42+
SLACK_MESSAGE: ${{ format('Failed to release {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }}
43+
SLACK_TITLE: Release Failure
44+
SLACK_USERNAME: GitHub Actions
45+
SLACK_MSG_AUTHOR: twilio-dx
46+
SLACK_FOOTER: Posted automatically using GitHub Actions
47+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
48+
MSG_MINIMAL: true

.github/workflows/tests.yml

+50
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
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 test-docker test-install
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

-46
This file was deleted.

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
venv: clean
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

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
![SendGrid Logo](twilio_sendgrid_logo.png)
22

3-
[![Travis Badge](https://travis-ci.com/sendgrid/sendgrid-python.svg?branch=main)](https://travis-ci.com/sendgrid/sendgrid-python)
4-
[![codecov](https://img.shields.io/codecov/c/github/sendgrid/sendgrid-python/main.svg?style=flat-square&label=Codecov+Coverage)](https://codecov.io/gh/sendgrid/sendgrid-python)
3+
[![Tests](https://github.com/sendgrid/sendgrid-python/actions/workflows/tests.yml/badge.svg)](https://github.com/sendgrid/sendgrid-python/actions/workflows/tests.yml)
54
[![Docker Badge](https://img.shields.io/docker/automated/sendgrid/sendgrid-python.svg)](https://hub.docker.com/r/sendgrid/sendgrid-python/)
65
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
76
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)

README.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55

6-
|Travis Badge| |codecov| |Python Versions| |PyPI Version| |Docker Badge| |Email Notifications Badge| |MIT licensed| |Twitter Follow| |GitHub contributors| |Open Source Helpers|
6+
|Tests Badge| |codecov| |Python Versions| |PyPI Version| |Docker Badge| |Email Notifications Badge| |MIT licensed| |Twitter Follow| |GitHub contributors| |Open Source Helpers|
77

88
**This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via Python.**
99

@@ -288,8 +288,8 @@ License
288288
.. _troubleshooting guide: https://github.com/sendgrid/sendgrid-python/blob/HEAD/TROUBLESHOOTING.md
289289
.. _The MIT License (MIT): https://github.com/sendgrid/sendgrid-python/blob/HEAD/LICENSE
290290

291-
.. |Travis Badge| image:: https://travis-ci.com/sendgrid/sendgrid-python.svg?branch=main
292-
:target: https://travis-ci.com/sendgrid/sendgrid-python
291+
.. |Tests Badge| image:: https://github.com/sendgrid/sendgrid-python/actions/workflows/test.yml/badge.svg
292+
:target: https://github.com/sendgrid/sendgrid-python/actions/workflows/test.yml
293293
.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/sendgrid.svg
294294
:target: https://pypi.org/project/sendgrid/
295295
.. |PyPI Version| image:: https://img.shields.io/pypi/v/sendgrid.svg

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Flask==1.0.2
1+
Flask==1.1.2
22
PyYAML>=4.2b1
33
python-http-client>=3.2.1
44
six==1.11.0

test/test_project.py

-8
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ def test_env(self):
1111
def test_gitignore(self):
1212
self.assertTrue(os.path.isfile('./.gitignore'))
1313

14-
# ./.travis.yml
15-
def test_travis(self):
16-
self.assertTrue(os.path.isfile('./.travis.yml'))
17-
18-
# ./.codeclimate.yml
19-
def test_codeclimate(self):
20-
self.assertTrue(os.path.isfile('./.codeclimate.yml'))
21-
2214
# ./CHANGELOG.md
2315
def test_changelog(self):
2416
self.assertTrue(os.path.isfile('./CHANGELOG.md'))

test/test_sendgrid.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1649,14 +1649,14 @@ def test_suppression_invalid_emails__email__delete(self):
16491649
def test_suppression_spam_report__email__get(self):
16501650
email = "test_url_param"
16511651
headers = {'X-Mock': 200}
1652-
response = self.sg.client.suppression.spam_report._(
1652+
response = self.sg.client.suppression.spam_reports._(
16531653
email).get(request_headers=headers)
16541654
self.assertEqual(response.status_code, 200)
16551655

16561656
def test_suppression_spam_report__email__delete(self):
16571657
email = "test_url_param"
16581658
headers = {'X-Mock': 204}
1659-
response = self.sg.client.suppression.spam_report._(
1659+
response = self.sg.client.suppression.spam_reports._(
16601660
email).delete(request_headers=headers)
16611661
self.assertEqual(response.status_code, 204)
16621662

0 commit comments

Comments
 (0)