Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
102 changes: 102 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Deploy SDK

on:
release:
types:
- published

jobs:
deploy_pre_release:
name: Deploy Client Pre-Release to PYPI
if: ${{ github.event.release.prerelease }}
runs-on: ubuntu-latest
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]+b[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]+b[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: Install Packages
run: |
pip install -r requirements.txt
pip install -r test-requirements.txt

- name: Test
run: |
pytest -v

- name: Deploy to PYPI
run: |
pip install twine
pip install wheel
python setup.py sdist bdist_wheel
twine upload dist/* -u __token__ -p $PYPI_API_KEY
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

- 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` to PYPI
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }}
runs-on: ubuntu-latest
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]+
if ! [[ $RELEASE_VERSION =~ $re ]]; then
echo 'Tag does not match expected regex pattern for beta releases (v[0-9]+.[0-9]+.[0-9]+b[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: Install Packages
run: |-
pip install -r requirements.txt
pip install -r test-requirements.txt

- name: Test
run: |-
pytest -v

- name: Deploy to PYPI
run: |
pip install twine
pip install wheel
python setup.py sdist bdist_wheel
twine upload dist/* -u __token__ -p $PYPI_API_KEY
env:
PYPI_API_KEY: ${{ secrets.PYPI_API_KEY }}

- 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 }}
72 changes: 72 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Test

on:
schedule:
- cron: "0 4 * * *"
pull_request:
workflow_dispatch:
inputs:
logLevel:
description: Log level
required: false
default: WARNING
type: choice
options:
- WARNING
- DEBUG

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

jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-latest]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
fail-fast: false
env:
PYTHON_VERSION: ${{ matrix.python-version }}
OPERATING_SYSTEM: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Packages
run: |
pip install -r requirements.txt
pip install -r test-requirements.txt

- name: Test at Debug Level
if: ${{ inputs.logLevel == 'DEBUG' }}
run: |
echo "Log level: DEBUG"
pytest -v --log-cli-level=DEBUG

- name: Test at Warning Level
if: ${{( inputs.logLevel == null) || ( inputs.logLevel == 'WARNING') }}
run: |
echo "Log level: WARNING"
pytest -v --log-cli-level=WARNING

notify_for_failures:
name: Notify for Failures
needs: [test]
if: failure()
runs-on: ubuntu-latest
steps:
- name: Notify Slack of Failures
uses: Bandwidth/build-notify-slack-action@v2.0.0
with:
job-status: failure
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ secrets.SLACK_CHANNEL }}
76 changes: 76 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# OS
.DS_Store
Thumbs.db

# Python
*.pyc
*.pyo
__pycache__

# Common IDEs
*.swp
.idea/
.pyenv/
.buildpath
.settings
atlassian-ide-plugin.xml
.project
.pydevproject
.installed.cfg
*.sublime-project
*.sublime-workspace
*.ropeproject
*.patch

# Coverage
.coverage
htmlcov/

# Virtualenv
env/
.env/
.env
venv/
.venv/
.venv
p2_7

# Project
/public/

# Settings
settings_local.py
local_settings.py
local.py

# SQLite
*.sqlite*
*.db

# Translations

# Logs
*.log

*.pid

/reports/

# Redis
*.rdb
*.bak

django-colors-formatter

# testing
testing/
local_env.sh
*.egg-info/
.tox/
deprecated/

# Config
config.cfg

# Examples
examples/src
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 bandwidthcom

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading