Skip to content

Commit bc74a12

Browse files
committed
add: Add binaries publisher and unittest workflows.
1 parent 09837ff commit bc74a12

File tree

4 files changed

+92
-5
lines changed

4 files changed

+92
-5
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
name: Make executables
3+
4+
on:
5+
push:
6+
tags:
7+
- '*'
8+
9+
jobs:
10+
publish:
11+
name: Executables for ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
include:
16+
- os: ubuntu-latest
17+
artifact_name: Linux
18+
artifact_upload_name: Linux
19+
asset_name: sqlite-manager-linux-amd64
20+
- os: macos-latest
21+
artifact_name: MacOS
22+
artifact_upload_name: MacOS
23+
asset_name: sqlite-manager-macos-amd64
24+
- os: windows-latest
25+
artifact_name: Windows
26+
artifact_upload_name: Windows.exe
27+
asset_name: sqlite-manager-windows-amd64.exe
28+
29+
steps:
30+
- uses: actions/checkout@v3
31+
- name: Set up Python
32+
uses: actions/setup-python@v3
33+
with:
34+
python-version: '3.12'
35+
- name: Install dependencies and python-tgpt
36+
run: |
37+
python -m pip install --upgrade pip pyinstaller pillow
38+
python -m pip install -r requirements.txt
39+
- name: Build executable
40+
run: |
41+
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 }}
42+
- name: Upload binaries to release
43+
uses: svenstaro/upload-release-action@v2
44+
with:
45+
repo_token: ${{ secrets.GITHUB_TOKEN }}
46+
file: dist/${{ matrix.artifact_upload_name }}
47+
asset_name: ${{ matrix.asset_name }}
48+
tag: ${{ github.ref }}
49+
overwrite: true

.github/workflows/python-test.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [ "master", "main" ]
9+
pull_request:
10+
branches: [ "master", "main" ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: ["3.12"]
20+
21+
steps:
22+
- uses: actions/checkout@v3
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v3
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
pip install -r requirements.txt
30+
python -m pip install flake8
31+
- name: Lint with flake8
32+
run: |
33+
# stop the build if there are Python syntax errors or undefined names
34+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37+
- name: Test with Unittest
38+
run: |
39+
python -m tests.py -fv

assets/logo.jpeg

5.96 KB
Loading

manager.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,11 @@ def find_range(start, end, hms: bool = False):
158158

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

173172
else:
174173
return (
175-
f"╭─[{getpass.getuser().capitalize()}@{self.db_manager.db_path}]"
174+
f"╭─[{getpass.getuser().capitalize()}@'localhost']"
175+
f"({self.db_manager.db_path})"
176176
f"~[🕒{current_time}"
177177
f"-💻{find_range(self.__init_time, time.time(), True)}"
178178
f"-⚡{find_range(self.__start_time, self.__end_time)}s]"
179-
# "\n╰─>"
180179
)
181180

182181
def cmdloop(self, intro=None):

0 commit comments

Comments
 (0)