From 49885c59bba7ea3c911ac5905af762d672fc8dfe Mon Sep 17 00:00:00 2001 From: Stefani Castellanos Date: Fri, 22 Oct 2021 14:39:30 -0500 Subject: [PATCH] Change travis CI to GH actions --- .github/action/action.yml | 21 ++++ .github/workflows/build_test.yml | 119 ++++++++++++++++++ .rubocop.yml | 2 +- .../language_handler/python.rb | 2 +- 4 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 .github/action/action.yml create mode 100644 .github/workflows/build_test.yml 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..0acd95fe25 --- /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/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 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/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`