Fixed benchmarking #59
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
name: Build Executable for Multiple Platforms | |
on: | |
push: | |
branches: [ main ] # Trigger on pushes to the main branch | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest, redhat] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
# Set up Python for all platforms | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
# Install dependencies on Ubuntu | |
- name: Install Ubuntu dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
libxkbcommon-x11-0 \ | |
libxcb-shape0 \ | |
libxcb-xfixes0 \ | |
libxcb-icccm4 \ | |
libxcb-image0 \ | |
libxcb-keysyms1 \ | |
libxcb-render-util0 \ | |
libxcb-cursor0 \ | |
libxcb-xkb1 \ | |
libxcb-randr0 \ | |
libxkbcommon0 \ | |
libxcb-render0 \ | |
libxrender1 \ | |
libgl1-mesa-glx \ | |
build-essential \ | |
qtbase5-dev \ | |
qtchooser \ | |
qt5-qmake \ | |
qtbase5-dev-tools | |
- name: Install Rocky Linux 8 dependencies and build | |
if: matrix.os == 'redhat' | |
uses: docker://rockylinux/rockylinux:8 | |
with: | |
args: | | |
/bin/bash -c "\ | |
# Update and install EPEL repository \ | |
dnf install -y epel-release && \ | |
dnf config-manager --set-enabled powertools && \ | |
dnf update -y && \ | |
# Install Development Tools group \ | |
dnf groupinstall -y 'Development Tools' && \ | |
# Install Python 3.8 and pip \ | |
dnf install -y python38 python38-devel python38-pip && \ | |
# Install Qt5 development packages \ | |
dnf install -y qt5-qtbase-devel qt5-qttools-devel && \ | |
# Install missing GTK and XCB dependencies \ | |
dnf install -y xcb-util-cursor gtk3 cairo-gobject && \ | |
# Upgrade pip for Python 3.8 \ | |
python3.8 -m pip install --upgrade pip setuptools && \ | |
# Install Python dependencies \ | |
python3.8 -m pip install -r requirements.txt && \ | |
# Install PyInstaller \ | |
python3.8 -m pip install pyinstaller && \ | |
# Build the executable with PyInstaller \ | |
python3.8 -m PyInstaller --onefile --windowed --name=Sortify --icon=resources/sorticon-256x256.png --add-data 'resources:resources' SortingApp.py && \ | |
# Set permissions for executable \ | |
chmod +x dist/Sortify && \ | |
# Create a tarball to preserve permissions \ | |
tar -czvf dist/Sortify.tar.gz -C dist Sortify" | |
options: --user root | |
# Install dependencies for all platforms except Red Hat using requirements.txt | |
- name: Install Python dependencies | |
if: matrix.os != 'redhat' | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
# Build with PyInstaller for Windows | |
- name: Build with PyInstaller for Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
pyinstaller --onefile --windowed --name=Sortify --icon=resources/sorticon.ico --add-data "resources;resources" SortingApp.py | |
# Build with PyInstaller for macOS | |
- name: Build with PyInstaller for macOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
pyinstaller --onefile --windowed --name=Sortify --icon=resources/sorticon.icns --add-data "resources:resources" SortingApp.py | |
# Build with PyInstaller for Ubuntu | |
- name: Build with PyInstaller for Ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
pyinstaller --onefile --windowed --name=Sortify --icon=resources/sorticon-256x256.png --add-data "resources:resources" SortingApp.py | |
# macOS-specific step to set executable permissions and zip the .app bundle | |
- name: Set permissions and zip .app for macOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
chmod +x dist/Sortify.app/Contents/MacOS/Sortify | |
cd dist | |
zip -r Sortify-macOS.zip Sortify.app | |
# Upload artifacts for macOS (only the zip file) | |
- name: Upload macOS zip | |
if: matrix.os == 'macos-latest' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: executable-macos | |
path: dist/Sortify-macOS.zip | |
# Upload artifacts for other platforms (Windows, Ubuntu, Red Hat) | |
- name: Upload executables | |
if: matrix.os != 'macos-latest' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: executable-${{ matrix.os }} | |
path: dist/* |