Skip to content

Commit

Permalink
Merge pull request #18 from dynobo/refactoring
Browse files Browse the repository at this point in the history
Complete rewrite
  • Loading branch information
dynobo committed Apr 3, 2021
2 parents 38f4556 + 452ce9e commit 351bae2
Show file tree
Hide file tree
Showing 63 changed files with 3,143 additions and 1,848 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build
on:
push:
branches:
- master

jobs:
build:
name: Build AppImage on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: abatilo/actions-poetry@v2.1.0
with:
poetry-version: 1.1.5
- name: Install system deps
run: |
sudo apt-get update
sudo apt-get install \
libgirepository1.0-dev \
libcairo2-dev \
python3-gi \
gobject-introspection \
libgtk-3-dev
- name: Poetry install
run: poetry install
- name: Pytest
run: poetry run pytest
- name: Coveralls
run: poetry run coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
- name: Build and publish to PyPi-Test
run: |
poetry config repositories.pypi-test https://test.pypi.org/legacy/
poetry publish \
--build \
--repository=pypi-test \
--username __token__ \
--password ${{ secrets.PYPI_TEST_KEYHINT_TOKEN }}
- name: Build AppImage
run: poetry run make clean-build

# Release
- name: Draft release
uses: softprops/action-gh-release@v1
with:
files: |
linux/*.AppImage
body: See [CHANGELOG](https://github.com/dynobo/kehint/blob/master/CHANGELOG.md) for details.
draft: true
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 0 additions & 31 deletions .github/workflows/coveralls.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish
on:
push:
tags:
- "v*.*.*"
branches:
- master
jobs:
publish:
name: Publish to PyPi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: abatilo/actions-poetry@v2.1.0
with:
poetry-version: 1.1.5
- name: Install system deps
run: |
sudo apt-get update
sudo apt-get install \
libgirepository1.0-dev \
libcairo2-dev \
python3-gi \
gobject-introspection \
libgtk-3-dev
- name: Poetry install
run: poetry install
- name: Pytest
run: poetry run pytest
- name: Build and publish to PyPi
run: |
poetry publish \
--build \
--username __token__ \
--password ${{ secrets.PYPI_KEYHINT_TOKEN }}
93 changes: 29 additions & 64 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,36 @@
name: Test

on:
pull_request:
branches:
- master
on: [push, pull_request]

jobs:
test_linux:
name: Test on Linux64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

# PREPARE
- name: Install Python 3.7
# Because GitHub Actions' python isn't build against tkinter!
run: sudo apt-get update && sudo apt-get install python3.7 python3.7-dev python3.7-tk python3-setuptools

- name: Install dependencies
run: python3.7 -m pip install -r requirements-dev.txt

# LINT
- name: Lint with pylama
run: python3.7 -m pylama

# TEST
- name: Test with pytest
run: xvfb-run --server-args="-screen 0 1024x768x24+32" python3.7 -m pytest

# test_macos:
# name: Test on MacOS
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@master

# # PREPARE
# - name: Install normcap dependencies
# run: brew install pkg-config tesseract-lang
# - name: Install pipenv
# run: python3.7 -m pip install --user pipenv
# - name: Create virtual env
# run: $HOME/Library/Python/3.7/bin/pipenv install --dev
# env:
# CI: true

# # LINT
# - name: Lint with flake8
# run: $HOME/Library/Python/3.7/bin/pipenv run flake8 . --count --show-source --statistics

# # TEST
# - name: Test with pytest
# run: $HOME/Library/Python/3.7/bin/pipenv run python3.7 -m pytest

test_windows:
name: Test on Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@master

# PREPARE
- name: Install dependencies
run: python -m pip install -r requirements-dev.txt

# LINT
- name: Lint with flake8
run: python -m pylama

# TEST
- name: Test with pytest
run: python -m pytest
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: abatilo/actions-poetry@v2.1.0
with:
poetry-version: 1.1.5
- name: Install system deps
run: |
sudo apt-get update
sudo apt-get install \
libgirepository1.0-dev \
libcairo2-dev \
python3-gi \
gobject-introspection \
libgtk-3-dev
- name: Poetry install
run: poetry install
- name: Pylint
run: poetry run pylint ./src
- name: Mypy
run: poetry run mypy ./src
- name: Black
run: poetry run black --check ./src
- name: Isort
run: poetry run isort --check ./src
- name: Pytest
run: poetry run pytest
70 changes: 70 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,76 @@
cheatsheet.jpeg
.venv
.vscode
run.sh
*.*~
keyhint.dist-info/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# OSX useful to ignore
*.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# IntelliJ Idea family of suites
.idea
*.iml
## File-based project format:
*.ipr
*.iws
## mpeltonen/sbt-idea plugin
.idea_modules/

# Briefcase build directories
iOS/
macOS/
windows/
android/
linux/
django/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
49 changes: 49 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# See https://pre-commit.com/ for usage and config
repos:
- repo: local
hooks:
- id: isort
name: isort
stages: [commit]
language: system
entry: poetry run isort
types: [python]

- id: black
name: black
stages: [commit]
language: system
entry: poetry run black
types: [python]

- id: pylint
name: pylint
stages: [commit]
language: system
entry: poetry run pylint ./src
types: [python]
pass_filenames: false

- id: mypy
name: mypy
stages: [commit]
language: system
entry: poetry run mypy
types: [python]
pass_filenames: false

- id: pytest
name: pytest
stages: [commit]
language: system
entry: poetry run pytest
types: [python]
pass_filenames: false

# - id: pytest-cov
# name: pytest
# stages: [push]
# language: system
# entry: pipenv run pytest --cov --cov-fail-under=1
# types: [python]
# pass_filenames: false
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

## v0.2.0 (2021-04-03)

**Changes:**
- Complete rewrite
- Drop support for Windows (for now)
- Use GTK+ framework

## v0.1.3 (2020-10-18)

**Changes:**
- Switch to TKinter
- Speed improvements

## v0.1.0 (2020-05-15)

**Changes:**
- Initial version
4 changes: 0 additions & 4 deletions MANIFEST.in

This file was deleted.

Loading

0 comments on commit 351bae2

Please sign in to comment.