Skip to content

Commit 5049dc1

Browse files
authored
chore: merge test and deploy gh action workflows (#109)
1 parent 2cdc080 commit 5049dc1

File tree

4 files changed

+79
-103
lines changed

4 files changed

+79
-103
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Test and Deploy
2+
on:
3+
push:
4+
branches: [ '*' ]
5+
tags: [ '*' ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
# Run automatically at 8AM PST Monday-Friday
10+
- cron: '0 15 * * 1-5'
11+
workflow_dispatch:
12+
13+
jobs:
14+
test:
15+
name: Test
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 20
18+
strategy:
19+
matrix:
20+
python-version: [ '2.7', '3.5', '3.6', '3.7', '3.8', '3.9' ]
21+
steps:
22+
- name: Checkout sendgrid-python-smtpapi
23+
uses: actions/checkout@v2
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Build & Test
31+
run: make install test-install test
32+
33+
deploy:
34+
name: Deploy
35+
if: success() && github.ref_type == 'tag'
36+
needs: [ test ]
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout sendgrid-python-smtpapi
40+
uses: actions/checkout@v2
41+
42+
- name: Set up Python
43+
uses: actions/setup-python@v2
44+
with:
45+
python-version: '3.6'
46+
47+
- name: Install dependencies
48+
run: |
49+
python -m pip install --upgrade pip
50+
pip install build
51+
pip install wheel
52+
python setup.py sdist bdist_wheel
53+
54+
- name: Publish package to PyPI
55+
uses: pypa/gh-action-pypi-publish@release/v1
56+
with:
57+
user: __token__
58+
password: ${{ secrets.PYPI_TOKEN }}
59+
60+
notify-on-failure:
61+
name: Slack notify on failure
62+
if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
63+
needs: [ test, deploy ]
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: rtCamp/action-slack-notify@v2
67+
env:
68+
SLACK_COLOR: failure
69+
SLACK_ICON_EMOJI: ':github:'
70+
SLACK_MESSAGE: ${{ format('Test *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }}
71+
SLACK_TITLE: Action Failure - ${{ github.repository }}
72+
SLACK_USERNAME: GitHub Actions
73+
SLACK_MSG_AUTHOR: twilio-dx
74+
SLACK_FOOTER: Posted automatically using GitHub Actions
75+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
76+
MSG_MINIMAL: true

.github/workflows/tests.yml

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

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-
|Tests Badge| |Twitter Follow| |Codecov branch| |Python Versions| |PyPI Version| |GitHub contributors| |MIT Licensed|
5+
|Test and Deploy 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-
.. |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
124+
.. |Test and Deploy Badge| image:: https://github.com/sendgrid/smtpapi-python/actions/workflows/test-and-deploy.yml/badge.svg
125+
:target: https://github.com/sendgrid/smtpapi-python/actions/workflows/test-and-deploy.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

0 commit comments

Comments
 (0)