Skip to content

Commit defb597

Browse files
authored
chore: migrate to GitHub Actions (#151)
1 parent 058b9f2 commit defb597

File tree

7 files changed

+105
-57
lines changed

7 files changed

+105
-57
lines changed

.codeclimate.yml

-7
This file was deleted.

.github/workflows/release.yml

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

.github/workflows/tests.yaml

+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-http-client
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

-45
This file was deleted.

Makefile

+1
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

README.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. image:: https://github.com/sendgrid/sendgrid-python/raw/HEAD/twilio_sendgrid_logo.png
22
:target: https://www.sendgrid.com
33

4-
|Build Status| |Twitter Follow| |Codecov branch| |Code Climate| |Python Versions| |PyPI Version| |GitHub contributors| |MIT licensed|
4+
|Test Status| |Twitter Follow| |Codecov branch| |Code Climate| |Python Versions| |PyPI Version| |GitHub contributors| |MIT licensed|
55

66
**The default branch name for this repository has been changed to `main` as of 07/27/2020.**
77

@@ -157,8 +157,8 @@ License
157157
.. _The MIT License (MIT): https://github.com/sendgrid/python-http-client/blob/HEAD/LICENSE
158158
.. _this is an incredible opportunity to join our #DX team: https://sendgrid.com/careers/role/1421152/?gh_jid=1421152
159159

160-
.. |Build Status| image:: https://travis-ci.com/sendgrid/python-http-client.svg?branch=main
161-
:target: https://travis-ci.com/sendgrid/python-http-client
160+
.. |Test Status| image:: https://github.com/sendgrid/python-http-client/actions/workflows/tests.yml/badge.svg
161+
:target: https://github.com/sendgrid/python-http-client/actions/workflows/tests.yaml
162162
.. |Twitter Follow| image:: https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow
163163
:target: https://twitter.com/sendgrid
164164
.. |Codecov branch| image:: https://img.shields.io/codecov/c/github/sendgrid/python-http-client/main.svg?style=flat-square&label=Codecov+Coverage

tests/test_repofiles.py

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ class RepoFiles(unittest.TestCase):
88
['./docker-compose.yml', './docker/docker-compose.yml'],
99
['./.env_sample'],
1010
['./.gitignore'],
11-
['./.travis.yml'],
12-
['./.codeclimate.yml'],
1311
['./CHANGELOG.md'],
1412
['./CODE_OF_CONDUCT.md'],
1513
['./CONTRIBUTING.md'],

0 commit comments

Comments
 (0)