Skip to content

Commit

Permalink
chore(test): Setup pytest cases for existing functions (#15)
Browse files Browse the repository at this point in the history
* chore(test): Init .env files

* chore(test): Tests for all existing get functions

* chore(clean): Clean old dir

* chore(ci): Condition on pushing on PyPi
  • Loading branch information
germainlefebvre4 committed Nov 16, 2020
1 parent b051efe commit aa5b886
Show file tree
Hide file tree
Showing 18 changed files with 821 additions and 77 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/release-feat-dryrun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
with:
branches: |
[
'chore/release-pypi'
'chore/pytest'
]
semantic_version: 17.2.2
extra_plugins: |
Expand All @@ -50,6 +50,14 @@ jobs:
mode: set
key: version
value: ${{ steps.semantic.outputs.new_release_version }}
- name: set release_published
id: set_release_published
uses: noobly314/share-data@v1
with:
share-id: release_published
mode: set
key: is_published
value: ${{ steps.semantic.outputs.new_release_published }}


deploy:
Expand All @@ -61,28 +69,38 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: '3.7'

- name: get release_version
id: release_version
uses: noobly314/share-data@v1
with:
share-id: release_version
mode: get
key: version
- name: echo
- name: get release_published
id: release_published
uses: noobly314/share-data@v1
with:
share-id: release_published
mode: get
key: is_published

- name: Update package version
run: |
echo ${{ steps.release_version.outputs.data }}
sed "s/^\( *version=\).*/\1'${{ steps.release_version.outputs.data }}',/g" setup.py
- name: Update package version
run: |
sed -i "s/^\( *version=\).*/\1'${{ steps.release_version.outputs.data }}',/g" setup.py
if: steps.release_published.outputs.data == 'true'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
if: steps.release_published.outputs.data == 'true'
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload --repository testpypi dist/*
if: steps.release_published.outputs.data == 'true'
20 changes: 20 additions & 0 deletions .github/workflows/release-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ jobs:
mode: set
key: version
value: ${{ steps.semantic.outputs.new_release_version }}
- name: set release_published
id: set_release_published
uses: noobly314/share-data@v1
with:
share-id: release_published
mode: set
key: version
value: ${{ steps.semantic.outputs.new_release_published }}

deploy:
needs: release
Expand All @@ -56,24 +64,36 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: '3.7'

- name: get release_version
id: release_version
uses: noobly314/share-data@v1
with:
share-id: release_version
mode: get
key: version
- name: get release_published
id: release_published
uses: noobly314/share-data@v1
with:
share-id: release_published
mode: get
key: version

- name: Update package version
run: |
sed -i "s/^\( *version=\).*/\1'${{ steps.release_version.outputs.data }}',/g" setup.py
if: steps.release_published.outputs.data == 'true'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
if: steps.release_published.outputs.data == 'true'
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
if: steps.release_published.outputs.data == 'true'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var/
*.egg-info/
.installed.cfg
*.egg
Pipfile*

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -78,6 +77,7 @@ celerybeat-schedule

# dotenv
.env
.env.test

# virtualenv
venv/
Expand All @@ -92,3 +92,4 @@ ENV/
# Custom
test.py
gitchangelog.py
.pytest_cache
21 changes: 21 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
libtado = {editable = true, path = "."}
sphinx = "*"
sphinx-rtd-theme = "*"
sphinx-notfound-page = "*"
python-dotenv = "*"
pytest = "*"
pytest-dotenv = "*"
python-dateutil = "*"

[packages]
click = "*"
requests = "*"

[requires]
python_version = "3"
Loading

0 comments on commit aa5b886

Please sign in to comment.