From 8a99c98a69afd918feb20ea199421659aeabf159 Mon Sep 17 00:00:00 2001 From: Shashank Reddy Boyapally Date: Mon, 15 Jan 2024 17:54:53 -0500 Subject: [PATCH] added publish workflow --- .github/workflows/publish.yml | 35 +++++++++++++++++++++++++++++++++++ fmatch/matcher.py | 16 ++++++++-------- fmatch/test_fmatch.py | 5 ++++- setup.py | 2 +- 4 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0396afb --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,35 @@ +name: Publish to PyPI + +on: + release: + types: + - created + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.x + pip-options: '--upgrade setuptools wheel' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools + pip install build + pip install twine + + - name: Build and publish + run: | + python -m build + python -m twine upload -r pypi dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} diff --git a/fmatch/matcher.py b/fmatch/matcher.py index 411df19..551d6f0 100644 --- a/fmatch/matcher.py +++ b/fmatch/matcher.py @@ -22,7 +22,7 @@ class Matcher: def __init__(self, index="perf_scale_ci", level=logging.INFO): self.index = index self.es_url = ES_URL - self.searchSize = 10000 + self.search_size = 10000 self.logger = logging.getLogger("Matcher") self.logger.setLevel(level) handler = logging.StreamHandler(sys.stdout) @@ -94,7 +94,7 @@ def get_uuid_by_metadata(self, meta, index=None): ] } }, - "size": self.searchSize + "size": self.search_size } result = self.query_index(index, query) hits = result.get('hits', {}).get('hits', []) @@ -117,7 +117,7 @@ def match_k8s_netperf(self, uuids): ) } }, - "size": self.searchSize + "size": self.search_size } result = self.query_index(index, query) runs = [item['_source'] for item in result["hits"]["hits"]] @@ -141,7 +141,7 @@ def match_kube_burner(self, uuids): ) } }, - "size": self.searchSize + "size": self.search_size } result = self.query_index(index, query) runs = [item['_source'] for item in result["hits"]["hits"]] @@ -189,7 +189,7 @@ def burner_results(self, uuid, uuids, index): ) } }, - "size": self.searchSize + "size": self.search_size } result = self.query_index(index, query) runs = [item['_source'] for item in result["hits"]["hits"]] @@ -210,7 +210,7 @@ def burner_cpu_results(self, uuids, namespace, index): "time": { "terms": { "field": "uuid.keyword", - "size": self.searchSize + "size": self.search_size }, "aggs": { "time": { @@ -222,7 +222,7 @@ def burner_cpu_results(self, uuids, namespace, index): "uuid": { "terms": { "field": "uuid.keyword", - "size": self.searchSize + "size": self.search_size }, "aggs": { "cpu": { @@ -246,7 +246,7 @@ def burner_cpu_results(self, uuids, namespace, index): }] } }, - "size": self.searchSize + "size": self.search_size } runs = self.query_index(index, query) data = self.parse_burner_cpu_results(runs) diff --git a/fmatch/test_fmatch.py b/fmatch/test_fmatch.py index 985c338..f181959 100644 --- a/fmatch/test_fmatch.py +++ b/fmatch/test_fmatch.py @@ -19,6 +19,9 @@ meta['jobStatus'] = "success" meta['ocpVersion'] = '4.15' meta['networkType'] = "OVNKubernetes" +meta['encrypted'] = "true" +meta['ipsec'] = "false" +meta['fips'] = "false" uuids = match.get_uuid_by_metadata(meta) if len(uuids) == 0: @@ -49,4 +52,4 @@ # Check merged csv data - Debug for i in ls: # Debug - Ensure they are all using the same networkType - print(match.get_metadata_by_uuid(i)["networkType"]) + print(match.get_metadata_by_uuid(i)['networkType']) diff --git a/setup.py b/setup.py index fd5e0a2..99cfe47 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup, find_packages -VERSION = '0.0.1' +VERSION = '0.0.2' DESCRIPTION = 'Common package for matching runs with provided metadata' # pylint: disable= line-too-long LONG_DESCRIPTION = "A package that allows to match metadata and get runs and create csv files with queried metrics"