Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Change travis CI to GH actions #946

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dfc4e09
Change travis CI to GH actions
fefi95 Oct 22, 2021
8f2dd4e
Fix sync-example.7.x syntax error
alexisbcc Dec 8, 2021
5928ddb
Add missing eof
alexisbcc Dec 8, 2021
4854f55
Fix example-1.7.x syntax error
alexisbcc Dec 8, 2021
dfb95d8
Fix multiple styling issues for python snippets
alexisbcc Dec 8, 2021
94f63f5
Fix print string style
alexisbcc Dec 8, 2021
f36761e
Fix python tests runner
alexisbcc Dec 10, 2021
4931fc5
Revert "Fix python tests runner"
alexisbcc Dec 10, 2021
2666b1d
Fix node linting issues
alexisbcc Dec 8, 2021
e341904
Fix several ruby styling issues
alexisbcc Dec 9, 2021
0c5b2d0
Fix several ruby styling issues
alexisbcc Dec 9, 2021
c433953
Fix several ruby styling issues
alexisbcc Dec 9, 2021
36abf88
Fix several ruby styling issues
alexisbcc Dec 9, 2021
6bdef25
Fix several ruby styling issues
alexisbcc Dec 9, 2021
bd80d1d
Restore missing python tests runner methods
alexisbcc Dec 13, 2021
18bf21b
Change GH actions rule to run for all PR's against any branch
alexisbcc Dec 13, 2021
c6cefe1
Fix dict update and line break
alexisbcc Dec 13, 2021
523e169
Change download file example code
alexisbcc Dec 13, 2021
0bef4fe
Remove snippet execution temporary to make the CI pass
alexisbcc Dec 14, 2021
4ed1f78
Remove rubocop method length verification
alexisbcc Jan 5, 2022
44496e0
Merge pull request #956 from TwilioDevEd/fix-node-snippets
jefflinwood Jan 6, 2022
5250407
Merge pull request #957 from TwilioDevEd/fix-ruby-snippets
jefflinwood Jan 6, 2022
2c997b4
Merge pull request #955 from TwilioDevEd/fix-python-snippets
jefflinwood Jan 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Set up"

runs:
using: "composite"
steps:
- name: Checkout twilio-api-faker
uses: actions/checkout@v2
with:
repository: TwilioDevEd/twilio-api-faker
path: twilio-api-faker
- name: Setup Ruby 2.6
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- name: Install general dependencies
run: |
sudo apt-get install -y --force-yes build-essential ca-certificates curl
gem install json colorize nokogiri rubocop
sudo cp twilio-api-faker/keystore/twilio_fake.pem /usr/local/share/ca-certificates/twilio_fake.crt
sudo update-ca-certificates
shell: bash
119 changes: 119 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Build and test snippets

on:
push:
branches:
- master
pull_request:
branches:
- '*'

env:
FAKE_CERT_PATH: ~/build/TwilioDevEd/api-snippets/twilio-api-faker/keystore/twilio_fake.pem
GRADLE_OPTS: "-Dorg.gradle.daemon=true"
BASH: /bin/bash
BASH_SOURCE: /usr/local/bin/virtualenvwrapper.sh

jobs:
python:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ./.github/setup
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel virtualenv virtualenvwrapper
pip install -r requirements.txt
- name: Run Tests
run: |
echo "Run api faker"
./run_twilio_api_faker.sh
echo "Running tests"
ruby tools/snippet-testing/snippet_tester.rb -i
env:
SNIPPET_LANGUAGE: python

curl:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ./.github/setup
- name: Run Tests
run: |
./run_twilio_api_faker.sh
ruby tools/snippet-testing/snippet_tester.rb -i
env:
SNIPPET_LANGUAGE: curl

node:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ./.github/setup
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm install
- name: Run Tests
run: |
./run_twilio_api_faker.sh
ruby tools/snippet-testing/snippet_tester.rb -i
env:
SNIPPET_LANGUAGE: node

ruby:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ./.github/setup
- name: Install rvm
run: |
sudo apt-add-repository -y ppa:rael-gc/rvm
sudo apt-get update
sudo apt-get install rvm
sudo usermod -a -G rvm $USER
- name: Run Tests
run: |
./run_twilio_api_faker.sh
ruby tools/snippet-testing/snippet_tester.rb -i
env:
SNIPPET_LANGUAGE: ruby

csharp:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ./.github/setup
- name: Run Tests
run: |
./run_twilio_api_faker.sh
ruby tools/snippet-testing/snippet_tester.rb -i
env:
SNIPPET_LANGUAGE: csharp

php:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ./.github/setup
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '5.6'
- name: Run Tests
run: |
./run_twilio_api_faker.sh
ruby tools/snippet-testing/snippet_tester.rb -i
env:
SNIPPET_LANGUAGE: php
4 changes: 3 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: '2.2'
TargetRubyVersion: '2.6'
Exclude:
- 'testable_snippets/**/*'
- '*/testable_snippets/**/*'
Expand All @@ -11,3 +11,5 @@ Style/FrozenStringLiteralComment:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/MethodLength:
Enabled: false
76 changes: 0 additions & 76 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions api-auth/api-auth.5.x.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require 'twilio-ruby'

# To set up environmental variables, see http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID'] # Your Account SID from www.twilio.com/console
api_key = ENV['TWILIO_API_KEY'] # You can generate this from www.twilio.com/console/runtime/api-keys/create
api_secret = ENV['TWILIO_API_KEY_SECRET'] # You can generate this from www.twilio.com/console/runtime/api-keys/create
account_sid = ENV['TWILIO_ACCOUNT_SID'] # Your Account SID from www.twilio.com/console
api_key = ENV['TWILIO_API_KEY'] # You can generate this from www.twilio.com/console/runtime/api-keys/create
api_secret = ENV['TWILIO_API_KEY_SECRET'] # You can generate this from www.twilio.com/console/runtime/api-keys/create

# DANGER! This is insecure. See http://twil.io/secure
@client = Twilio::REST::Client.new api_key, api_secret, account_sid
Expand Down
2 changes: 1 addition & 1 deletion client/capability-token-2way/capability-token.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'sinatra'

get '/token' do
# To set up environmental variables, see http://twil.io/secure
# To set up environmental variables, see http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
capability = Twilio::JWT::ClientCapability.new(account_sid, auth_token)
Expand Down
2 changes: 1 addition & 1 deletion client/capability-token-incoming/capability-token.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'sinatra'

get '/token' do
# To set up environmental variables, see http://twil.io/secure
# To set up environmental variables, see http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
capability = Twilio::JWT::ClientCapability.new(account_sid, auth_token)
Expand Down
2 changes: 1 addition & 1 deletion client/capability-token-outgoing/capability-token.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'sinatra'

get '/token' do
# To set up environmental variables, see http://twil.io/secure
# To set up environmental variables, see http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
capability = Twilio::JWT::ClientCapability.new(account_sid, auth_token)
Expand Down
2 changes: 1 addition & 1 deletion client/capability-token/capability-token.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'sinatra'

get '/token' do
# To set up environmental variables, see http://twil.io/secure
# To set up environmental variables, see http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
capability = Twilio::JWT::ClientCapability.new(account_sid, auth_token)
Expand Down
2 changes: 1 addition & 1 deletion client/response-twiml-client/response-twiml-client.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
r.Dial callerId: '+15017122661' do |d|
# wrap the phone number or client name in the appropriate TwiML verb
# by checking if the number given has only digits and format symbols
if params['To'].match?(/^[\d\+\-\(\) ]+$/)
if params['To'].match?(/^[\d+\-() ]+$/)
d.Number params['To']
else
d.Client params['To']
Expand Down
6 changes: 4 additions & 2 deletions deployed-devices/quickstarts/paho-python/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
client = mqtt.Client(client_id="bob", clean_session=False)

#
# Initialize TLS, specify trusted CA roots, client certifiate and key file locations.
# You may need to adjust the location of trusted Certificate Authorities depending on your OS.
# Initialize TLS, specify trusted CA roots, client certifiate and key
# file locations.
# You may need to adjust the location of trusted Certificate
# Authorities depending on your OS.
# Typical locations are /etc/ssl/cert.pem and /usr/local/ssl/cert.pem
#
client.tls_set("/usr/local/ssl/cert.pem",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@


#
# Initialize TLS, specify trusted CA roots, client certifiate and key file locations.
# You may need to adjust the location of trusted Certificate Authorities depending on your OS.
# Initialize TLS, specify trusted CA roots, client certifiate and key
# file locations.
# You may need to adjust the location of trusted Certificate
# Authorities depending on your OS.
# Typical locations are /etc/ssl/cert.pem and /usr/local/ssl/cert.pem
#
client.tls_set("/usr/local/ssl/cert.pem",
Expand Down
1 change: 0 additions & 1 deletion fax/basic-send/basic-send.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

Net::HTTP.start(uri.host, uri.port,
use_ssl: uri.scheme == 'https') do |http|

request = Net::HTTP::Post.new uri.request_uri
request.basic_auth account_sid, auth_token
request.body = URI.encode_www_form(To: '+15558675310',
Expand Down
1 change: 0 additions & 1 deletion fax/instance-get-example/instance-get-example.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

Net::HTTP.start(uri.host, uri.port,
use_ssl: uri.scheme == 'https') do |http|

request = Net::HTTP::Get.new uri.request_uri
request.basic_auth(account_sid, auth_token)

Expand Down
1 change: 0 additions & 1 deletion fax/instance-post-example/instance-post-example.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

Net::HTTP.start(uri.host, uri.port,
use_ssl: uri.scheme == 'https') do |http|

request = Net::HTTP::Post.new uri.request_uri
request.basic_auth(account_sid, auth_token)
request.body = URI.encode_www_form(Status: 'canceled')
Expand Down
1 change: 0 additions & 1 deletion fax/list-get-example/list-get-example.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

Net::HTTP.start(uri.host, uri.port,
use_ssl: uri.scheme == 'https') do |http|

request = Net::HTTP::Get.new uri.request_uri
request.basic_auth(account_sid, auth_token)

Expand Down
1 change: 0 additions & 1 deletion fax/sip-send/example-1/example-1.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

Net::HTTP.start(uri.host, uri.port,
use_ssl: uri.scheme == 'https') do |http|

request = Net::HTTP::Post.new uri.request_uri
request.basic_auth(account_sid, auth_token)
request.body = URI.encode_www_form(To: 'sip:[email protected]',
Expand Down
1 change: 0 additions & 1 deletion fax/sip-send/example-2/example-2.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

Net::HTTP.start(uri.host, uri.port,
use_ssl: uri.scheme == 'https') do |http|

request = Net::HTTP::Post.new uri.request_uri
request.basic_auth(account_sid, auth_token)
request.body = URI.encode_www_form(To: 'sip:[email protected]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

payload_url = add_ons['results']['ibm_watson_speechtotext']['payload'][0]['url']

# To set up environmental variables, see http://twil.io/secure
# To set up environmental variables, see http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
resp = HTTParty.get(
Expand Down
Empty file modified install_travis_dependencies.sh
100755 → 100644
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ function registerEventHandlers() {
// function to handle User updates
function handleUserUpdate(user, updateReasons) {
// loop over each reason and check for reachability change
updateReasons.forEach(reason =>
updateReasons.forEach(reason => {
if (reason == 'online') {
//do something
}
)
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

credential = client.chat \
.credentials("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
.update(friendly_name="MyCredential", api_key=os.environ['TWILIO_API_KEY_SECRET'])
.update(friendly_name="MyCredential",
api_key=os.environ['TWILIO_API_KEY_SECRET'])

print(credential.friendly_name)
Loading