-
Notifications
You must be signed in to change notification settings - Fork 0
211 lines (176 loc) · 6.87 KB
/
Copy pathpython-app.yml
File metadata and controls
211 lines (176 loc) · 6.87 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: Build AppImage
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
build-x86_64:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Bağımlılıkları kur
run: |
sudo apt-get update -qq
sudo apt-get install -y \
libxcb-xinerama0 libxcb-icccm4 libxcb-image0 \
libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
libxcb-shape0 libxcb-xkb1 libxkbcommon-x11-0 \
libgl1-mesa-glx libegl1 wget libfuse2
- name: Python paketlerini kur
run: |
pip install --upgrade pip
pip install -r requirements.txt pyinstaller
- name: PyInstaller ile derle
run: |
pyinstaller --onedir --windowed --name "CodeTab-AI" \
--add-data "assets:assets" main.py
- name: appimagetool indir
run: |
wget -q https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage \
-O /usr/local/bin/appimagetool
chmod +x /usr/local/bin/appimagetool
- name: AppDir oluştur
run: |
mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/share/applications
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
cp -r dist/CodeTab-AI/* AppDir/usr/bin/
cat > AppDir/codetab-ai.desktop << 'DESK'
[Desktop Entry]
Name=CodeTab AI
Exec=CodeTab-AI
Icon=codetab-ai
Type=Application
Categories=Education;Development;
Terminal=false
DESK
cp AppDir/codetab-ai.desktop AppDir/usr/share/applications/
ln -sf usr/bin/CodeTab-AI AppDir/AppRun
if [ -f assets/icon.png ]; then
cp assets/icon.png AppDir/codetab-ai.png
cp assets/icon.png AppDir/usr/share/icons/hicolor/256x256/apps/codetab-ai.png
else
python3 -c "
import struct, zlib
def png(path):
def c(t,d): return struct.pack('>I',len(d))+t+d+struct.pack('>I',zlib.crc32(t+d)&0xffffffff)
s=256; row=b'\x00'+bytes([30,30,46]*s)
open(path,'wb').write(b'\x89PNG\r\n\x1a\n'+c(b'IHDR',struct.pack('>IIBBBBB',s,s,8,2,0,0,0))+c(b'IDAT',zlib.compress(row*s))+c(b'IEND',b''))
png('AppDir/codetab-ai.png')
png('AppDir/usr/share/icons/hicolor/256x256/apps/codetab-ai.png')
"
fi
- name: AppImage paketle
run: ARCH=x86_64 APPIMAGE_EXTRACT_AND_RUN=1 appimagetool AppDir CodeTab-AI-x86_64.AppImage
- uses: actions/upload-artifact@v4
with:
name: CodeTab-AI-x86_64
path: CodeTab-AI-x86_64.AppImage
build-aarch64:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: QEMU kur
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: aarch64 container içinde derle (PyInstaller)
uses: uraimo/run-on-arch-action@v2
with:
arch: aarch64
distro: ubuntu22.04
githubToken: ${{ github.token }}
install: |
apt-get update -qq
apt-get install -y \
python3 python3-pip python3-pyqt5 \
pyqt5-dev-tools qt5-qmake qtbase5-dev \
libxcb-xinerama0 libxcb-icccm4 libxcb-image0 \
libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
libxcb-shape0 libxcb-xkb1 libxkbcommon-x11-0 \
libgl1-mesa-glx libegl1
run: |
cd ${{ github.workspace }}
pip3 install --upgrade pip
pip3 install "groq>=0.13.0" pyinstaller
python3 -m PyInstaller --onedir --windowed --name "CodeTab-AI" \
--add-data "assets:assets" main.py
- name: AppDir oluştur (host üzerinde)
run: |
mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/share/applications
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
cp -r dist/CodeTab-AI/* AppDir/usr/bin/
cat > AppDir/codetab-ai.desktop << 'DESK'
[Desktop Entry]
Name=CodeTab AI
Exec=CodeTab-AI
Icon=codetab-ai
Type=Application
Categories=Education;Development;
Terminal=false
DESK
cp AppDir/codetab-ai.desktop AppDir/usr/share/applications/
ln -sf usr/bin/CodeTab-AI AppDir/AppRun
if [ -f assets/icon.png ]; then
cp assets/icon.png AppDir/codetab-ai.png
cp assets/icon.png AppDir/usr/share/icons/hicolor/256x256/apps/codetab-ai.png
else
python3 -c "
import struct, zlib
def png(path):
def c(t,d): return struct.pack('>I',len(d))+t+d+struct.pack('>I',zlib.crc32(t+d)&0xffffffff)
s=256; row=b'\x00'+bytes([30,30,46]*s)
open(path,'wb').write(b'\x89PNG\r\n\x1a\n'+c(b'IHDR',struct.pack('>IIBBBBB',s,s,8,2,0,0,0))+c(b'IDAT',zlib.compress(row*s))+c(b'IEND',b''))
png('AppDir/codetab-ai.png')
png('AppDir/usr/share/icons/hicolor/256x256/apps/codetab-ai.png')
"
fi
# DÜZELTME: aarch64 binary yerine x86_64 appimagetool indir, ARCH=aarch64 ile cross-build yap
- name: appimagetool indir
run: |
sudo apt-get install -y libfuse2
wget -q https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage \
-O /usr/local/bin/appimagetool
chmod +x /usr/local/bin/appimagetool
# DÜZELTME: qemu-aarch64-static ile aarch64 binary çalıştırmak yerine
# x86_64 appimagetool'u ARCH=aarch64 env değişkeniyle çalıştır
- name: AppImage paketle (aarch64)
run: |
ARCH=aarch64 APPIMAGE_EXTRACT_AND_RUN=1 \
appimagetool AppDir CodeTab-AI-aarch64.AppImage
- uses: actions/upload-artifact@v4
with:
name: CodeTab-AI-aarch64
path: CodeTab-AI-aarch64.AppImage
release:
needs: [build-x86_64, build-aarch64]
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
name: CodeTab-AI-x86_64
- uses: actions/download-artifact@v4
with:
name: CodeTab-AI-aarch64
- uses: softprops/action-gh-release@v2
with:
name: "CodeTab AI ${{ github.ref_name }}"
body: |
## CodeTab AI ${{ github.ref_name }}
| Mimari | Dosya |
|--------|-------|
| x86_64 | `CodeTab-AI-x86_64.AppImage` |
| aarch64 | `CodeTab-AI-aarch64.AppImage` |
```bash
chmod +x CodeTab-AI-*.AppImage
./CodeTab-AI-*.AppImage
```
files: |
CodeTab-AI-x86_64.AppImage
CodeTab-AI-aarch64.AppImage