-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (113 loc) · 4.43 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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 != 'redhat' && matrix.os || 'ubuntu-latest' }}
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
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/*