Skip to content

Commit

Permalink
feat: poetry and python ci actions added.
Browse files Browse the repository at this point in the history
feat: pre-commit added
fix: pre-commit file changes made

Signed-off-by: Onuralp SEZER <thunderbirdtr@fedoraproject.org>
  • Loading branch information
onuralpszr committed Jan 16, 2023
1 parent 796344d commit b5b0701
Show file tree
Hide file tree
Showing 10 changed files with 1,339 additions and 15 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Python version list : https://github.com/actions/python-versions/blob/main/versions-manifest.json
#
name: Python-CI
on: [push, pull_request, workflow_dispatch]
jobs:
ci:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10","3.11.1"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2.6.0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Build the docker-compose stack
run: docker-compose -f docker-compose.yml up -d

- name: Check running containers
run: docker ps -a


- name: Set up a virtual environment for Python ${{ matrix.python-version }}
run: |
python -m pip install --upgrade virtualenv
virtualenv venv
source venv/bin/activate
which python
- name: Install the base dependencies
run: |
source venv/bin/activate
python -m pip install --upgrade poetry
- name: Check the correctness of the project config
run: |
source venv/bin/activate
poetry check
- name: Install the packages
run: |
source venv/bin/activate
poetry install
- name: Check the quality of the code
run: |
source venv/bin/activate
pytest
33 changes: 33 additions & 0 deletions .github/workflows/python-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release to PyPi
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build-n-publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest

steps:
- name: Checkout source
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Build source and wheel distributions
run: |
python -m pip install --upgrade build twine
python -m build
twine check --strict dist/*
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ dist/
.dist/
*.sessions
*.session
*.session-journal
*.session-journal
56 changes: 56 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
exclude: ^logo/
- id: check-toml
- id: check-yaml
args:
- --unsafe
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args:
- --py3-plus
- --keep-runtime-typing
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.216
hooks:
- id: ruff
args:
- --fix
- repo: https://github.com/pycqa/isort
rev: 5.11.4
hooks:
- id: isort
name: isort (python)
- id: isort
name: isort (cython)
types: [cython]
- id: isort
name: isort (pyi)
types: [pyi]
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/PyCQA/bandit
rev: '1.7.4'
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]"]
- repo: https://github.com/PyCQA/autoflake
rev: v2.0.0
hooks:
- id: autoflake

ci:
autofix_commit_msg: fix(pre-commit): 🎨 Auto format from pre-commit.com hooks
autoupdate_commit_msg: dev(pre-commit):⬆ pre-commit autoupdate
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ BulkCopy only uses the initial time of the transaction if your model has a date/
| 1.000.000 | 38.96 | 7.57 |

### Additional
If you need to create your models from a csv file, [django-postgres-copy](https://palewi.re/docs/django-postgres-copy/) could be a better alternative.
If you need to create your models from a csv file, [django-postgres-copy](https://palewi.re/docs/django-postgres-copy/) could be a better alternative.
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
- [ ] Feat: Objects with any type of iterable (like generators) should be accepted.
- [ ] Feat: Make the sequence update an optional operation.
### Completed
- [X] Feat: Update the sequence number after operation.
- [X] Feat: Update the sequence number after operation.
Loading

0 comments on commit b5b0701

Please sign in to comment.