Skip to content

Commit 6c7340a

Browse files
authored
Merge pull request #4 from RyuCode-Digital-Solution/main
Update AI Commit V1
2 parents 163b8e4 + abe843f commit 6c7340a

13 files changed

Lines changed: 390 additions & 98 deletions

.github/workflows/build.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
create_release:
10+
name: Create Release
11+
runs-on: ubuntu-latest
12+
outputs:
13+
upload_url: ${{ steps.create_release.outputs.upload_url }}
14+
steps:
15+
- name: Create Release
16+
id: create_release
17+
uses: actions/create-release@v1
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
with:
21+
tag_name: v${{ github.run_number }}
22+
release_name: Release v${{ github.run_number }}
23+
draft: false
24+
prerelease: false
25+
26+
build_and_upload:
27+
name: Build and Upload on ${{ matrix.os }}
28+
needs: create_release
29+
runs-on: ${{ matrix.os }}
30+
strategy:
31+
matrix:
32+
os: [ubuntu-latest, windows-latest, macos-latest]
33+
include:
34+
- os: ubuntu-latest
35+
asset_name: ai-commit-linux
36+
asset_path_suffix: AI-Commit
37+
- os: windows-latest
38+
asset_name: ai-commit-windows.exe
39+
asset_path_suffix: AI-Commit.exe
40+
- os: macos-latest
41+
asset_name: ai-commit-macos
42+
asset_path_suffix: AI-Commit
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
47+
- name: Set up Python
48+
uses: actions/setup-python@v5
49+
with:
50+
python-version: 3.10
51+
52+
- name: Install dependencies
53+
run: |
54+
python -m pip install --upgrade pip
55+
pip install -r requirements.txt
56+
57+
- name: Build with PyInstaller
58+
run: pyinstaller --name "AI-Commit" --windowed --onefile --icon="assets/icon.ico" main.py
59+
60+
- name: Upload Release Asset
61+
uses: actions/upload-release-asset@v1
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
with:
65+
upload_url: ${{ needs.create_release.outputs.upload_url }}
66+
asset_path: ./dist/${{ matrix.asset_path_suffix }}
67+
asset_name: ${{ matrix.asset_name }}
68+
asset_content_type: application/octet-stream
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test and Build on PR
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
7+
jobs:
8+
build:
9+
name: Build on ${{ matrix.os }}
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, windows-latest, macos-latest]
14+
python-version: ["3.10"]
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -r requirements.txt
29+
30+
# Placeholder for tests. Uncomment and adapt when have tests.
31+
# - name: Run Tests
32+
# run: |
33+
# pip install pytest
34+
# pytest
35+
36+
- name: Build with PyInstaller
37+
run: pyinstaller --name "AI-Commit" --windowed --onefile --icon="assets/icon.ico" main.py
38+
39+
- name: Upload Artifact
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: AI-Commit-${{ matrix.os }}
43+
path: dist/

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@ src/__pycache__
22
src/core/__pycache__
33
src/gui/__pycache__
44
src/utils/__pycache__
5+
venv
56
build
6-
AI-Commit.spec
7+
dist
8+
*.spec

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.5.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
12+
- repo: https://github.com/psf/black
13+
rev: 24.4.2
14+
hooks:
15+
- id: black
16+
17+
- repo: https://github.com/astral-sh/ruff-pre-commit
18+
rev: v0.4.4
19+
hooks:
20+
- id: ruff
21+
args: [--fix, --exit-non-zero-on-fix]

dist/AI-Commit.exe

-96.7 MB
Binary file not shown.

requirements.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
google-generativeai>=0.3.0
22
openai>=1.0.0
3-
pathlib2>=2.3.0; python_version < '3.4'
3+
pathlib2>=2.3.0; python_version < '3.4'
4+
pyinstaller>=5.0.0
5+
pre-commit>=3.0.0
6+
ruff>=0.1.0
7+
black>=23.0.0
8+
Pillow>=10.0.0

scripts/ai-commit.desktop

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Desktop Entry]
2+
Name=AI-Commit
3+
Comment=Generate commit messages with AI
4+
Exec=/usr/local/bin/ai-commit
5+
Icon=ai-commit
6+
Terminal=false
7+
Type=Application
8+
Categories=Development;

scripts/build.bat

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@echo off
2+
setlocal
3+
4+
echo --- Starting Windows build process ---
5+
6+
:: 1. Create & activate virtual environment
7+
echo --- Setting up Python virtual environment ---
8+
if not exist venv ( py -m venv venv )
9+
call venv\Scripts\activate
10+
11+
:: 2. Install dependencies
12+
echo --- Installing dependencies from requirements.txt ---
13+
pip install -r requirements.txt
14+
15+
:: 3. Run PyInstaller
16+
echo --- Building executable with PyInstaller ---
17+
pyinstaller --name "AI-Commit" --windowed --onefile --icon="assets/icon.ico" main.py
18+
19+
echo --- Executable build complete! ---
20+
echo Executable created in the 'dist' folder.
21+
echo.
22+
echo To create the Windows installer (.exe), install Inno Setup from https://jrsoftware.org/isinfo.php
23+
echo then right-click and 'Compile' the 'scripts/installer.iss' file.
24+
25+
endlocal
26+
pause

scripts/build.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
# Script to create the AICommit installer for Linux
3+
# Exit on error
4+
set -e
5+
6+
echo "--- Starting Linux build process ---"
7+
8+
# 1. Create & activate virtual environment
9+
echo "--- Setting up Python virtual environment ---"
10+
python3 -m venv venv
11+
source venv/bin/activate
12+
13+
# 2. Install dependencies
14+
echo "--- Installing dependencies from requirements.txt ---"
15+
pip install -r requirements.txt
16+
17+
# 3. Run PyInstaller
18+
echo "--- Building executable with PyInstaller ---"
19+
pyinstaller --name "AICommit" --windowed --onefile --icon="assets/icon.ico" main.py
20+
21+
# 4. Prepare installer package
22+
echo "--- Creating Linux installer package ---"
23+
INSTALLER_DIR="AICommit-linux-installer"
24+
rm -rf $INSTALLER_DIR
25+
mkdir -p $INSTALLER_DIR/usr/local/bin
26+
mkdir -p $INSTALLER_DIR/usr/share/applications
27+
mkdir -p $INSTALLER_DIR/usr/share/icons/hicolor/256x256/apps
28+
29+
# Copy necessary files
30+
cp dist/AICommit $INSTALLER_DIR/usr/local/bin/AICommit
31+
cp assets/icon.png $INSTALLER_DIR/usr/share/icons/hicolor/256x256/apps/AICommit.png
32+
cp scripts/AICommit.desktop $INSTALLER_DIR/usr/share/applications/
33+
34+
# Create the installation script
35+
cat > $INSTALLER_DIR/install.sh <<EOL
36+
#!/bin/bash
37+
echo "Installing AICommit..."
38+
sudo cp -r usr /
39+
echo "Updating icon cache..."
40+
sudo gtk-update-icon-cache /usr/share/icons/hicolor || echo "Failed to update icon cache."
41+
echo "Installation complete. Run 'AICommit' from your terminal or find it in your applications menu."
42+
EOL
43+
chmod +x $INSTALLER_DIR/install.sh
44+
45+
# Create the tar.gz archive
46+
TARBALL_NAME="AICommit-Linux-Installer.tar.gz"
47+
echo "--- Packaging installer into $TARBALL_NAME ---"
48+
tar -czvf $TARBALL_NAME -C $INSTALLER_DIR .
49+
50+
echo "--- Build complete! ---"
51+
echo "Installer created: $TARBALL_NAME"
52+
echo "To install, extract the archive and run './install.sh'"

scripts/installer.iss

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
; Inno Setup script, generated by AI
2+
3+
#define MyAppName "AI-Commit"
4+
#define MyAppVersion "1.0.0"
5+
#define MyAppPublisher "Ryucode"
6+
#define MyAppURL "https://github.com/RyuCode-Digital-Solution/AI-Commit"
7+
#define MyAppExeName "AI-Commit.exe"
8+
9+
[Setup]
10+
AppId={{AUTO}}
11+
AppName={#MyAppName}
12+
AppVersion={#MyAppVersion}
13+
AppPublisher={#MyAppPublisher}
14+
AppPublisherURL={#MyAppURL}
15+
AppSupportURL={#MyAppURL}
16+
AppUpdatesURL={#MyAppURL}
17+
DefaultDirName={autopf}\{#MyAppName}
18+
DisableProgramGroupPage=yes
19+
OutputDir=..\installers ; Save installer to 'installers' folder in project root
20+
OutputBaseFilename=AI-Commit-Setup
21+
Compression=lzma
22+
SolidCompression=yes
23+
WizardStyle=modern
24+
IconFile=..\assets\icon.ico
25+
26+
[Languages]
27+
Name: "english"; MessagesFile: "compiler:Default.isl"
28+
29+
[Tasks]
30+
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
31+
32+
[Files]
33+
Source: "..\dist\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
34+
Source: "..\assets\icon.ico"; DestDir: "{app}";
35+
36+
[Icons]
37+
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
38+
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
39+
40+
[Run]
41+
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

0 commit comments

Comments
 (0)