-
Notifications
You must be signed in to change notification settings - Fork 2
263 lines (216 loc) · 9.81 KB
/
installer.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
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
name: Build Installer
on: [push, pull_request]
jobs:
build-installer:
timeout-minutes: 60
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-12, windows-2022]
steps:
- name: Check-out repository
uses: actions/checkout@v3
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Upgrade PIP
run: python -m pip install --upgrade pip
- name: Add extra info to pyproject.toml
run: |
python -m pip install toml
python utils.py --update
- name: Declare env variables on push only
if: github.event_name == 'push'
shell: bash
run: echo "BRANCH_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Declare env variables on pull_request only
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$GITHUB_HEAD_REF" >> $GITHUB_ENV
- name: Declare env variables on push and pull_request
shell: bash
run: |
echo "APP_NAME=$(python utils.py --get release.app_name)" >> $GITHUB_ENV
echo "PACKAGE_NAME=$(python utils.py --get project.name)" >> $GITHUB_ENV
echo "RELEASE_TAG=$(python utils.py --get ci.app.info.release_tag)" >> $GITHUB_ENV
echo "RELEASE_TITLE=$(python utils.py --get ci.app.info.release_title)" >> $GITHUB_ENV
echo "SCRIPTS_PATH=$(python utils.py --get ci.project.subdirs.scripts)" >> $GITHUB_ENV
echo "DISTRIBUTION_PATH=$(python utils.py --get ci.project.subdirs.distribution)" >> $GITHUB_ENV
echo "DOWNLOAD_PATH=$(python utils.py --get ci.project.subdirs.download)" >> $GITHUB_ENV
echo "QTIFW_PATH=$(python utils.py --get ci.qtifw.setup.installation_path.${{ runner.os }})" >> $GITHUB_ENV
echo "PYTHON_PACKAGES_PATH=$(python utils.py --get ci.cache.python_packages_path)" >> $GITHUB_ENV
echo "GIT_INSTALL_URL=git+$GITHUB_SERVER_URL/$GITHUB_REPOSITORY@${{ env.BRANCH_NAME }}" >> $GITHUB_ENV
- name: Install Python dependences
run: |
python -m pip install numpy lmfit numdifftools
python -m pip install lmfit numdifftools
python -m pip install orjson jsbeautifier
python -m pip install pyinstaller requests dephell_licenses
python -m pip install git+https://github.com/ikibalin/cryspy.git@beta
python -m pip install git+https://github.com/easyscience/EasyApp.git@new-easy-app2
python -m pip install git+https://github.com/easyscience/easyDiffractionLib.git@beta
#- name: Create python resources file
# run: pyside6-rcc $GITHUB_REPOSITORY/resources.qrc -o $GITHUB_REPOSITORY/resources.py
#- name: Run pytest (compare app images after previous step)
# run: pytest
- name: Set up screen (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libxcb-xinerama0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xfixes0 libxcb-shape0 libxcb-cursor0
sudo apt-get install libpulse-mainloop-glib0
sudo apt-get install libxkbcommon-x11-0
sudo apt-get install libegl1-mesa
Xvfb :0 -screen 0 1920x1080x24 -ac &
echo "DISPLAY=:0" >> $GITHUB_ENV
# - name: Set up screen (macOS)
# if: runner.os == 'macOS'
# run: |
# "/Library/Application Support/VMware Tools/vmware-resolutionSet" 1920 1080
# system_profiler SPDisplaysDataType | grep Resolution
- name: Set up screen (Windows)
if: runner.os == 'Windows'
run: |
Set-DisplayResolution -Width 1920 -Height 1080 -Force
Get-DisplayResolution
# - name: Run QML GUI tests
# run: |
# cd ${{ env.PACKAGE_NAME }}
# python main.py --testmode
# cd ..
- name: Create freezed python app bundle
run: python ${{ env.SCRIPTS_PATH }}/FreezeApp.py
- name: Create both online and offline app installer from freezed app bundle
run: >
python ${{ env.SCRIPTS_PATH }}/MakeInstaller.py
${{ env.BRANCH_NAME }} ${{ matrix.os }}
- name: Sign offline app installer
if: github.event_name == 'push' && env.BRANCH_NAME == 'master'
run: >
python ${{ env.SCRIPTS_PATH }}/SignAppInstaller.py
${{ env.BRANCH_NAME }} ${{ matrix.os }}
${{ secrets.MACOS_CERTIFICATE_ENCODED }} ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
${{ secrets.APPSTORE_NOTARIZATION_USERNAME }} ${{ secrets.APPSTORE_NOTARIZATION_PASSWORD }}
- name: Create zip archive of offline app installer for distribution
run: >
python ${{ env.SCRIPTS_PATH }}/ZipAppInstaller.py
${{ env.BRANCH_NAME }} ${{ matrix.os }}
- name: Upload zipped offline app installer to GitHub releases (non-master branch)
if: github.event_name == 'push' && env.BRANCH_NAME != 'master'
uses: ncipollo/release-action@v1
with:
draft: true
prerelease: true
allowUpdates: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "${{ env.DISTRIBUTION_PATH }}/*.zip"
tag: ${{ env.BRANCH_NAME }}
name: ${{ env.BRANCH_NAME }}
bodyFile: "RELEASE.md"
- name: Upload zipped offline app installer to GitHub releases (master branch)
if: github.event_name == 'push' && env.BRANCH_NAME == 'master'
uses: ncipollo/release-action@v1
with:
draft: true
prerelease: true
allowUpdates: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "${{ env.DISTRIBUTION_PATH }}/*.zip"
tag: ${{ env.RELEASE_TAG }}
name: ${{ env.RELEASE_TITLE }}
bodyFile: "RELEASE.md"
- name: Upload online app installer to repository via FTP (master branch)
if: github.event_name == 'push' && env.BRANCH_NAME == 'master'
run: >
python ${{ env.SCRIPTS_PATH }}/UploadToFtp.py
${{ env.BRANCH_NAME }} ${{ matrix.os }}
${{ secrets.APP_REPO_FTP_PASSWORD }}
- name: Upload zipped offline app installer for the next job step
uses: actions/upload-artifact@master
with:
name: zipped-app-installer
path: ${{ env.DISTRIBUTION_PATH }}/*.zip
test-installer:
needs: build-installer
timeout-minutes: 15
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-12, windows-2022]
steps:
- name: Check-out repository
uses: actions/checkout@v3
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Upgrade PIP
run: python -m pip install --upgrade pip
- name: Declare env variables on push only
if: github.event_name == 'push'
shell: bash
run: echo "BRANCH_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Declare env variables on pull_request only
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$GITHUB_HEAD_REF" >> $GITHUB_ENV
- name: Add extra info to pyproject.toml
run: |
python -m pip install toml
python utils.py --update
- name: Declare env variables on push and pull_request
shell: bash
run: |
echo "SCRIPTS_PATH=$(python utils.py --get ci.project.subdirs.scripts)" >> $GITHUB_ENV
- name: Install Python dependences
run: |
python -m pip install requests
- name: Set up screen (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libxcb-xinerama0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xfixes0 libxcb-shape0 libxcb-cursor0
sudo apt-get install libpulse-mainloop-glib0
sudo apt-get install libxkbcommon-x11-0
sudo apt-get install libegl1-mesa
Xvfb :0 -screen 0 1920x1080x24 -ac &
echo "DISPLAY=:0" >> $GITHUB_ENV
# - name: Set up screen (macOS)
# if: runner.os == 'macOS'
# run: |
# "/Library/Application Support/VMware Tools/vmware-resolutionSet" 1920 1080
# system_profiler SPDisplaysDataType | grep Resolution
- name: Set up screen (Windows)
if: runner.os == 'Windows'
run: |
Set-DisplayResolution -Width 1920 -Height 1080 -Force
Get-DisplayResolution
- name: Download zipped offline app installer from from the previous job step
uses: actions/download-artifact@master
with:
name: zipped-app-installer
- name: Unzip archive with offline app installer for distribution
run: >
python ${{ env.SCRIPTS_PATH }}/UnzipAppInstaller.py
${{ env.BRANCH_NAME }} ${{ matrix.os }}
- name: Make dir for .desktop file (Linux)
if: runner.os == 'Linux'
run: mkdir -p ~/.local/share/applications/
- name: Install app
run: >
python ${{ env.SCRIPTS_PATH }}/InstallApp.py
${{ env.BRANCH_NAME }} ${{ matrix.os }}
- name: Check app istallation is done
run: python ${{ env.SCRIPTS_PATH }}/CheckAppExists.py
# Windows 2022 - Have to disable because can't see what is going on there...
# macOS 12 - OK
# Ubuntu 20.04 - OK?
# Ubuntu 22.04 - FAILS - ImportError: libpyside6qml.abi3.so.6.5: cannot open shared object file: No such file or directory - https://github.com/pyinstaller/pyinstaller/issues/7197
- name: Run app in testmode and quit (macOS & Linux)
if: runner.os != 'Windows'
run: python ${{ env.SCRIPTS_PATH }}/RunApp.py --testmode