Skip to content

Commit

Permalink
add gh ciworkflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pnowosie committed Jan 2, 2024
1 parent 7f4fe40 commit be151f1
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 6 deletions.
118 changes: 118 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: CI Pipeline

on:
- push

jobs:
format:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4.0.0
with:
python-version: "3.12"

- name: Install tox
run: python -m pip install tox

- name: Run black
run: tox -e format

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4.0.0
with:
python-version: "3.12"

- name: Install tox
run: python -m pip install tox

- name: Run flake8
run: tox -e lint

typecheck:
name: Type check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4.0.0
with:
python-version: "3.12"

- name: Install tox
run: python -m pip install tox

- name: Run mypy
run: python -m tox -e typecheck

test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
python:
- version: "3.12"
toxenv: "py312"
- version: "3.8"
toxenv: "py38"
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4.0.0
with:
python-version: ${{ matrix.python.version }}

- name: Install tox
run: python -m pip install tox

- name: Run pytest
run: tox -e ${{ matrix.python.toxenv }}

build_source_dist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4.0.0
with:
python-version: "3.12"

- name: Install build
run: python -m pip install build

- name: Run build
run: python -m build --sdist

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

publish:
name: Publish package
if: startsWith(github.event.ref, 'refs/tags/v')
needs:
# - format
# - lint
# - typecheck
- test
- build_source_dist
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: ./dist # Update to match root of package

- uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
27 changes: 21 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = pnowosie.ifirma-api
version = 1.3.0
version = 1.3.1
description = iFirma API client.
long_description = file: README.md
long_description_content_type = text/markdown
Expand All @@ -14,11 +14,9 @@ classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: 8
Programming Language :: Python :: 3 :: 9
Programming Language :: Python :: 3 :: 10
Programming Language :: Python :: 3 :: 11
Programming Language :: Python :: 3 :: 12
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3 :: Only
Operating System :: OS Independent
python_requires = >=3.8
Expand Down Expand Up @@ -59,6 +57,8 @@ source =
src/ifirma
*/site-packages/ifirma

[flake8]
max-line-length = 120

[tox:tox]
envlist = py38,py312
Expand All @@ -71,3 +71,18 @@ deps =
# pytest-randomly
commands =
pytest {posargs}

[testenv:format]
skip_install = True
deps =
black
commands =
black {posargs:--check --diff src test}

[testenv:lint]
skip_install = True
deps =
flake8
flake8-bugbear
commands =
flake8 {posargs:src test}

0 comments on commit be151f1

Please sign in to comment.