Skip to content

Commit

Permalink
SWI-3338 Update SDK for GA (#109)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ckoegel authored Aug 30, 2023
1 parent 295e19d commit 4b6b52a
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 27 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
deploy:
name: Deploy SDK to Rubygems # TODO: Decide on putting env vars in vault after we decide on mocking integration tests
name: Deploy SDK to Rubygems
runs-on: ubuntu-latest
env:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
Expand Down Expand Up @@ -36,7 +36,7 @@ jobs:
if [[ $RELEASE_VERSION =~ $re ]]; then
echo "GEM_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
else
echo "Tag does not match expected regex pattern for beta releases (v$re)"
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
Expand All @@ -50,6 +50,9 @@ jobs:
with:
ruby-version: "3.0"

- 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
Expand Down
37 changes: 21 additions & 16 deletions .github/workflows/update-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,17 @@ on:
jobs:
update-sdk:
name: Update SDK if Necessary
runs-on: ${{ fromJSON(vars.SWI_GLORG_UBUNTU_2204) }}
runs-on: ubuntu-latest
outputs:
generate: ${{ steps.compare.outputs.generate }}
permissions:
id-token: write
contents: write
steps:
- name: Get Github and Jira Tokens from Vault
uses: Bandwidth/vault-provider-action@v1
with:
secrets: |
workloads/prod/software_infra::secrets:dx-github-token:dx-github-token@1::DX_GITHUB_TOKEN
workloads/prod/software_infra::secrets:SDLC-Enforcer-Prod:JIRA_TOKEN@9::JIRA_TOKEN
workloads/prod/software_infra::secrets:SDLC-Enforcer-Prod:JIRA_USERNAME@9::JIRA_USERNAME
- name: Checkout
uses: actions/checkout@v3

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

- name: Determine if a New SDK is Needed
id: compare
Expand All @@ -55,7 +44,7 @@ jobs:
"name": "Story"
},
"customfield_12108": "$LANGUAGE SDK is ready for release. Tests are created/updated if need be.",
"customfield_10205": "SWI-1876",
"customfield_10205": "$EPIC",
"components": [{
"name": "Client SDKs"
}]
Expand All @@ -66,14 +55,17 @@ jobs:
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: ${{ env.DX_GITHUB_TOKEN }}
token: ${{ secrets.DX_GITHUB_TOKEN }}
openapi-generator-version: 7.0.0
language: ruby
config: ./openapi-config.yml
Expand All @@ -100,4 +92,17 @@ jobs:
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: ${{ env.DX_GITHUB_TOKEN }}
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 }}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

Bandwidth - the Ruby gem for the Bandwidth

# Generated with the command:
`openapi-generator generate -g ruby -i bandwidth.yml -c openapi-config.yml -o ./`

Bandwidth's Communication APIs

This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
Expand Down
3 changes: 3 additions & 0 deletions custom_templates/README.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

{{moduleName}} - the Ruby gem for the {{appName}}

# Generated with the command:
`openapi-generator generate -g ruby -i bandwidth.yml -c openapi-config.yml -o ./`

{{#appDescriptionWithNewLines}}
{{{.}}}
{{/appDescriptionWithNewLines}}
Expand Down
7 changes: 0 additions & 7 deletions custom_templates/version.mustache

This file was deleted.

2 changes: 1 addition & 1 deletion lib/bandwidth-sdk/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
=end

module Bandwidth
VERSION = ENV.fetch('GEM_VERSION')
VERSION = '11.0.0'
end
2 changes: 1 addition & 1 deletion spec/integration/calls_api_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
expect(data.call_id).to eq($call_info_id)
expect(data.account_id).to eq(BW_ACCOUNT_ID)
expect(data.application_id).to eq(BW_VOICE_APPLICATION_ID)
expect(data.start_time).to be_instance_of(Time)
expect(data.start_time).to be_instance_of(Time).or be_nil
expect(data.last_update).to be_instance_of(Time)
expect(data.state).to be_instance_of(String)
expect(data.direction).to eq(direction)
Expand Down

0 comments on commit 4b6b52a

Please sign in to comment.