diff --git a/.github/action/action.yml b/.github/action/action.yml new file mode 100644 index 0000000000..6fed748234 --- /dev/null +++ b/.github/action/action.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml new file mode 100644 index 0000000000..12dde75c8c --- /dev/null +++ b/.github/workflows/build_test.yml @@ -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/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 diff --git a/.rubocop.yml b/.rubocop.yml index 88818bd933..3b861fb0df 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,5 @@ AllCops: - TargetRubyVersion: '2.2' + TargetRubyVersion: '2.6' Exclude: - 'testable_snippets/**/*' - '*/testable_snippets/**/*' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8b04245353..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,76 +0,0 @@ -dist: trusty -sudo: required - -rvm: - - 2.2.1 - -before_install: - - ./install_travis_dependencies.sh - -install: - - gem install json colorize nokogiri rubocop - - git clone https://github.com/TwilioDevEd/twilio-api-faker.git - - sudo cp twilio-api-faker/keystore/twilio_fake.pem /usr/local/share/ca-certificates/twilio_fake.crt - - sudo update-ca-certificates - -script: - - ./run_twilio_api_faker.sh - - ruby tools/snippet-testing/snippet_tester.rb -i - -env: - global: - - NODE_PATH=/usr/local/lib/node_modules - - NODE_TLS_REJECT_UNAUTHORIZED=0 - - 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 - -matrix: - include: - - env: SNIPPET_LANGUAGE=python:curl - dist: precise - - env: SNIPPET_LANGUAGE=java6 - jdk: oraclejdk7 - - env: SNIPPET_LANGUAGE=java7 - jdk: oraclejdk8 - - language: csharp - mono: latest - env: SNIPPET_LANGUAGE=csharp:ruby - - env: SNIPPET_LANGUAGE=node:php - -addons: - hosts: - - api.twilio.com - - chat.twilio.com - - fax.twilio.com - - ip-messaging.twilio.com - - lookups.twilio.com - - messaging.twilio.com - - monitor.twilio.com - - notifications.twilio.com - - notify.twilio.com - - preview.twilio.com - - pricing.twilio.com - - sync.twilio.com - - taskrouter.twilio.com - - video.twilio.com - - wireless.twilio.com - -notifications: - slack: - rooms: - secure: Lbt/FIOBmBxqSH4aj4cctd+ygAWWN+IoEGRC1f7Wn1mgciSAWCGs6krUAqsxDCO+mU0bV0EdO2SNaB5vlmMCBA0tti6KYzR4M4OgkM/KwIUk1MBJcaD2gpMMbMK66xG74b5arPuO7GIWMjHgScKo04LGGeYOcw7RJZwB6CY+3eyFo4HLVkuWizNC2Qw2yq/2F///QywljWMbvJy1dUs0Ax3KG6NW8aRhj98TN/vnVAwC7BKCWYD0QQY+8qKf4Cbmt6W4riNufqm8ZQdLdgbRnLdKKxHUCEkARPzLvJhLrR4fB70hXI8iWcms0CcLPf2kjG8+iJso9MCai1SGdi4+duAoBUxHzCQTK2Q+8t7LKrfaOm9j0p46tk9VcI9GLUzVgE5XZpqssv+dqvf1tB/d+XTZu2M4I1fmZm0O7uo3XSWO25Vob6sqHKoRe1E0Ums4yCv5ZiMWuzvFan4CPIoC2Gxn1ZFWPU+//SDHolKIAG5j6bx9v+66UOv7EkBQVlW9CbZmK+12mRL0+gNxfWmFW23tgJhnuEYmJHqEGi3GWjzBY8YTQ5eiUJQXxV/NZknwAB4d/cHDEvbBlVrURqXG/E60ecKNw6QqTO8HMZXP8ROBPzKPSnwsY6TDPf1rrH3D9N4o9JyEhquuWG4NSovOcrzopgoNyfaEWbj0cLwxxs8= - on_failure: always - on_success: change - -cache: - apt: true - pip: true - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ diff --git a/install_travis_dependencies.sh b/install_travis_dependencies.sh old mode 100755 new mode 100644 diff --git a/tools/snippet-testing/language_handler/python.rb b/tools/snippet-testing/language_handler/python.rb index f69e88657b..d4d6523129 100644 --- a/tools/snippet-testing/language_handler/python.rb +++ b/tools/snippet-testing/language_handler/python.rb @@ -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`