npkpy/.github/workflows/cicd.yml
botlabsDev 3d81964135 - refactored code,
- added tests,
- switched to snake_case,
- improved ci/cd pipe,
2020-06-25 16:39:57 +02:00

65 lines
1.7 KiB
YAML

name: CI/CD
on:
push:
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install -e .
- name: Pylint
run: |
pip install pytest pytest-cov codecov
pylint --rcfile=.pylintrc npkpy
- name: Pytest and Coverage
run: |
pip install pytest pytest-cov codecov
pytest --cov=npkpy --cov=acceptance_test
codecov --token=${{ secrets.CODECOV_TOKEN }}
release:
runs-on: ubuntu-latest
needs: tests
if: github.event_name == 'push' && github.ref == 'master'
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install -e .
- name: Build a binary wheel and a source tarball
run: |
python3 setup.py sdist bdist_wheel
- name: Release npkPy to test.pypi.org
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_PASSWORD }}
repository_url: https://test.pypi.org/legacy/
- name: Release npkPy to PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_PASSWORD }}