Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWI-6937 Add Smoke Tests for UP Account #135

Merged
merged 2 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 21 additions & 81 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,91 +5,32 @@ on:
types:
- published

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_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
OPERATING_SYSTEM: ubuntu-latest
DOTNET_VERSION: 8.0.x

jobs:
deploy_pre_release:
name: Deploy OpenAPI Generator Client Pre-Release
if: ${{ github.event.release.prerelease && github.event.release.target_commitish == 'feature/openapi-generator-sdk' }}
runs-on: ubuntu-latest
env:
BW_PROJECT_NAME: src/Bandwidth.Standard
BW_PROJECT_TEST_NAME: src/Bandwidth.Standard.Test
steps:
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV

- name: Check Release Tag Format
run: |
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 'Tag does not match expected regex pattern for beta releases (^(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
with:
ref: feature/openapi-generator-sdk

- name: Setup Dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Build SDK
uses: Bandwidth/generate-sdk-action@v4.0.0
with:
openapi-generator-version: 7.7.0
language: csharp
additional-properties: --additional-properties=packageVersion=$RELEASE_VERSION

- name: Run Unit Tests
run: dotnet test src/Bandwidth.Standard.Test --filter DisplayName~Bandwidth.Standard.Test.Unit

- name: Pack NuGet package
run: dotnet pack --configuration Release $BW_PROJECT_NAME -p:PackageVersion=$RELEASE_VERSION

- name: Publish NuGet package
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
NUGET_SOURCE: https://api.nuget.org/v3/index.json
run: dotnet nuget push $BW_PROJECT_NAME/bin/Release/*.nupkg -s $NUGET_SOURCE -k $NUGET_KEY

- name: Notify Slack of build status
uses: Bandwidth/build-notify-slack-action@v2.0.0
if: always()
with:
job-status: ${{ job.status }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ secrets.SLACK_CHANNEL }}

deploy:
name: deploy 'main' branch
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }}
name: Deploy SDK to NuGet
runs-on: ubuntu-latest
env:
BW_PROJECT_NAME: src/Bandwidth.Standard
BW_PROJECT_TEST_NAME: src/Bandwidth.Standard.Test
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_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
OPERATING_SYSTEM: ubuntu-latest
DOTNET_VERSION: 8.0.x

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

- name: Check Release Tag Format
Expand All @@ -109,7 +50,7 @@ jobs:
with:
dotnet-version: '8.0.x'

- name: Build SDK
- name: Generate SDK with Updated Version
uses: Bandwidth/generate-sdk-action@v4.0.0
with:
openapi-generator-version: 7.7.0
Expand All @@ -128,8 +69,7 @@ jobs:
NUGET_SOURCE: https://api.nuget.org/v3/index.json
run: dotnet nuget push $BW_PROJECT_NAME/bin/Release/*.nupkg -s $NUGET_SOURCE -k $NUGET_KEY

- name: Notify Slack of build status
uses: Bandwidth/build-notify-slack-action@v2.0.0
- uses: Bandwidth/build-notify-slack-action@v2.0.0
if: always()
with:
job-status: ${{ job.status }}
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
name: Test PR

on:
pull_request:
branches:
- main
workflow_dispatch:

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

env:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
Expand Down Expand Up @@ -31,7 +35,7 @@ jobs:
dotnet: [6.0.x, 7.0.x, 8.0.x]
fail-fast: false
steps:
- name: Checkout repo
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
Expand Down
60 changes: 46 additions & 14 deletions .github/workflows/test-smoke.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,65 @@
name: Smoke Test
name: Smoke Tests

on:
schedule:
- cron: "0 4 * * *"
pull_request:
branches:
- main
paths:
- "src/Bandwidth.Standard.Test/Smoke/*"
- ".github/workflows/test-smoke.yml"

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 }}
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }}
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }}
USER_NUMBER: ${{ secrets.USER_NUMBER }}
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}

jobs:
test:
name: Smoke Test
runs-on: ubuntu-latest
env:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
BW_NUMBER: ${{ secrets.BW_NUMBER }}
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Run Tests
env:
OPERATING_SYSTEM: ubuntu-latest
DOTNET_VERSION: 8.0.x
run: |
dotnet test src/Bandwidth.Standard.Test --filter DisplayName~Bandwidth.Standard.Test.Smoke

test_up:
name: Smoke Test UP Account
runs-on: ubuntu-latest
env:
BW_ACCOUNT_ID: ${{ secrets.BW_UP_ACCOUNT_ID }}
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_UP_VOICE_APPLICATION_ID }}
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_UP_MESSAGING_APPLICATION_ID }}
BW_NUMBER: ${{ secrets.BW_UP_NUMBER }}
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_UP_ACTIVE_NUMBER }}
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_UP_IDLE_NUMBER }}
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_UP_APPLICATION_ID }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -37,7 +69,7 @@ jobs:
with:
dotnet-version: 8.0.x

- name: Run functional tests
- name: Run Tests
env:
OPERATING_SYSTEM: ubuntu-latest
DOTNET_VERSION: 8.0.x
Expand All @@ -46,7 +78,7 @@ jobs:

notify_for_failures:
name: Notify for failures
needs: [test]
needs: [test, test_up]
if: failure()
runs-on: ubuntu-latest
steps:
Expand Down
Loading