2021-04-17 04:47:21 +00:00
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
2021-05-07 21:52:28 +00:00
name : build
2021-04-25 22:56:23 +00:00
on : [ push, pull_request ]
2021-04-17 04:47:21 +00:00
jobs :
2021-04-25 22:56:23 +00:00
test :
runs-on : ubuntu-latest
strategy :
matrix :
2024-04-16 07:02:09 +00:00
python-version : [ "3.8" , "3.9" , "3.10" , "3.11" , "3.12" ]
2024-08-08 07:50:19 +00:00
click-version : [ "click~=8.0" ]
2021-04-25 22:56:23 +00:00
steps :
2024-04-16 07:03:35 +00:00
- uses : actions/checkout@v4
2021-04-25 22:56:23 +00:00
- name : Set up Python ${{ matrix.python-version }}
2024-07-11 06:39:33 +00:00
uses : actions/setup-python@v5.1.1
2021-04-25 22:56:23 +00:00
with :
python-version : ${{ matrix.python-version }}
2021-04-17 04:47:21 +00:00
2021-04-25 22:56:23 +00:00
- name : Install dependencies
run : |
python -m pip install --upgrade pip
python -m pip install flake8
2021-05-12 05:21:09 +00:00
python -m pip install ${{ matrix.click-version }}
2021-04-25 22:56:23 +00:00
2021-04-26 05:47:55 +00:00
- name : Install module
run : python -m pip install .
2021-04-25 22:56:23 +00:00
- name : Lint with flake8
run : |
# 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. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
2021-04-25 22:58:38 +00:00
- name : Run unit tests
2021-04-30 06:34:01 +00:00
run : python -m unittest -v
2021-04-25 22:56:23 +00:00
deploy :
2024-08-20 07:28:48 +00:00
# needs: test
2021-04-17 04:47:21 +00:00
runs-on : ubuntu-latest
2024-08-20 07:28:48 +00:00
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
2021-04-17 04:47:21 +00:00
steps :
2024-04-16 07:02:09 +00:00
- uses : actions/checkout@v4
2021-04-17 04:47:21 +00:00
- name : Set up Python
2024-07-11 06:39:33 +00:00
uses : actions/setup-python@v5.1.1
2021-04-17 04:47:21 +00:00
with :
2024-04-16 07:02:09 +00:00
python-version : '>=3.8'
2021-04-17 04:47:21 +00:00
- name : Install dependencies
run : |
python -m pip install --upgrade pip
2021-04-30 06:34:01 +00:00
python -m pip install setuptools wheel twine
2021-04-17 04:47:21 +00:00
- name : Install pypa/build
run : python -m pip install build --user
- name : Build a binary wheel and source tarball
run : python -m build --sdist --wheel --outdir dist/
2024-08-20 07:28:48 +00:00
- name : Get version info
id : yaclog-show
uses : ./
2021-04-30 06:34:01 +00:00
2021-04-17 04:47:21 +00:00
- name : Publish to PyPI
uses : pypa/gh-action-pypi-publish@release/v1
with :
password : ${{ secrets.PYPI_API_TOKEN }}
2021-04-30 06:34:01 +00:00
- name : Publish to Github
2024-04-16 07:02:09 +00:00
uses : softprops/action-gh-release@v2
2021-04-30 06:34:01 +00:00
with :
files : dist/*
2024-08-20 07:28:48 +00:00
name : ${{ steps.yaclog-show.outputs.name }}
body_path : ${{ steps.yaclog-show.outputs.body_file }}
2021-04-30 06:34:01 +00:00
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}