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

Commit

Permalink
Change travis CI to GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
fefi95 committed Oct 25, 2021
1 parent b345669 commit 49885c5
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .github/action/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:
- master

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/action
# - 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/action
# - 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/action
# - 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/action
- 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/action
# - 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/action
# - 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
2 changes: 1 addition & 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 Down
2 changes: 1 addition & 1 deletion tools/snippet-testing/language_handler/python.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Python < BaseHandler
LANG_CNAME = 'py'.freeze

def self.run_before_test(directory)
dirs = ['./venv/*', './guides/*', './testable_snippets/*']
dirs = ['venv/*', 'guides/*', 'testable_snippets/*']
exclude = dirs.map{|dir| "--exclude='#{dir}'"}
Dir.chdir(directory) do
output = `yapf #{exclude.join(' ')} -i -r . && flake8`
Expand Down

0 comments on commit 49885c5

Please sign in to comment.