Skip to content

Commit a87f4f0

Browse files
committed
Updated all the files 🔥
1 parent c1140c1 commit a87f4f0

File tree

5 files changed

+132
-12
lines changed

5 files changed

+132
-12
lines changed

.github/workflows/python-publish.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
push:
13+
tags:
14+
- 'v*'
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set up Python
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: '3.x'
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install build
28+
- name: Build package
29+
run: python -m build
30+
- if: ${{failure()}}
31+
name: Create Issues
32+
uses: nashmaniac/create-issue-action@v1.1
33+
with:
34+
title: Build Failed for uploading package
35+
token: ${{secrets.GITHUB_TOKEN}}
36+
assignees: ${{github.actor}}
37+
labels: worflow-failed
38+
body: Workflow failed for commit ${{github.sha}} @ ${{github.ref}}
39+
deploy_to_pypi:
40+
needs: build
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v2
44+
- name: Set up Python
45+
uses: actions/setup-python@v2
46+
with:
47+
python-version: '3.10'
48+
- name: Install dependencies
49+
run: |
50+
python -m pip install --upgrade pip
51+
pip install setuptools wheel twine tomli
52+
pip install -r requirements.txt --upgrade
53+
pip install build
54+
python -m pip install --upgrade build
55+
- name: Publish a project to PyPi
56+
run: |
57+
python -m build
58+
twine upload dist/* -u __token__ -p ${{ secrets.PYPI_API_TOKEN}}
59+
release:
60+
runs-on: ubuntu-latest
61+
needs: deploy_to_pypi
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
steps:
65+
- name: Checkout code
66+
uses: actions/checkout@v2
67+
with:
68+
fetch-depth: 0
69+
- name: Set environment variables for version number
70+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
71+
- name: Changelog
72+
uses: Bullrich/generate-release-changelog@master
73+
id: Changelog
74+
env:
75+
REPO: ${{ github.repository }}
76+
- name: ✏️ Generate release changelog
77+
uses: heinrichreimer/github-changelog-generator-action@v2.3
78+
with:
79+
token: ${{ secrets.GITHUB_TOKEN }}
80+
output: /CHANGELOG.md
81+
- name: Create Release
82+
id: create_release
83+
uses: actions/create-release@latest
84+
env:
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
with:
87+
tag_name: ${{ env.RELEASE_VERSION }}
88+
release_name: Release ${{ env.RELEASE_VERSION }}
89+
body: |
90+
${{ steps.Changelog.outputs.changelog }}
91+
draft: false
92+
prerelease: false
93+

.github/workflows/python-test.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
name: Python CI/CD
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'release/**'
8+
pull_request:
9+
branches:
10+
- main
11+
- 'release/**'
12+
jobs:
13+
build:
14+
name: Python Program Quality Control
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Set up Python 3.8
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: "3.8"
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install -r requirements.txt
26+
- name: Running unit test
27+
run: |
28+
python -m unittest discover test -p '*Test.py'
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
import pdb
2-
31
import yaml
42

53

4+
def read_yaml(path) -> {}:
5+
config = {}
6+
with open(path) as file:
7+
try:
8+
config = yaml.safe_load(file)
9+
except yaml.YAMLError as exc:
10+
print(exc)
11+
return config
12+
13+
614
class Yaml:
715

816
def __init__(self, path):
917
super(Yaml, self).__init__()
10-
self.config = self.readYaml(path)
18+
self.config = read_yaml(path)
1119

1220
def value(self, value: str):
1321
def fun(f):
@@ -18,12 +26,3 @@ def fun(f):
1826
return r_value
1927

2028
return fun
21-
22-
def readYaml(self, path) -> {}:
23-
config = {}
24-
with open(path) as file:
25-
try:
26-
config = yaml.safe_load(file)
27-
except yaml.YAMLError as exc:
28-
print(exc)
29-
return config

src/Yaml8/__init__.py

Whitespace-only changes.

src/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)