Repository: bcliang/gamry-parser (language: python)

Issue:
Github Action should automatically publish releases
Currently, github actions are used as CI to run linting and unit tests. It would be nice to automate publishing a new release to pypi through similar triggers.

- mirror current build process using setuptools
- build artifacts for each environment that's tested (currently, python 3.5, 3.6, 3.7, 3.8, and 3.9)
- publish sdist and eggs to pypi
Update README.md
Installation, Usage, Development information.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 0000000..9142dfd
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,12 @@
+name: Lint
+on: [push]
+
+jobs:
+  lint:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+      - uses: psf/black@stable
+        with:
+          args: "gamry_parser demo tests --check"
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..136f733
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,42 @@
+name: Publish
+on:
+  release:
+    types: [published]
+  
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - name: Set up Python 3.x
+      uses: actions/setup-python@v2
+      with:
+        python-version: '3.x'
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip wheel setuptools
+    - name: Build package
+      run: |
+        python setup.py sdist bdist_wheel
+    - name: Upload artifact
+      uses: actions/upload-artifact@v2
+      with:
+        name: package-distributions
+        path: dist
+  publish:
+    needs: 
+    - build
+    runs-on: ubuntu-latest
+    steps:
+    - name: Download dists
+      uses: actions/download-artifact@v2
+      with:
+        name: package-distributions
+        path: dist/
+    - name: Publish to PyPi
+      uses: pypa/gh-action-pypi-publish@release/v1
+      with:
+        user: __token__
+        password: ${{ secrets.PYPI_API_TOKEN }}
+        # password: ${{ secrets.TESTPYPI_API_TOKEN }}
+        # repository_url: https://test.pypi.org/legacy/  # testing repo
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b795137..271dfca 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,15 +4,26 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 
 ## [Unreleased]
 
+### Fixed
+- 
+
+### Changed
+- 
+
+### Added
+-
+
+## [0.4.4] - 2021-02-28
+
 ### Fixed
 - [#33](https://github.com/bcliang/gamry-parser/pull/33) Fix pycodestyle errors, make flake8 strict in CI workflow
 - [#35](https://github.com/bcliang/gamry-parser/pull/35) Fix loading data from aborted experiments
 
 ### Changed
--
+- 
 
 ### Added
--
+- [#37](https://github.com/bcliang/gamry-parser/pull/37) Impl: Workflow for automated release deployment
 
 ## [0.4.3] - 2020-05-28
 
diff --git a/README.md b/README.md
index 8289d57..a80f9cb 100644
--- a/README.md
+++ b/README.md
@@ -113,41 +113,29 @@ In the future, it would be nice to add support for things like equivalent circui
 
 #### Changelog
 
-See [`CHANGELOG`](CHANGELOG)
+See [`CHANGELOG`](CHANGELOG.md)
 
 ### Tests
 
+[![Unit Tests](https://github.com/bcliang/gamry-parser/actions/workflows/unittest.yml/badge.svg)](https://github.com/bcliang/gamry-parser/actions/workflows/unittest.yml)
+
 Tests extending `unittest.TestCase` may be found in `/tests/`.
 
+Unit tests are triggered as part of every pull request, but users can run tests locally as well:
+
 ```bash
 $ python setup.py test
 $ coverage run --source=gamry_parser/ setup.py test
 $ coverage report -m
 ```
 
-Latest output:
-
-```bash
-$ coverage report -m
-Name                          Stmts   Miss  Cover   Missing
------------------------------------------------------------
-gamry_parser/__init__.py          7      0   100%
-gamry_parser/chronoa.py          23      0   100%
-gamry_parser/cv.py               17      0   100%
-gamry_parser/eispot.py            6      0   100%
-gamry_parser/gamryparser.py     145      3    98%   131, 234-235
-gamry_parser/ocp.py              32      0   100%
-gamry_parser/version.py           1      0   100%
-gamry_parser/vfp600.py           35      0   100%
------------------------------------------------------------
-TOTAL                           266      3    99%
-```
-
 ### Code Guidelines
 
-* PEP8 via `pylint` or `flake8`
+[![Lint](https://github.com/bcliang/gamry-parser/actions/workflows/lint.yml/badge.svg)](https://github.com/bcliang/gamry-parser/actions/workflows/lint.yml)
+
 * [GitHub flow](https://guides.github.com/introduction/flow/) for proposing changes (i.e. create a feature branch and submit a PR against the master branch).
-* Tests: Maintain > 80% line coverage, per file
+* Coding style: Pycodestyle formatting (PEP8). Linting via `black` is run on each push to github.
+* Tests: maintain > 90% line coverage, per file
 
 ### Versioning
 
@@ -157,6 +145,12 @@ TOTAL                           266      3    99%
 
 ### Publishing
 
+[![Publish](https://github.com/bcliang/gamry-parser/actions/workflows/release.yml/badge.svg)](https://github.com/bcliang/gamry-parser/actions/workflows/release.yml)
+
+The package relies on Github Actions to automatically build and upload artifacts to pypi upon published release. 
+
+#### Manual publishing (deprecated)
+
 Use setuptools to build, twine to publish to pypi.
 
 ```bash
@@ -168,4 +162,4 @@ $ twine upload dist/*
 
 ## License
 
-This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
+This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..8534444
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,3 @@
+[build-system]
+# Minimum requirements for the build system to execute.
+requires = ["setuptools", "wheel"]  # PEP 508 specifications.
\ No newline at end of file


Test patch:
diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/unittest.yml
similarity index 61%
rename from .github/workflows/pythonpackage.yml
rename to .github/workflows/unittest.yml
index 7d81553..49cc578 100644
--- a/.github/workflows/pythonpackage.yml
+++ b/.github/workflows/unittest.yml
@@ -1,11 +1,12 @@
-name: Run Tests on Push
-on: [push]
+name: Unit Tests
+on: [pull_request]
+
 jobs:
-  build:
+  unittest:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        python-version: [3.5, 3.6, 3.7, 3.8]
+        python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
 
     steps:
     - uses: actions/checkout@v2
@@ -17,13 +18,6 @@ jobs:
       run: |
         python -m pip install --upgrade pip
         pip install -r requirements.txt
-    - name: Lint with flake8
-      run: |
-        pip install flake8
-        # stop the build if there are Python syntax errors or undefined names
-        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
-        # exit-zero treats all errors as warnings.
-        flake8 . --count --max-complexity=17 --ignore=E501,W503,F401 --statistics
     - name: Execute unit tests
       run: |
         sudo /usr/share/locales/install-language-pack de_DE.UTF-8