Skip to content

Commit 868b69c

Browse files
chore: migrate from travis ci to gh actions (#577)
1 parent 50a9a4a commit 868b69c

File tree

5 files changed

+121
-56
lines changed

5 files changed

+121
-56
lines changed

.github/workflows/deploy.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Publish Python 🐍 distributions
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
workflow_dispatch:
7+
8+
jobs:
9+
deploy:
10+
name: Deploy
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout twilio-python
14+
uses: actions/checkout@v2
15+
16+
- name: Login to Docker Hub
17+
uses: docker/login-action@v1
18+
with:
19+
username: ${{ secrets.DOCKER_USERNAME }}
20+
password: ${{ secrets.DOCKER_TOKEN }}
21+
22+
# The expression strips off the shortest match from the front of the string to yield just the tag name as the output
23+
- name: Get tagged version
24+
run: echo "GITHUB_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
25+
26+
- name: Build and Push image
27+
run: make docker-build docker-push
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: '3.6'
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install build
38+
39+
- name: Build package
40+
run: python -m build
41+
42+
- name: Publish package to PyPI
43+
uses: pypa/gh-action-pypi-publish@release/v1
44+
with:
45+
user: __token__
46+
password: ${{ secrets.PYPI_TOKEN }}
47+
48+
notify-on-failure:
49+
name: Slack notify on failure
50+
if: ${{ failure() }}
51+
needs: [ deploy ]
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: rtCamp/action-slack-notify@v2
55+
env:
56+
SLACK_COLOR: 'danger'
57+
SLACK_ICON_EMOJI: ':github:'
58+
SLACK_MESSAGE: ${{ format('Failed to deploy {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }}
59+
SLACK_TITLE: Deployment Failure
60+
SLACK_USERNAME: GitHub Actions
61+
SLACK_MSG_AUTHOR: twilio-dx
62+
SLACK_FOOTER: Posted automatically using GitHub Actions
63+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
64+
MSG_MINIMAL: true

.github/workflows/test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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: [ '3.6', '3.7', '3.8', '3.9' ]
20+
steps:
21+
- name: Checkout twilio-python
22+
uses: actions/checkout@v2
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Install Dependencies
30+
run: |
31+
pip install virtualenv --upgrade
32+
make install
33+
make test-install
34+
35+
- name: Run the tests
36+
run: make test
37+
38+
notify-on-failure:
39+
name: Slack notify on failure
40+
if: ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
41+
needs: [ tests ]
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: rtCamp/action-slack-notify@v2
45+
env:
46+
SLACK_COLOR: 'danger'
47+
SLACK_ICON_EMOJI: ':github:'
48+
SLACK_MESSAGE: ${{ format('Failed running build on {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }}
49+
SLACK_TITLE: Build Failure
50+
SLACK_USERNAME: GitHub Actions
51+
SLACK_MSG_AUTHOR: twilio-dx
52+
SLACK_FOOTER: Posted automatically using GitHub Actions
53+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
54+
MSG_MINIMAL: true

.travis.yml

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

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,11 @@ nopyc:
5454
API_DEFINITIONS_SHA=$(shell git log --oneline | grep Regenerated | head -n1 | cut -d ' ' -f 5)
5555
docker-build:
5656
docker build -t twilio/twilio-python .
57-
docker tag twilio/twilio-python twilio/twilio-python:${TRAVIS_TAG}
57+
docker tag twilio/twilio-python twilio/twilio-python:${GITHUB_TAG}
5858
docker tag twilio/twilio-python twilio/twilio-python:apidefs-${API_DEFINITIONS_SHA}
5959
docker tag twilio/twilio-python twilio/twilio-python:latest
6060

6161
docker-push:
62-
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
63-
docker push twilio/twilio-python:${TRAVIS_TAG}
62+
docker push twilio/twilio-python:${GITHUB_TAG}
6463
docker push twilio/twilio-python:apidefs-${API_DEFINITIONS_SHA}
6564
docker push twilio/twilio-python:latest

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# twilio-python
22

3-
[![Build Status](https://app.travis-ci.com/twilio/twilio-python.svg?branch=main)](https://travis-ci.com/twilio/twilio-python)
3+
[![Tests](https://github.com/twilio/twilio-python/actions/workflows/test.yml/badge.svg)](https://github.com/twilio/twilio-python/actions/workflows/test.yml)
44
[![PyPI](https://img.shields.io/pypi/v/twilio.svg)](https://pypi.python.org/pypi/twilio)
55
[![PyPI](https://img.shields.io/pypi/pyversions/twilio.svg)](https://pypi.python.org/pypi/twilio)
66
[![Learn OSS Contribution in TwilioQuest](https://img.shields.io/static/v1?label=TwilioQuest&message=Learn%20to%20contribute%21&color=F22F46&labelColor=1f243c&style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAASFBMVEUAAAAZGRkcHBwjIyMoKCgAAABgYGBoaGiAgICMjIyzs7PJycnMzMzNzc3UoBfd3d3m5ubqrhfrMEDu7u739/f4vSb/3AD///9tbdyEAAAABX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