Skip to content

Commit bbd1319

Browse files
authored
chore: merge test and deploy workflows (#1039)
1 parent 3b17a34 commit bbd1319

File tree

4 files changed

+72
-101
lines changed

4 files changed

+72
-101
lines changed

.github/workflows/release.yml

-50
This file was deleted.

.github/workflows/test-and-deploy.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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
23+
uses: actions/checkout@v2
24+
25+
- name: Build & Test
26+
run: make test-docker version=${{ matrix.python-version }}
27+
28+
deploy:
29+
name: Deploy
30+
if: success() && github.ref_type == 'tag'
31+
needs: [ test ]
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout sendgrid-python
35+
uses: actions/checkout@v2
36+
37+
- name: Set up Python
38+
uses: actions/setup-python@v2
39+
with:
40+
python-version: '3.6'
41+
42+
- name: Install dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install build
46+
pip install wheel
47+
python setup.py sdist bdist_wheel
48+
49+
- name: Publish package to PyPI
50+
uses: pypa/gh-action-pypi-publish@release/v1
51+
with:
52+
user: __token__
53+
password: ${{ secrets.PYPI_TOKEN }}
54+
55+
notify-on-failure:
56+
name: Slack notify on failure
57+
if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
58+
needs: [ test, deploy ]
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: rtCamp/action-slack-notify@v2
62+
env:
63+
SLACK_COLOR: failure
64+
SLACK_ICON_EMOJI: ':github:'
65+
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) }}
66+
SLACK_TITLE: Action Failure - ${{ github.repository }}
67+
SLACK_USERNAME: GitHub Actions
68+
SLACK_MSG_AUTHOR: twilio-dx
69+
SLACK_FOOTER: Posted automatically using GitHub Actions
70+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
71+
MSG_MINIMAL: true

.github/workflows/tests.yml

-50
This file was deleted.

README.md

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

3-
[![Tests](https://github.com/sendgrid/sendgrid-python/actions/workflows/tests.yml/badge.svg)](https://github.com/sendgrid/sendgrid-python/actions/workflows/tests.yml)
3+
[![BuildStatus](https://github.com/sendgrid/sendgrid-python/actions/workflows/test-and-deploy.yml/badge.svg)](https://github.com/sendgrid/sendgrid-python/actions/workflows/test-and-deploy.yml)
44
[![Docker Badge](https://img.shields.io/docker/automated/sendgrid/sendgrid-python.svg)](https://hub.docker.com/r/sendgrid/sendgrid-python/)
55
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
66
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)

0 commit comments

Comments
 (0)