Skip to content

Commit

Permalink
Closes #15
Browse files Browse the repository at this point in the history
Add release pipeline
  • Loading branch information
codeasashu committed Nov 3, 2022
1 parent 101eb14 commit 73f7347
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- name: Cleanup pre-installed tools
run: |
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish Python 📦 to PyPI and TestPyPI
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
release:
types:
- published
jobs:
build-n-publish:
name: Build and publish Python 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9

- name: Build a binary wheel and a source tarball
run: |
pip install --upgrade pip
pip install wheel
python setup.py sdist bdist_wheel
- name: Publish distribution 📦 to Test PyPI
if: github.event_name == 'push'
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: Publish distribution 📦 to PyPI if triggered by release
if: github.event_name == 'release'
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
20 changes: 12 additions & 8 deletions openman/__init__.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
import os
import json
import os

import yaml

from . import parser # noqa
from .errors import OpenmanException
import parser
from .schema_converter import SchemaConvertor
from .schema_converter import SchemaConvertor # noqa


def from_collection(postmanfile=None):
if postmanfile is None:
raise OpenmanException('Empty file is not allowed')
raise OpenmanException("Empty file is not allowed")
if not os.path.isfile(postmanfile):
raise FileNotFoundError("Postman collection not found")
with open(postmanfile, 'r') as f:
with open(postmanfile, "r") as f:
return json.load(f)


def from_ignore(ignorefile=None):
ignoreschema = {}
if not ignorefile:
return ignoreschema
with open(ignorefile, 'r') as f:
with open(ignorefile, "r") as f:
try:
ignoreschema = yaml.safe_load(f)
except yaml.YAMLError as exc:
except yaml.YAMLError:
ignoreschema = json.load(f)
return ignoreschema
return ignoreschema
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def read(fname):
"apispec==3.1.0",
"Click>=7.0",
"jsonpath-rw==1.4.0",
"connexion==2.4.0",
"connexion==2.14.1",
"swagger-ui-bundle==0.0.6",
"Faker==2.0.4",
],
Expand Down

0 comments on commit 73f7347

Please sign in to comment.