Update README.md #86
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Check, Build and Publish | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'test/**' | |
jobs: | |
code-quality-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install Pipenv and dependencies | |
run: | | |
pip install pipenv | |
pipenv install --dev --deploy | |
- name: Check code formatting with Black | |
run: pipenv run black src/ --check | |
continue-on-error: ${{ github.ref != 'refs/heads/main' }} | |
- name: Sort imports with isort | |
run: pipenv run isort src/ --check-only --verbose --diff | |
continue-on-error: ${{ github.ref != 'refs/heads/main' }} | |
- name: Lint with Flake8 | |
run: pipenv run flake8 src/ --ignore=E501,W503 | |
continue-on-error: ${{ github.ref != 'refs/heads/main' }} | |
- name: Static type check with mypy | |
run: pipenv run mypy src/ --config-file mypy.ini | |
continue-on-error: ${{ github.ref != 'refs/heads/main' }} | |
- name: Check for security issues with bandit | |
run: pipenv run bandit -r src/ | |
continue-on-error: ${{ github.ref != 'refs/heads/main' }} | |
build-and-upload: | |
needs: code-quality-check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install Pipenv and dependencies | |
run: | | |
pip install pipenv | |
pipenv install --dev --deploy | |
- name: Build package | |
run: pipenv run python -m build | |
- name: Upload to TestPyPI | |
if: contains(github.ref, 'refs/heads/test/') | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
- name: Upload to PyPI | |
if: github.ref == 'refs/heads/main' | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |