Bug #23 fixed #80
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Python package | |
on: | |
# For the manual run. | |
workflow_dispatch: | |
push: | |
branches: [ master, releases ] | |
pull_request: | |
branches: [ master, releases ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 mypy pytest pylint \ | |
types-all types-attrs types-dataclasses types-PyYAML types-typed-ast | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
# - name: MyPy types checking | |
# run: | | |
# mypy --config-file .mypy.ini | |
- name: Lint with pylint | |
run: | | |
pylint -rn -sn --rcfile=.pylintrc --fail-on=I --load-plugins=pylint.extensions.docparams markdown_toolset | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
# TODO: --exit-zero - warnings as errors. | |
flake8 . --config .flake8 --count --show-source --statistics | |
- name: Test with pytest | |
run: | | |
pytest -v tests | |
- name: Install build dependencies | |
run: python -m pip install -U setuptools wheel build | |
- name: Build | |
run: python -m build . | |
# publish: | |
# runs-on: ubuntu-latest | |
# | |
# steps: | |
- name: Create new release | |
id: create_release | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: juitnow/github-action-create-release@v1 | |
env: | |
# This token is provided by Actions. | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
# release_name: Release ${{ github.ref }} | |
# Temporary fix. | |
release_name: Release 0.1.3 | |
body: | | |
Release creating added to CI | |
draft: false | |
prerelease: false | |
- name: Publish package to the PyPI | |
# Already on push in the master branch. | |
# if: startsWith(github.head_ref, 'master') | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
repository_url: https://upload.pypi.org/legacy/ | |
skip_existing: true | |
print_hash: true |