Skip to content

Commit 43f14ac

Browse files
Merge pull request #98 from Bandwidth/feature/openapi-generator-sdk
SWI-3612 Feature/openapi generator sdk to main
2 parents 488e7a7 + 7a931bd commit 43f14ac

File tree

576 files changed

+86465
-35331
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

576 files changed

+86465
-35331
lines changed

.github/workflows/test-nightly.yml

Lines changed: 0 additions & 88 deletions
This file was deleted.

.github/workflows/test-pr.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Test
2+
on:
3+
# schedule:
4+
# - cron: "0 4 * * *"
5+
pull_request:
6+
branches:
7+
- main
8+
- feature/*
9+
workflow_dispatch:
10+
11+
jobs:
12+
test:
13+
name: Test
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
18+
java-version: ["11", "17", "19"]
19+
distribution: ["zulu", "temurin"]
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
24+
- name: Set up JDK
25+
uses: actions/setup-java@v3
26+
with:
27+
distribution: ${{ matrix.distribution }}
28+
java-version: ${{ matrix.java-version }}
29+
30+
- name: Test
31+
env:
32+
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
33+
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
34+
BW_USERNAME: ${{ secrets.BW_USERNAME }}
35+
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
36+
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
37+
BW_NUMBER: ${{ secrets.BW_NUMBER }}
38+
USER_NUMBER: ${{ secrets.USER_NUMBER }}
39+
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
40+
JAVA_VERSION: ${{ matrix.java-version }}
41+
RUNNER_OS: ${{ matrix.os }}
42+
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }}
43+
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }}
44+
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
45+
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
46+
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
47+
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
48+
OPERATING_SYSTEM: ${{ matrix.os }}
49+
DISTRIBUTION: ${{ matrix.distribution }}
50+
ATT_NUMBER: ${{ secrets.ATT_NUMBER }}
51+
T_MOBILE_NUMBER: ${{ secrets.T_MOBILE_NUMBER }}
52+
VZW_NUMBER: ${{ secrets.VZW_NUMBER }}
53+
run: mvn -B package --file pom.xml
54+
55+
- name: Notify Slack of Failures
56+
uses: Bandwidth/[email protected]
57+
if: failure() && !github.event.pull_request.draft
58+
with:
59+
job-status: ${{ job.status }}
60+
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
61+
slack-channel: ${{ secrets.SLACK_CHANNEL }}

.github/workflows/update-sdk.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Update SDK
2+
3+
on:
4+
schedule:
5+
- cron: "0 14 * * 2"
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-sdk:
10+
name: Update SDK if Necessary
11+
runs-on: ubuntu-latest
12+
outputs:
13+
generate: ${{ steps.compare.outputs.generate }}
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
18+
- name: Combine Product Specs
19+
uses: Bandwidth/[email protected]
20+
with:
21+
token: ${{ secrets.DX_GITHUB_TOKEN }}
22+
23+
- name: Determine if a New SDK is Needed
24+
id: compare
25+
run: |
26+
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
27+
28+
- name: Create JIRA Card for SDK Update
29+
if: ${{ steps.compare.outputs.generate == 'true' }}
30+
id: jira
31+
run: |
32+
JIRA_KEY=$(jq -r '.key' <<< $(curl -s -u $JIRA_USERNAME:$JIRA_TOKEN \
33+
-X POST https://bandwidth-jira.atlassian.net/rest/api/2/issue \
34+
-H "Content-Type: application/json" \
35+
--data-binary @- << EOF
36+
{
37+
"fields": {
38+
"project": {
39+
"key": "SWI"
40+
},
41+
"summary": "[$LANGUAGE] Update SDK for New Spec Version",
42+
"description": "Prepare the $LANGUAGE SDK for release based on the latest spec changes.",
43+
"issuetype": {
44+
"name": "Story"
45+
},
46+
"customfield_12108": "$LANGUAGE SDK is ready for release. Tests are created/updated if need be.",
47+
"customfield_10205": "$EPIC",
48+
"components": [{
49+
"name": "Client SDKs"
50+
}]
51+
}
52+
}
53+
EOF
54+
))
55+
echo "jira-key=$JIRA_KEY" >> $GITHUB_OUTPUT
56+
env:
57+
LANGUAGE: Java
58+
EPIC: SWI-1876
59+
JIRA_USERNAME: ${{ secrets.JIRA_USERNAME }}
60+
JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }}
61+
62+
- name: Build SDK
63+
id: build
64+
if: ${{ startsWith(steps.jira.outputs.jira-key, 'SWI') }}
65+
uses: Bandwidth/[email protected]
66+
with:
67+
branch-name: ${{ steps.jira.outputs.jira-key }}
68+
token: ${{ secrets.DX_GITHUB_TOKEN }}
69+
openapi-generator-version: 7.0.0
70+
language: java
71+
config: ./openapi-config.yml
72+
73+
- name: Setup Java
74+
if: steps.build.outputs.changes
75+
uses: actions/setup-java@v3
76+
with:
77+
java-version: 17
78+
79+
- name: Clean SDK
80+
if: steps.build.outputs.changes
81+
run: |
82+
mvn clean
83+
84+
- name: Open Pull Request
85+
if: steps.build.outputs.changes
86+
run: |
87+
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'
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.DX_GITHUB_TOKEN }}
90+
91+
notify_for_failures:
92+
name: Notify for Failures
93+
needs: [update-sdk]
94+
if: failure()
95+
runs-on: ubuntu-latest
96+
steps:
97+
- name: Notify Slack of Failures
98+
uses: Bandwidth/[email protected]
99+
with:
100+
job-status: failure
101+
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
102+
slack-channel: ${{ secrets.SLACK_CHANNEL }}

.gitignore

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1-
#macOS system files
2-
.DS_Store
1+
*.class
32

4-
#IntelliJ IDE files
5-
.idea
6-
target
3+
# Mobile Tools for Java (J2ME)
4+
.mtj.tmp/
75

8-
#Eclipse IDE files
9-
.classpath
10-
.project
6+
# Package Files #
7+
*.jar
8+
*.war
9+
*.ear
1110

12-
*.iml
13-
*.class
11+
# exclude jar for gradle wrapper
12+
!gradle/wrapper/*.jar
1413

15-
tempsettings.xml
16-
*.bin
17-
*.lock
18-
*.properties
19-
*.prefs
20-
.vscode/settings.json
14+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
15+
hs_err_pid*
16+
17+
# build files
18+
**/target
19+
target
20+
.gradle
21+
build
22+
23+
.DS_Store
24+
.idea

.openapi-generator-ignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
pom.xml
12+
.idea
13+
.gitignore
14+
.github/workflows/maven.yml
15+
16+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
17+
#foo/*/qux
18+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
19+
20+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
21+
#foo/**/qux
22+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
23+
24+
# You can also negate patterns with an exclamation (!).
25+
# For example, you can ignore all files in a docs folder with the file extension .md:
26+
#docs/*.md
27+
# Then explicitly reverse the ignore rule for a single file:
28+
#!docs/README.md

0 commit comments

Comments
 (0)