Skip to content

Commit

Permalink
add: Add binaries publisher and unittest workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
Simatwa committed Nov 7, 2024
1 parent 09837ff commit bc74a12
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 5 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/binaries-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

name: Make executables

on:
push:
tags:
- '*'

jobs:
publish:
name: Executables for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: Linux
artifact_upload_name: Linux
asset_name: sqlite-manager-linux-amd64
- os: macos-latest
artifact_name: MacOS
artifact_upload_name: MacOS
asset_name: sqlite-manager-macos-amd64
- os: windows-latest
artifact_name: Windows
artifact_upload_name: Windows.exe
asset_name: sqlite-manager-windows-amd64.exe

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.12'
- name: Install dependencies and python-tgpt
run: |
python -m pip install --upgrade pip pyinstaller pillow
python -m pip install -r requirements.txt
- name: Build executable
run: |
pyinstaller manager.py --onefile --exclude pandas --distpath dist --workpath build --log-level INFO --exclude numpy --exclude matplotlib --exclude PyQt5 --exclude PyQt6 --exclude share --contents-directory . --icon assets/logo.jpeg --noconfirm --name ${{ matrix.artifact_name }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/${{ matrix.artifact_upload_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ github.ref }}
overwrite: true
39 changes: 39 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
push:
branches: [ "master", "main" ]
pull_request:
branches: [ "master", "main" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r requirements.txt
python -m pip install flake8
- 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
- name: Test with Unittest
run: |
python -m tests.py -fv
Binary file added assets/logo.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,11 @@ def find_range(start, end, hms: bool = False):

if not self.disable_coloring:
cmd_prompt = (
f"╭─[`{Fore.CYAN}{getpass.getuser().capitalize()}@{self.db_manager.db_path}]`"
# f"(`{Fore.MAGENTA}{self.get_provider})`"
f"╭─[`{Fore.CYAN}{getpass.getuser().capitalize()}@'localhost']`"
f"(`{Fore.MAGENTA}{self.db_manager.db_path})`"
f"~[`{Fore.LIGHTWHITE_EX}🕒{Fore.BLUE}{current_time}-`"
f"{Fore.LIGHTWHITE_EX}💻{Fore.RED}{find_range(self.__init_time, time.time(), True)}-`"
f"{Fore.LIGHTWHITE_EX}{Fore.YELLOW}{find_range(self.__start_time, self.__end_time)}s]`"
# f"\n╰─>"
)
whitelist = ["[", "]", "~", "-", "(", ")"]
for character in whitelist:
Expand All @@ -172,11 +171,11 @@ def find_range(start, end, hms: bool = False):

else:
return (
f"╭─[{getpass.getuser().capitalize()}@{self.db_manager.db_path}]"
f"╭─[{getpass.getuser().capitalize()}@'localhost']"
f"({self.db_manager.db_path})"
f"~[🕒{current_time}"
f"-💻{find_range(self.__init_time, time.time(), True)}"
f"-⚡{find_range(self.__start_time, self.__end_time)}s]"
# "\n╰─>"
)

def cmdloop(self, intro=None):
Expand Down

0 comments on commit bc74a12

Please sign in to comment.