Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating Executable of project #45

Merged
merged 115 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
ea92b07
Creating Executable of project
cortisiko Jul 10, 2024
bf417ab
create multiple executables
cortisiko Jul 10, 2024
cd9d361
fix deploy script
cortisiko Jul 10, 2024
7062303
update script to use
cortisiko Jul 10, 2024
09cfcd9
use if's instead of case
cortisiko Jul 10, 2024
72e8c13
avoid building windows for now
cortisiko Jul 10, 2024
7649d6f
fix syntax
cortisiko Jul 10, 2024
6a07542
fix syntax
cortisiko Jul 10, 2024
ee3950d
enable script again
cortisiko Jul 10, 2024
229b244
remove windows build step
cortisiko Jul 10, 2024
5ba3e59
remove windows build step
cortisiko Jul 10, 2024
23c2f9a
move assets to assets folder
cortisiko Jul 12, 2024
b5ff03f
fix deployment script
cortisiko Jul 12, 2024
6e9aac1
fix deployment dist path
cortisiko Jul 12, 2024
2d5b527
fix deployment dist path again
cortisiko Jul 12, 2024
183821e
fix deployment dist path again
cortisiko Jul 12, 2024
8725336
use v4 of artifact upload
cortisiko Jul 13, 2024
a9040f3
one file
cortisiko Jul 13, 2024
e4964e5
fix name
cortisiko Jul 13, 2024
a1d1be0
fix ui
cortisiko Jul 13, 2024
09dc315
make file executable
cortisiko Jul 13, 2024
0a07142
make file executable
cortisiko Jul 13, 2024
acfe4d9
cd into distrubution folder then run executable
cortisiko Jul 13, 2024
9815de4
cd into distrubution folder then run executable
cortisiko Jul 13, 2024
4746fd6
make app into dmg and .app for unix and linux
cortisiko Jul 14, 2024
974f6f6
remove comment
cortisiko Jul 14, 2024
73f174d
fix deploy script
cortisiko Jul 14, 2024
a84dd9a
fix deploy script
cortisiko Jul 14, 2024
4e20af1
removing double ;
cortisiko Jul 14, 2024
55a91f2
format file
cortisiko Jul 14, 2024
7f69399
format file
cortisiko Jul 14, 2024
602e731
fix import for wget AppImage
cortisiko Jul 14, 2024
2e15586
only mac for now
cortisiko Jul 14, 2024
69d3282
only mac for now
cortisiko Jul 14, 2024
6f6e0d7
fix path and name
cortisiko Jul 14, 2024
e37f671
try running windows
cortisiko Jul 14, 2024
d40dece
try running windows
cortisiko Jul 14, 2024
6290e76
try running windows + fix path
cortisiko Jul 14, 2024
1251312
fix macOS
cortisiko Jul 14, 2024
3bd10ca
fix macOS
cortisiko Jul 14, 2024
e5084a9
fix macOS distribution
cortisiko Jul 14, 2024
8f971a6
fix macOS distribution
cortisiko Jul 14, 2024
ec496f9
set permissions
cortisiko Jul 14, 2024
3519c2d
set permissions and change path
cortisiko Jul 14, 2024
25b082c
set permissions and change path
cortisiko Jul 14, 2024
283978f
mac setting permissions
cortisiko Jul 14, 2024
20d9023
dis
cortisiko Jul 14, 2024
f829807
signing app for mac
cortisiko Jul 16, 2024
fb2801e
UNDO: signing app for mac
cortisiko Jul 16, 2024
3620e53
try uploading just the .dmg
cortisiko Jul 17, 2024
50841b7
enable windows and ubuntu
cortisiko Jul 18, 2024
16eeaae
fix windows build
cortisiko Jul 18, 2024
aebe171
make it work on mac and linux too
cortisiko Jul 18, 2024
d54f98b
making it work on mac and ubuntu
cortisiko Jul 18, 2024
4681bfa
it works. Now change path so executables appear
cortisiko Jul 18, 2024
d54a252
fix mac
cortisiko Jul 18, 2024
01cc44e
fix mac dmg
cortisiko Jul 18, 2024
03e821e
fix ubuntu file extension
cortisiko Jul 18, 2024
455a539
fix ubuntu file extension
cortisiko Jul 18, 2024
929f9cc
create a pre release
cortisiko Jul 20, 2024
fcf6f3f
create artifacts and upload them to release page
cortisiko Jul 20, 2024
7a252d7
fix paths for uploads
cortisiko Jul 20, 2024
e671829
temp on push to main to trigger workflow
cortisiko Jul 20, 2024
9a4f786
make the create github release step succeed
cortisiko Jul 20, 2024
5b3a3e2
fix asset path for mac
cortisiko Jul 20, 2024
1486cb5
fix asset path for mac part 2
cortisiko Jul 20, 2024
c73ab8a
fix asset path for mac part 3
cortisiko Jul 20, 2024
9585a54
debugging where the files are listed
cortisiko Jul 20, 2024
d1301d9
path = asset name
cortisiko Jul 20, 2024
ee85008
seperating the two workflows: one to create release artifacts and the…
cortisiko Jul 20, 2024
328f902
fix dist folder
cortisiko Jul 20, 2024
c0fab78
quick debug
cortisiko Jul 20, 2024
8806bac
quick debug x2
cortisiko Jul 20, 2024
e5f2415
quick debug x3
cortisiko Jul 20, 2024
568cb4a
quick debug x4
cortisiko Jul 20, 2024
8775ec4
condense the yml into one
cortisiko Jul 20, 2024
c4a84ef
trying to use one condensed yml
cortisiko Jul 20, 2024
ccc660c
trying to use one condensed yml
cortisiko Jul 20, 2024
25bf1cc
making it run on all prs as a test
cortisiko Jul 20, 2024
65d1a76
add token
cortisiko Jul 20, 2024
491f228
set proper path for ubuntu and mac
cortisiko Jul 20, 2024
5ffe18b
add logs, set proper path for ubuntu and mac
cortisiko Jul 20, 2024
2557b19
improve logs
cortisiko Jul 20, 2024
7c2ebe4
create build and release
cortisiko Jul 21, 2024
6814ebd
fix path
cortisiko Jul 21, 2024
e5cc982
fix path for uploads
cortisiko Jul 23, 2024
59ce90c
create one release draft with all executables
cortisiko Jul 23, 2024
1d027cf
take two: create one release draft with all executables
cortisiko Jul 23, 2024
51cfada
take three: create one release draft with all executables
cortisiko Jul 23, 2024
f58d806
create tag dynamically and generate change log
cortisiko Jul 24, 2024
0f1de62
hard code tag for now
cortisiko Jul 24, 2024
2e3cfac
use gitchglg
cortisiko Jul 24, 2024
c02c104
revert "use gitchglg"
cortisiko Jul 24, 2024
f26d0e8
rename action
cortisiko Jul 27, 2024
d04acb9
delete old action
cortisiko Jul 27, 2024
32414fe
create release based on tags
cortisiko Jul 28, 2024
ad2f897
fix change log
cortisiko Jul 29, 2024
78c354e
fix sections
cortisiko Jul 29, 2024
6e7bc62
fix sections format
cortisiko Jul 29, 2024
a3663f1
dummy tag
cortisiko Jul 29, 2024
d9d88d2
fix command
cortisiko Jul 29, 2024
74624d4
fix changelog
cortisiko Jul 29, 2024
dc30ee7
fix changelog text
cortisiko Jul 29, 2024
d9a792a
add sections
cortisiko Jul 29, 2024
504f6dd
fix hard coded tag
cortisiko Jul 29, 2024
2275d8a
fix sections
cortisiko Jul 29, 2024
8e1c310
configure section
cortisiko Jul 29, 2024
84d355f
keep the changelog generator simple
cortisiko Aug 3, 2024
cea1f6c
fix mapping
cortisiko Aug 3, 2024
916cc15
fix release name
cortisiko Aug 3, 2024
07cc229
fix release name
cortisiko Aug 3, 2024
6b86b2c
script to build the apps + a changelog template
cortisiko Aug 4, 2024
1faca23
run app builds only when label is applied
cortisiko Aug 4, 2024
dddb8cb
test commit to see if job would rerun after label is applied
cortisiko Aug 4, 2024
0beec83
fix create script to ensure to run when label is applied
cortisiko Aug 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/create-apps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Create executables

on:
pull_request:
types: [labeled]

jobs:
build:
if: contains(github.event.pull_request.labels.*.name, 'create-builds')
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest

runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies (Bash)
if: runner.os != 'Windows'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
pip install yahooquery
pip install tkmacosx
shell: bash

- name: Install dependencies (PowerShell)
if: runner.os == 'Windows'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
pip install yahooquery
pip install tkmacosx
shell: pwsh

- name: Create executable (macOS)
if: matrix.os == 'macos-latest'
run: |
pyinstaller --onefile --noconsole --add-data "assets:assets" user_interface.py
hdiutil create -volname UserInterface -srcfolder dist/ -ov -format UDZO user_interface.dmg
shell: bash

- name: Create executable (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
pyinstaller --onefile --noconsole --add-data "assets:assets" user_interface.py
shell: bash

- name: Create executable (Windows)
if: matrix.os == 'windows-latest'
run: |
pyinstaller --onefile --noconsole --add-data "assets;assets" user_interface.py
shell: pwsh

- name: Upload executable (macOS)
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: user_interface-macOS
path: user_interface.dmg

- name: Upload executable (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: user_interface-Linux
path: dist/user_interface

- name: Upload executable (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: user_interface-Windows
path: dist/user_interface.exe
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: 'Set up Python ${{ matrix.python-version }}'
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
Expand Down
158 changes: 158 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
name: Build and Create Release

on:
push:
# branches:
# - main
# pull_request: null
tags:
- 'v*.*.*'

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies (Bash)
if: runner.os != 'Windows'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
pip install yahooquery
pip install tkmacosx
shell: bash

- name: Install dependencies (PowerShell)
if: runner.os == 'Windows'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
pip install yahooquery
pip install tkmacosx
shell: pwsh

- name: Create executable (macOS)
if: matrix.os == 'macos-latest'
run: |
pyinstaller --onefile --noconsole --add-data "assets:assets" user_interface.py
hdiutil create -volname UserInterface -srcfolder dist/ -ov -format UDZO dist/user_interface.dmg
shell: bash

- name: Create executable (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
pyinstaller --onefile --noconsole --add-data "assets:assets" user_interface.py
shell: bash

- name: Create executable (Windows)
if: matrix.os == 'windows-latest'
run: |
pyinstaller --onefile --noconsole --add-data "assets;assets" user_interface.py
shell: pwsh

- name: Upload artifacts (macOS)
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: user_interface-macOS
path: dist/user_interface.dmg

- name: Upload artifacts (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: user_interface-Linux
path: dist/user_interface

- name: Upload artifacts (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: user_interface-Windows
path: dist/user_interface.exe

release:
needs: build
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download macOS artifact
uses: actions/download-artifact@v4
with:
name: user_interface-macOS
path: ./artifacts/macos

- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: user_interface-Linux
path: ./artifacts/linux

- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: user_interface-Windows
path: ./artifacts/windows

- name: Install Ruby
run: sudo apt-get install ruby-full

- name: Install GitHub Changelog Generator
run: sudo gem install github_changelog_generator

- name: Generate CHANGELOG
run: |
github_changelog_generator -u cortisiko -p stockAnalysis --token ${{ secrets.GITHUB_TOKEN }}

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: {{ github.ref }}
release_name: Release {{ github.ref }}
body_path: CHANGELOG.md
draft: true
prerelease: true

- name: Upload Release Asset (macOS)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/macos/user_interface.dmg
asset_name: user_interface.dmg
asset_content_type: application/octet-stream

- name: Upload Release Asset (Linux)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/linux/user_interface
asset_name: user_interface
asset_content_type: application/octet-stream

- name: Upload Release Asset (Windows)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/windows/user_interface.exe
asset_name: user_interface-Windows.exe
asset_content_type: application/octet-stream
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog


### New Features 🎉

### Infra Changes 🛠

### Tests Changes 🤖

### Bug Fixes 🐛

File renamed without changes
File renamed without changes.
Binary file added assets/charticon2ICO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
13 changes: 11 additions & 2 deletions user_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@

# Add the project root directory to the Python path

sys.path.append(os.path.dirname(os.path.dirname(__file__)))
if getattr(sys, 'frozen', False):
# If running as a PyInstaller bundle
# pylint: disable=protected-access
bundle_dir = sys._MEIPASS
else:
# If running in a normal Python environment
bundle_dir = os.path.abspath(os.path.dirname(__file__))

icon_path = os.path.join(bundle_dir, "assets/charticon2ICO.ico")


class UserInterFace(tk.Tk):
Expand All @@ -31,7 +39,7 @@ def __init__(self):
tk.Tk.__init__(self)
self.window_title = self.title("Stock Analyzer")
container = tk.Frame(self)
self.icon_image = Image.open("app/charticon2ICO.ico")
self.icon_image = Image.open(icon_path)
self.icon_photo = ImageTk.PhotoImage(self.icon_image)

# Set the window icon
Expand Down Expand Up @@ -104,6 +112,7 @@ def on_closing(self):
"""
print("Cleaning up and closing the application...")
self.destroy()
sys.exit(0) # Ensure the application exits


if __name__ == "__main__":
Expand Down