Skip to content

Commit

Permalink
OpenAPI Generator SDK Feature Branch (#61)
Browse files Browse the repository at this point in the history
* OpenAPI Generator SDK Feature Branch

* remove old sdk

* Update to OpenAPI Generator v6.3 (#66)

* use version 6.3 of the generator

* regenerate tests

* drop ruby 2.6

* add 3.2 to test matrix

* split tests and do messaging integration as test

* remove from test.rb

* checkout v3

* tests in readme

* put constant env vars in spec_helper

* remove constants from messaging

* add unit and integration tasks to rake

* move other unit tests to unit folder

* clean up integration test files

* remove messaging integration tests to put in separate pr

* gitignore gemfile.lock

* update bw spec and use v6.4.0 of the generator (#72)

* Remove webrtc (#73)

* remove webrtc files

* update files

* Small changes to clean up repo for beta release (#74)

* DX-2940 Messaging Integration Tests (#67)

* DX-2940 Messaging Integration Tests

* remove ssl_verify

* switch to 1 set of 4xx tests

* set config once

* assert response objects

* DX-2941 MFA Integration Tests (#68)

* DX-2941 MFA Integration Tests

* 4xx

* finish mfa tests

* undo changes to test.rb

* standardize response name

* assert response objects

* DX-2942 TN Lookup Integration Tests (#69)

* DX-2942 TN Lookup Integration Tests

* remove unused after block

* update comment

* remove unused variable

* separate tests

* assert response objects

* DX-2938 Media Integration Tests (#70)

* DX-2938 Media Integration Tests

* upload and list tests

* happy path

* add attr_accessor for return_binary_data

* add 404

* remove unused after block

* update with comment from my parent project PR

* remove unused files

* assert response object

* use stricter asserts

* Add BXML Verbs (#75)

* Add Root Classes for BXML Verbs

* remove unfinished verbs from sdk requires

* add unit tests for Bxml and Response

* add ffi to install libxml2 for windows

* use 3.2.2 of libxml

* switch to libxml require

* Try Using Ox (#78)

* ox dump instead of to_s

* use attribute map in verb

* standardize expected bxml var

* typos

* Add Terminal Verbs (#76)

* Add Terminal Verbs

* update bridge and add unit test

* add unit test for root verb module

* bridge test

* bridge comment

* update conference

* add terminal verb unit test

* verb test

* all attributes in bridge test

* add conference and test

* add conference to sdk

* remove backslash escaping

* test number

* use real booleans for conference

* add comment to bridge

* add pause and test

* conference timeout is a Number

* add forward and test

* add explicit empty hash to tag

* add hangup and test

* add pause_recording and test

* add phone_number and test

* add play_audio and test

* comments for params

* add record and test

* add redirect and test

* add resume_recording and test

* add ring and test

* add send_dtmf and test

* add sip_uri and test

* add speak_sentence and test

* add start_gather and test

* add start_recording and test

* add stop_gather and test

* add stop_recording and test

* add stop_stream and test

* _name for stop_stream

* add stream_param and test

* add test for tag verb

* turn ssml regex into constants

* test decimals in ring verb

* test decimals in conference

* comment clean up

* Add Non-Terminal Verbs (#77)

* Add Non-Terminal Verbs

* merge SWI-1730

* update gather and add tests

* period in gather comment

* add start_stream and test

* add transfer and test

* remove add_verb method

* update response and bxml class tests

* update non-terminal verbs and tests

* refactor base verb classes (#80)

* use call id for bridge test

* update gem ox dependency

* Apply suggestions from code review

Co-authored-by: Matthew Martin <[email protected]>

---------

Co-authored-by: Matthew Martin <[email protected]>

* Calls, Recordings, Conferences, and Statistics Integration Tests (#71)

* DX-2937 Calls Integration Tests

* update ignore

* separate tests

* remove test.rb

* split tests and add 4xx tests

* add 403

* update call test

* update call

* clearer variable name and update env vars

* secrets.

* finish calls

* add env vars, refactoring, and recording tests

* conferences test

* more recordings tests

* finish recordings

* add asserts for response objects

* finalize calls

* reorder recordings

* finish conferences

* complete or partial

* fix test.yml

* spaces

* updates and statistics tests (#79)

* use stricter type matching for asserts

* stricter asserts

* add statistics tests

* add retry logic to call cleanup

* add sleep and retry less

* update version

* SWI-1988 Update SDK with `expiration` field (#87)

* SWI-1988 Update SDK with `expiration` field

* update pre-release name regex

* remove application id assert from recordings test because its not guaranteed (#90)

* update tests workflows for feature branch

* Task: Update Manteca Test IDs (#89)

* SWI-2788 Add Transcription BXML to Feature Branch (#100)

* SWI-2788 Add Transcription BXML to Feature Branch

* update workflow

* update workflows with formatting

* SWI-2821 Prep for GA (#101)

* update spec and use 6.6

* changes we'd need to automate

* newline in readme

* remove config tests

* revert config back to working version

* regenerate with v6.5.0

* fix other files

* dont try to clean up calls since voice api is slow

* update spec

* add custom templates and update readme badge

* update test workflow name

* add openapitools

* add sdk update workflow

* add config test file and fix it

* update config test

* update integration tests

* Revert "update integration tests"

This reverts commit 77545d9.

* add client option to rakefile

* update version logic and ignore file

* remove unnecessary env vars from build wf

* revert version change

* remove unnecessary spec_helper imports

* lots of small changes based on rubocop linting

* update custom templates

* add rubocop badge to README

* add gem version badge to readme

* remove unnecessary deploy action

* update codeowners

* update workflows

* add gem version env var to test wfs

* SWI-1771 Add Unit Tests  (#103)

* update spec and use 6.6

* changes we'd need to automate

* newline in readme

* remove config tests

* revert config back to working version

* regenerate with v6.5.0

* fix other files

* dont try to clean up calls since voice api is slow

* update spec

* add custom templates and update readme badge

* update test workflow name

* add openapitools

* add sdk update workflow

* add config test file and fix it

* update config test

* update integration tests

* Revert "update integration tests"

This reverts commit 77545d9.

* add client option to rakefile

* update version logic and ignore file

* remove unnecessary env vars from build wf

* revert version change

* remove unnecessary spec_helper imports

* lots of small changes based on rubocop linting

* update custom templates

* add rubocop badge to README

* add gem version badge to readme

* remove unnecessary deploy action

* update codeowners

* update workflows

* add gem version env var to test wfs

* remove newlines from bxml tests

* unit tests for acc stats

* comment

* fix eventTime data type

* answer callback tests and improve

* bridge callback and improve

* bridge target

* enum tests

* test desc

* delete unused spec files for unit tests

* update message time to be date-time

* add suite of encompassing unit tests

* update gitignore

* fix small logic error in bxml library

* calls_api unit tests

* remove unnecessary require

* update calls tests to be better and add conferences tests

* add webmock

* move 4xx tests to client suite

* skip all integration tests

* skip 4xx tests for now (TODO: fix these)

* rubocop linting for calls and conferences

* add comment to document test skips

* spacing

* fix hashes

* media tests

* remove unnecessary flag from media integration

* rubocop doesnt like my newline

* add argument error tests to media

* reorganizing

* recordings tests

* update list message item receive time

* messages tests

* add argument error tests to messages

* fix expects

* update messages

* mfa tests

* i can test basic auth in the client, not needed in apis

* assert arrays

* be_a -> be_instance_of

* tnlookup tests

* statistics tests

* add gems to Gemfile and template

* bring back statistics integration tests

* bring back mfa

* remove json dep

* tnlookup

* enforce single quotes

* more quotes changes

* single quotes

* media

* add string interpolation rule

* quotes in tests

* dont do config

* exclude files from rubocop

* ignore rubocop

* messages

* calls

* newline

* assertion cleanup

* conferences

* consistency

* recordings

* update model tests

* start on client tests

* configuration tests

* small changes

* update openapi-generator-ignore to ignore all tests

* update error checking

* error checking

* lots of client tests

* lowercase require?

* use @uri

* refactor to use let

* use let for rest of unit tests

* use let

* final client tests

* use let in integration tests

* rubocop save me

* rubocop newlines around blocks

* add ApiError tests

* no longer need to install hub

* update unit tests

* finalize workflow

* add limitTotalCount (new msg param)

* SWI-2821 Improve BXML Library (#106)

* fix deploy workflow

* please deploy this time

* SWI-3149 Update to Generator Version 7.0.0 (#107)

* SWI-3149 Update to Generator Version 7.0.0

* update tests

* fix tests again

* update workflow

* SWI-3336 Update SDK to OpenAPI Generator 7.0.0 (#108)

* SWI-3336 Update SDK to OpenAPI Generator 7.0.0

* update generator config

* update bw spec

* update sdk to 7.0.0

* add `display_name` to calls tests

* remove assignee from Jira

* SWI-3338 Update SDK for GA (#109)

* SWI-3338 Update SDK for GA

* update beta regex to normal release regex

* update version

* update README to include generate command

* update deploy workflow to update gem version before release

* test wf

* update test

* remove test

* revert pre-release regex

* update call state test

* update release regex

* remove ruby-notes and old sdk files

---------

Co-authored-by: Matthew Martin <[email protected]>
  • Loading branch information
ckoegel and matthewkmartin authored Sep 26, 2023
1 parent c18063e commit 8c708af
Show file tree
Hide file tree
Showing 476 changed files with 48,276 additions and 14,530 deletions.
11 changes: 0 additions & 11 deletions .github/actions/deploy/Dockerfile

This file was deleted.

6 changes: 0 additions & 6 deletions .github/actions/deploy/action.yml

This file was deleted.

7 changes: 0 additions & 7 deletions .github/actions/deploy/entrypoint.sh

This file was deleted.

89 changes: 26 additions & 63 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,7 @@ on:

jobs:
deploy:
name: Deploy to Rubygems
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"

- name: Install Packages
run: bundle install

- name: Test
env:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
BW_USERNAME: ${{ secrets.BW_USERNAME }}
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
BW_NUMBER: ${{ secrets.BW_NUMBER }}
USER_NUMBER: ${{ secrets.USER_NUMBER }}
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
run: rake

- name: Deploy to Rubygems
uses: ./.github/actions/deploy
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}

- uses: Bandwidth/[email protected]
if: always()
with:
job-status: ${{ job.status }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ secrets.SLACK_CHANNEL }}

deploy_pre_release:
name: Deploy OpenAPI Generator Client Pre-Release to Rubygems
if: ${{ github.event.release.prerelease && github.event.release.target_commitish == 'feature/openapi-generator-sdk' }}
name: Deploy SDK to Rubygems
runs-on: ubuntu-latest
env:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
Expand All @@ -61,49 +20,53 @@ jobs:
BW_NUMBER: ${{ secrets.BW_NUMBER }}
USER_NUMBER: ${{ secrets.USER_NUMBER }}
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
RUBY_VERSION: '3.0'
OPERATING_SYSTEM: 'ubuntu'
RUBY_VERSION: "3.0"
OPERATING_SYSTEM: "ubuntu"
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
BW_NUMBER_PROVIDER: ${{ secrets.BW_NUMBER_PROVIDER }}

steps:
- name: Set Release Version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- name: Check Release Tag Format
run: |
re=[0-9]+\.[0-9]+\.[0-9]+\.pre\.beta\.[0-9]+\.?[0-9]*\.?[0-9]*
if ! [[ $RELEASE_VERSION =~ $re ]]; then
echo 'Tag does not match expected regex pattern for beta releases (v[0-9]+\.[0-9]+\.[0-9]+\.pre\.beta\.[0-9]+\.?[0-9]*\.?[0-9]*)'
RELEASE_VERSION=${GITHUB_REF#refs/tags/v}
re=[0-9]+\.[0-9]+\.[0-9]+
if [[ $RELEASE_VERSION =~ $re ]]; then
echo "GEM_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
else
echo "Tag does not match expected semver regex pattern (v$re)"
echo $RELEASE_VERSION
echo 'Please update your tag to match the expected regex pattern'
exit 1
fi
- name: Checkout
uses: actions/checkout@v3
with:
ref: feature/openapi-generator-sdk

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"

- name: Install Packages
run: bundle install
- name: Update Gem Version
run: sed -i "s/VERSION = '.*'/VERSION = '$GEM_VERSION'/g" lib/bandwidth-sdk/version.rb

- name: Install Packages and Test
run: |
bundle install
rake
- name: Test
run: rake

- name: Deploy to Rubygems
uses: ./.github/actions/deploy
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}

run: |
mkdir ~/.gem
touch ~/.gem/credentials
chmod 0600 ~/.gem/credentials
printf -- "---\n:rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}\n" > ~/.gem/credentials
gem build *.gemspec
gem push *.gem
- uses: Bandwidth/[email protected]
if: always()
with:
Expand Down
32 changes: 4 additions & 28 deletions .github/workflows/test-nightly.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test Main and Feature Branch Nightly
name: Test Main Branch Nightly

on:
schedule:
Expand Down Expand Up @@ -31,12 +31,12 @@ jobs:
strategy:
matrix:
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
ruby-version: [2.6, 2.7, 3.0]
ruby-version: [2.7, 3.0, 3.1, 3.2]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: 'main'
ref: "main"

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -47,37 +47,13 @@ jobs:
run: |
bundle install
rake
test_feature:
name: Test Feature Branch Nightly
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
ruby-version: [2.7, 3.0, 3.1, 3.2]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: 'feature/openapi-generator-sdk'

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}

- name: Install Packages and Test
env:
RUBY_VERSION: ${{ matrix.ruby-version }}
OPERATING_SYSTEM: ${{ matrix.os }}
GEM_VERSION: "11.0.0"
run: |
bundle install
rake

notify_for_failures:
name: Notify for Failures
needs: [test_main, test_feature]
needs: [test_main]
if: failure()
runs-on: ubuntu-latest
steps:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ env:
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}

jobs:
test_pr_main:
test_pr:
name: Test PR
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
ruby-version: [2.6, 2.7, 3.0]
ruby-version: [2.7, 3.0, 3.1, 3.2]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -44,3 +44,6 @@ jobs:
run: |
bundle install
rake
env:
RUBY_VERSION: ${{ matrix.ruby-version }}
OPERATING_SYSTEM: ${{ matrix.os }}
106 changes: 106 additions & 0 deletions .github/workflows/update-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Update SDK

on:
schedule:
- cron: "0 14 * * 2"
workflow_dispatch:

jobs:
update-sdk:
name: Update SDK if Necessary
runs-on: ubuntu-latest
outputs:
generate: ${{ steps.compare.outputs.generate }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Combine Product Specs
uses: Bandwidth/[email protected]
with:
token: ${{ secrets.DX_GITHUB_TOKEN }}

- name: Determine if a New SDK is Needed
id: compare
run: |
if cmp -s "bandwidth.yml" "api-specs/bandwidth.yml"; then :; else mv -f api-specs/bandwidth.yml bandwidth.yml; rm -r -f api-specs; echo "generate=true" >> $GITHUB_OUTPUT; fi
- name: Create JIRA Card for SDK Update
if: ${{ steps.compare.outputs.generate == 'true' }}
id: jira
run: |
JIRA_KEY=$(jq -r '.key' <<< $(curl -s -u $JIRA_USERNAME:$JIRA_TOKEN \
-X POST https://bandwidth-jira.atlassian.net/rest/api/2/issue \
-H "Content-Type: application/json" \
--data-binary @- << EOF
{
"fields": {
"project": {
"key": "SWI"
},
"summary": "[$LANGUAGE] Update SDK for New Spec Version",
"description": "Prepare the $LANGUAGE SDK for release based on the latest spec changes.",
"issuetype": {
"name": "Story"
},
"customfield_12108": "$LANGUAGE SDK is ready for release. Tests are created/updated if need be.",
"customfield_10205": "$EPIC",
"components": [{
"name": "Client SDKs"
}]
}
}
EOF
))
echo "jira-key=$JIRA_KEY" >> $GITHUB_OUTPUT
env:
LANGUAGE: Ruby
EPIC: SWI-1876
JIRA_USERNAME: ${{ secrets.JIRA_USERNAME }}
JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }}

- name: Build SDK
id: build
if: ${{ startsWith(steps.jira.outputs.jira-key, 'SWI') }}
uses: Bandwidth/[email protected]
with:
branch-name: ${{ steps.jira.outputs.jira-key }}
token: ${{ secrets.DX_GITHUB_TOKEN }}
openapi-generator-version: 7.0.0
language: ruby
config: ./openapi-config.yml

- name: Setup Ruby
if: steps.build.outputs.changes
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"

- name: Clean SDK
if: steps.build.outputs.changes
run: |
bundle install
rubocop -A
git add .
git commit -m "Clean SDK using Rubocop"
git push origin ${{ steps.jira.outputs.jira-key }}
- name: Open Pull Request
if: steps.build.outputs.changes
run: |
gh pr create -B main -H Bandwidth:${{ steps.jira.outputs.jira-key }} -t '${{ steps.jira.outputs.jira-key }} Update SDK Based on Recent Spec Changes' -b 'Auto-generated by Update SDK Workflow'
env:
GITHUB_TOKEN: ${{ secrets.DX_GITHUB_TOKEN }}

notify-for-failures:
name: Notify for Failures
needs: [update-sdk]
if: failure()
runs-on: ubuntu-latest
steps:
- name: Notify Slack of Failures
uses: Bandwidth/[email protected]
with:
job-status: failure
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ secrets.SLACK_CHANNEL }}
42 changes: 41 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
Gemfile.lock
# Generated by: https://openapi-generator.tech
#

*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

## Specific to RubyMotion:
.dat*
.repl_history
build/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
Gemfile.lock
# .ruby-version
# .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

.DS_Store
4 changes: 0 additions & 4 deletions .gitkeep

This file was deleted.

Loading

0 comments on commit 8c708af

Please sign in to comment.