npkpy/.github/workflows/cicd.yml

68 lines
1.8 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
- name: Publish to codecov
run: |
codecov --token=${{ secrets.CODECOV_TOKEN }}
release:
runs-on: ubuntu-latest
needs: tests
if: (github.event_name == 'push' || github.event_name =='release' )&& github.ref == 'refs/heads/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 }}