-
Notifications
You must be signed in to change notification settings - Fork 3
149 lines (143 loc) · 5.33 KB
/
python-app.yml
File metadata and controls
149 lines (143 loc) · 5.33 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
# ---------------------------------------------------------------------------
# File: python-app.yml
# Author: (c) 2024 Jens Kallup - paule32
# All rights reserved
#
# only for education, and non-profit usage !
#
# This workflow will install Python dependencies, run tests and lint with a
# single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# ---------------------------------------------------------------------------
name: PythonObserver
run-name: ${{ github.actor }} Python Observer RC-1
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
Run-Windows:
runs-on: windows-latest
steps:
- name: Build for Windows
uses: actions/checkout@v5
# ------------------------------
# pre-installed Python check ...
# ------------------------------
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: "3.10"
# -----------------------------------
# we use PowerShell under Windows 10:
# -----------------------------------
- name: Check, and Install dependencies ...
shell: pwsh
run: |
$env:MY_WORK_DIR = "${{ github.workspace }}"
D:
cd $env:MY_WORK_DIR\\src
$pythonExe = Get-Command python -ErrorAction Ignore
$pyInstallExe = Get-Command pyInstaller -ErrorAction Ignore
if ($pythonExe) {
Write-Output "Python is installed."
python3 --version
} else {
Write-Output "Python is not installed, try to install it..."
python -m pip install --upgrade pip
pip install flake8 pytest
python3 -m pip install pysqlite3
python3 -m pip install PyQt5
python3 -m pip install PyQt5-sip
python3 -m pip install PyQtWebEngine
python3 -m pip install pywin32
python3 -m pip install pywintypes
python3 -m pip install codecs
}
if ($pyInstallExe) {
Write-Output "pyInstaller is installed."
pyinstaller --version
} else {
pip install pyinstaller
pip install --upgrade pyinstaller
}
Write-Output "Create ByteCode ..."
python3 -m compileall client-windows.py
python3 -m compileall server.py
Write-Output "Create Application ..."
$pyInstallerArgs = "pyInstaller --noconfirm --onefile --console " +
"--icon $env:MY_WORK_DIR\src\_internal\img\floppy-disk.ico " +
"--splash $env:MY_WORK_DIR\src\_internal\img\splash.png " +
"--version-file $env:MY_WORK_DIR\src\version.info " +
" $env:MY_WORK_DIR\src\client-windows.py"
$pyInstallerArgs
dir
# ------------------------------------------------------
# we must upload artifact, before we can download it ...
# ------------------------------------------------------
#- name: Build binary directory ...
# shell: pwsh
# run: |
# $env:MY_WORK_DIR = "${{ github.workspace }}"
# D:
# cd $env:MY_WORK_DIR
# mkdir builds/windows
# dir
#- name: Upload
# uses: actions/upload-artifact@v4
# with:
# path: /builds/windows
# ------------------------------------------------------
# now, we can download the artifact ...
# ------------------------------------------------------
#- name: Download a single artifact
# uses: actions/download-artifact@v4
# with:
# path: /builds/windows
# -----------------------------------
# optimized for Linux - not tested !
# -----------------------------------
Run-Linux:
name: Build for Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: "3.10"
# -----------------------------------
# we use BASH under Linux Ubuntu 22.0
# -----------------------------------
- name: Install dependencies
run: |
MY_WORK_DIR="${{ github.workspace }}"
cd $MY_WORK_DIR/src
python3 --version
pyresult=$?
if [ $pyresult -eq 0 ]; then
echo "Python3 installed"
python -m pip install --upgrade pip
pip install flake8 pytest
python3 -m pip install pysqlite3
python3 -m pip install PyQt5
python3 -m pip install PyQt5-sip
python3 -m pip install PyQtWebEngine
pip install pyinstaller
pip install --upgrade pyinstaller
else
echo "Python3 missing !"
exit 1
fi
echo "Create ByteCode ..."
python3 -m compileall client-linux.py
python3 -m compileall server.py
echo "Create Application ..."
pyinstaller --noconfirm --onefile --console \
--icon $MY_WORK_DIR/src/_internal/img/floppy-disk.ico \
--splash $MY_WORK_DIR/src/_internal/img/splash.png \
--version-file $MY_WORK_DIR/src/version.info \
$MY_WORK_DIR/src/client-linux.py