-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial cx_Freeze config and CI action
Signed-off-by: yshalsager <[email protected]>
- Loading branch information
1 parent
8a7e2c8
commit 94596f5
Showing
4 changed files
with
620 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
name: Package Application with cx_Freeze | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "Version (semantic)" | ||
required: true | ||
default: "X.X" | ||
|
||
jobs: | ||
build-windows: | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
architecture: [ 'x64', 'x86' ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
architecture: ${{ matrix.architecture }} | ||
cache: 'pip' | ||
cache-dependency-path: 'poetry.lock' | ||
- name: Install requirements | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel | ||
(Get-Content pyproject.toml) -replace ', "whisper"', '' | Set-Content pyproject.toml | ||
pip install . | ||
pip install cx-Freeze | ||
- name: Download ffmpeg | ||
run: | | ||
Invoke-WebRequest https://github.com/GyanD/codexffmpeg/releases/download/6.0/ffmpeg-6.0-essentials_build.zip -O ffmpeg.zip | ||
tar.exe -xf ffmpeg.zip | ||
move ffmpeg-6.0-essentials_build/bin/ffmpeg.exe ffmpeg.exe | ||
move ffmpeg-6.0-essentials_build/bin/ffprobe.exe ffprobe.exe | ||
- run: python setup.py build -b dist | ||
- run: tar.exe -acf AlMufarrigh-${{ runner.os }}-${{ matrix.architecture }}-portable.zip dist | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: AlMufarrigh-${{ runner.os }}-${{ matrix.architecture }}-portable | ||
path: AlMufarrigh-${{ runner.os }}-${{ matrix.architecture }}-portable.zip | ||
build-windows-msi: | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
architecture: [ 'x64', 'x86' ] | ||
env: | ||
LANG: C.UTF-8 | ||
LC_ALL: C.UTF-8 | ||
LC_CTYPE: C.UTF-8 | ||
PYTHONIOENCODING: UTF-8 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
architecture: ${{ matrix.architecture }} | ||
cache: 'pip' | ||
cache-dependency-path: 'poetry.lock' | ||
- name: Install requirements | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel | ||
(Get-Content pyproject.toml) -replace ', "whisper"', '' | Set-Content pyproject.toml | ||
pip install . | ||
pip install cx-Freeze | ||
- name: Download ffmpeg | ||
run: | | ||
Invoke-WebRequest https://github.com/GyanD/codexffmpeg/releases/download/6.0/ffmpeg-6.0-essentials_build.zip -O ffmpeg.zip | ||
tar.exe -xf ffmpeg.zip | ||
move ffmpeg-6.0-essentials_build/bin/ffmpeg.exe ffmpeg.exe | ||
move ffmpeg-6.0-essentials_build/bin/ffprobe.exe ffprobe.exe | ||
- run: python setup.py build bdist_msi | ||
# - run: mv 'dist/*.msi' AlMufarrigh-${{ runner.os }}-${{ matrix.architecture }}.msi | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: AlMufarrigh-${{ runner.os }}-${{ matrix.architecture }}.msi | ||
path: 'dist/*.msi' | ||
build-macos-dmg: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
architecture: 'x64' | ||
cache: 'pip' | ||
cache-dependency-path: 'poetry.lock' | ||
- name: Install requirements | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel | ||
sed -i 's/, "whisper"//' pyproject.toml | ||
pip install . | ||
pip install cx-Freeze | ||
- name: Run cx_Freeze | ||
run: python setup.py bdist_dmg | ||
- run: mv 'build/Install*.dmg' AlMufarrigh-macOS.dmg | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: AlMufarrigh-macOS.dmg | ||
path: AlMufarrigh-macOS.dmg | ||
build-macos-app: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
architecture: 'x64' | ||
cache: 'pip' | ||
cache-dependency-path: 'poetry.lock' | ||
- name: Install requirements | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel | ||
sed -i 's/, "whisper"//' pyproject.toml | ||
pip install . | ||
pip install cx-Freeze | ||
- name: Run cx_Freeze | ||
run: python setup.py bdist_mac | ||
- run: mv build/AlMufarrigh.app AlMufarrigh-macOS.app | ||
- run: zip -r9 AlMufarrigh-macOS-app.zip AlMufarrigh-macOS.app/* | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: AlMufarrigh-macOS-app.zip | ||
path: AlMufarrigh-macOS-app.zip | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
architecture: 'x64' | ||
cache: 'pip' | ||
cache-dependency-path: 'poetry.lock' | ||
- name: Install requirements | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel | ||
sed -i 's/, "whisper"//' pyproject.toml | ||
pip install . | ||
pip install cx-Freeze | ||
- name: Run cx_Freeze | ||
run: | | ||
python setup.py build | ||
mv exe.linux-x86_64-3.10 AlMufarrigh-linux-x64 | ||
zip -r9 AlMufarrigh-linux-x64.zip AlMufarrigh-linux-x64/* | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: AlMufarrigh-linux-x64.zip | ||
path: AlMufarrigh-linux-x64.zip | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: [ build-windows, build-windows-msi, build-macos-dmg, build-macos-app, build-linux ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v3 | ||
- name: Display structure of downloaded files | ||
run: ls -R | ||
- name: Release | ||
uses: ncipollo/[email protected] | ||
with: | ||
allowUpdates: true | ||
commit: 'master' | ||
tag: ${{ github.event.inputs.version }} | ||
name: ${{ github.event.inputs.version }} | ||
artifacts: '*/*.msi, */*.zip, */*.dmg' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
"""CX_Freeze setup script for building the application.""" | ||
import sys | ||
from pathlib import Path | ||
|
||
import cx_Freeze | ||
|
||
__version__ = "1.0.6" | ||
base = None | ||
include_files: list[str | tuple[str, str]] = [] | ||
ffmpeg_files: list[str] = ["ffmpeg.exe", "ffprobe.exe"] | ||
|
||
if sys.platform == "win32": | ||
base = "Win32GUI" | ||
for file in ffmpeg_files: | ||
if (Path(__file__).parent / file).exists(): | ||
include_files.append(file) | ||
|
||
includes = ["src"] | ||
excludes = [ | ||
# remove unnecessary modules from the executable to reduce its size | ||
"mypy", | ||
"regex", | ||
"tkinter", | ||
"lib2to3", | ||
"unittest", | ||
"test", | ||
"websockets", | ||
"xmlrpc", | ||
"chardet", | ||
"pyreadline", | ||
"pycparser", | ||
"pydoc_data", | ||
] | ||
|
||
|
||
cx_Freeze.setup( | ||
name="المفرغ Al Mufarrigh", | ||
description="تحويل الملفات الصوتية إلى نصوص بسهولة ومجانًا.", | ||
version=__version__, | ||
executables=[ | ||
cx_Freeze.Executable( | ||
"src/main.py", | ||
base=base, | ||
target_name="المفرغ Al Mufarrigh", | ||
trademarks="Copyright © 2022-2023 almufaragh.com.", | ||
icon="src/resources/images/logo.ico", | ||
shortcut_name="المفرغ", | ||
shortcut_dir="DesktopFolder", | ||
) | ||
], | ||
options={ | ||
"build_exe": { | ||
# "packages": packages, | ||
"includes": includes, | ||
"include_files": include_files, | ||
"include_msvcr": True, | ||
"excludes": excludes, | ||
}, | ||
"bdist_msi": { | ||
"upgrade_code": "{00EF338F-794D-3AB8-8CD6-2B0AB7541021}", | ||
"add_to_path": False, | ||
"initial_target_dir": r"[ProgramFilesFolder]\almufarrigh", | ||
"install_icon": "src/resources/images/logo.ico", | ||
}, | ||
"bdist_mac": { | ||
# "iconfile": "src/resources/images/logo.icns", | ||
"bundle_name": "المفرغ Al Mufarrigh", | ||
}, | ||
"bdist_dmg": { | ||
"volume_label": "Install المفرغ Al Mufarrigh", | ||
"applications_shortcut": True, | ||
}, | ||
}, | ||
) |
Oops, something went wrong.