Skip to content

Commit

Permalink
Merge pull request #5 from Bandwidth/SWI-3689
Browse files Browse the repository at this point in the history
SWI-3689 Add Workflows and Issue Template
  • Loading branch information
ckoegel authored Nov 28, 2023
2 parents 2431827 + 0c45900 commit f18329c
Show file tree
Hide file tree
Showing 25 changed files with 668 additions and 665 deletions.
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Bug Report
about: Create a bug report.
title: '[BUG] Description'
labels: 'bug'
---

### Checklist
- [ ] Have you provided a description of the bug?
- [ ] Have you provided your Environment information?
- [ ] Have you provided a sample code snippet?
- [ ] Have you provided a stack trace?
- [ ] Have you outlined the expected behavior?

### Description
<!-- Please provide a clear and concise description of the bug. -->

### Environment Information
<!-- Please provide the version of the OS, SDK, and Environment you are experiencing the bug in. -->
- OS Version: _(e.g. Windows 10)_
- SDK Version: _(e.g. 1.1.0)_
- Environment: _(e.g. Node 18.16.0)_

### Sample Code Snippet
<!-- Please provide a code snippet that produces or is relevant to the bug. -->
```js
# Sample Code Snippet
```

### Stack Trace
<!-- Please provide the stack trace that shows the bug. -->
```shell
# Stack Trace
```

### Expected Behavior
<!-- Please outline the expected behavior of the SDK. -->

### Suggested Fix
<!-- If you have a fix or a suggestion for how this bug may be resolved, describe it here. -->
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Bandwidth Support
url: https://www.bandwidth.com/support/
about: Current customers can create tickets for our Support Team here.
68 changes: 68 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Deploy SDK

on:
release:
types:
- published

jobs:
deploy:
name: Deploy SDK to NPM
runs-on: ubuntu-latest
env:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
BW_USERNAME: ${{ secrets.BW_USERNAME }}
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }}
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }}
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 }}
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: |
RELEASE_VERSION=${GITHUB_REF#refs/tags/v}
if [[ $RELEASE_VERSION =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-(beta|alpha|rc))(\.[0-9][0-9]*)?$ ]]; then
echo "PACKAGE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
else
echo 'Tag does not match expected semver regex pattern (^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-(beta|alpha|rc))(\.[0-9][0-9]*)?$)'
echo $RELEASE_VERSION
echo 'Please update your tag to match the expected regex pattern'
exit 1
fi
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install Packages and Test
run: |
npm i
npm test
- name: Publish npm Package
run: |
npm version $PACKAGE_VERSION --no-git-tag-version
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- uses: Bandwidth/[email protected]
if: always()
with:
job-status: ${{ job.status }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ secrets.SLACK_CHANNEL }}
64 changes: 64 additions & 0 deletions .github/workflows/test-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Test Main Branch Nightly

on:
schedule:
- cron: "0 4 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

env:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
BW_USERNAME: ${{ secrets.BW_USERNAME }}
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }}
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }}
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 }}
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 }}

jobs:
test_main:
name: Test Main Branch Nightly
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
node-version: [16, 18, 20]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: "main"

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install Packages and Test
run: |
yarn
yarn test
env:
OPERATING_SYSTEM: ${{ matrix.os }}

notify_for_failures:
name: Notify for Failures
needs: [test_main]
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 }}
48 changes: 48 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test PR

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

env:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
BW_USERNAME: ${{ secrets.BW_USERNAME }}
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }}
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }}
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 }}
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 }}

jobs:
test_pr:
name: Test PR
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
node-version: [16, 18, 20]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install Packages and Test
run: |
yarn
yarn test
env:
OPERATING_SYSTEM: ${{ matrix.os }}
95 changes: 95 additions & 0 deletions .github/workflows/update-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
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@v4

- 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: Node
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: typescript-axios
config: ./openapi-config.yml

- name: Setup Node
if: steps.build.outputs.changes
uses: actions/setup-node@v4

- 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 }}
2 changes: 1 addition & 1 deletion .openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.1
7.1.0
2 changes: 1 addition & 1 deletion base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class BaseAPI {
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
this.basePath = configuration.basePath ?? basePath;
}
}
};
Expand Down
Loading

0 comments on commit f18329c

Please sign in to comment.