Skip to content

Commit c5d1ebe

Browse files
authored
Merge pull request #227 from EasyScience/develop
Qt6 to master
2 parents 5c4d19d + b6987ee commit c5d1ebe

File tree

273 files changed

+13071
-2614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

273 files changed

+13071
-2614
lines changed

.github/workflows/installer.yml

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
name: Build Installer
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
pull_request:
8+
branches:
9+
- "**"
10+
11+
jobs:
12+
build-installer:
13+
timeout-minutes: 80
14+
15+
runs-on: ${{ matrix.os }}
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-22.04, ubuntu-24.04, windows-2022, macos-13, macos-14]
21+
22+
steps:
23+
- name: Check-out repository
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Python environment
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: 3.11
30+
31+
- name: Upgrade package installer for Python
32+
run: python -m pip install --upgrade pip
33+
34+
- name: Install Python dependences
35+
run: |
36+
python -m pip install flit
37+
flit install --only-deps # Install the dependencies, but not the EasyReflectometryApp package itself
38+
39+
- name: Add extra info to pyproject.toml
40+
run: python utils.py --update
41+
42+
- name: Declare env variables on push only
43+
if: github.event_name == 'push'
44+
shell: bash
45+
run: echo "BRANCH_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
46+
47+
- name: Declare env variables on pull_request only
48+
if: github.event_name == 'pull_request'
49+
shell: bash
50+
run: echo "BRANCH_NAME=$GITHUB_HEAD_REF" >> $GITHUB_ENV
51+
52+
- name: Declare env variables on push and pull_request
53+
shell: bash
54+
run: |
55+
echo "MATRIX_OS=${{ matrix.os }}" >> $GITHUB_ENV
56+
echo "RUNNER_OS=${{ runner.os }}" >> $GITHUB_ENV
57+
echo "RUNNER_ARCH=${{ runner.arch }}" >> $GITHUB_ENV
58+
echo "TEMP_ARTIFACT_SUFFIX=$(python utils.py --get release.app_name)" >> $GITHUB_ENV
59+
echo "APP_NAME=$(python utils.py --get release.app_name)" >> $GITHUB_ENV
60+
echo "PACKAGE_NAME=$(python utils.py --get project.name)" >> $GITHUB_ENV
61+
echo "PACKAGE_PATH=$GITHUB_WORKSPACE/$(python utils.py --get project.name)" >> $GITHUB_ENV
62+
echo "PACKAGE_VERSION=$(python utils.py --get project.version)" >> $GITHUB_ENV
63+
echo "RELEASE_TAG=$(python utils.py --get ci.app.info.release_tag)" >> $GITHUB_ENV
64+
echo "RELEASE_TITLE=$(python utils.py --get ci.app.info.release_title)" >> $GITHUB_ENV
65+
echo "SCRIPTS_PATH=$(python utils.py --get ci.project.subdirs.scripts)" >> $GITHUB_ENV
66+
echo "DISTRIBUTION_PATH=$(python utils.py --get ci.project.subdirs.distribution)" >> $GITHUB_ENV
67+
echo "DOWNLOAD_PATH=$(python utils.py --get ci.project.subdirs.download)" >> $GITHUB_ENV
68+
echo "QTIFW_PATH=$(python utils.py --get ci.qtifw.setup.installation_path.${{ runner.os }})" >> $GITHUB_ENV
69+
echo "PYTHON_PACKAGES_PATH=$(python utils.py --get ci.cache.python_packages_path)" >> $GITHUB_ENV
70+
echo "GIT_INSTALL_URL=git+$GITHUB_SERVER_URL/$GITHUB_REPOSITORY@${{ env.BRANCH_NAME }}" >> $GITHUB_ENV
71+
72+
- name: Declare dependent env variables on push and pull_request
73+
shell: bash
74+
run: |
75+
echo "SETUP_EXE_PATH=$(python ${{ env.SCRIPTS_PATH }}/Config.py ${{ env.BRANCH_NAME }} ${{ matrix.os }} setup_exe_path)" >> $GITHUB_ENV
76+
77+
- name: Install needed libraries (Linux)
78+
if: runner.os == 'Linux'
79+
run: |
80+
sudo apt-get update
81+
sudo apt-get install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xfixes0 libxcb-shape0 libxcb-cursor0
82+
83+
- name: Create freezed python app bundle with PyInstaller
84+
run: python ${{ env.SCRIPTS_PATH }}/FreezeApp.py
85+
86+
- name: Create offline app installer from freezed app bundle with QtIFW
87+
run: >
88+
python ${{ env.SCRIPTS_PATH }}/MakeInstaller.py
89+
${{ env.BRANCH_NAME }} ${{ matrix.os }}
90+
91+
# - name: Sign, notarize and staple offline app installer (macOS)
92+
# if: |
93+
# runner.os == 'macOS' && github.event_name == 'push' &&
94+
# (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'develop')
95+
# run: >
96+
# python ${{ env.SCRIPTS_PATH }}/SignAppInstaller.py
97+
# ${{ env.BRANCH_NAME }} ${{ matrix.os }}
98+
# ${{ secrets.APPLE_CERT_DATA }} ${{ secrets.APPLE_CERT_PASSWORD }}
99+
# ${{ secrets.APPLE_NOTARY_USER }} ${{ secrets.APPLE_NOTARY_PASSWORD }}
100+
101+
# - name: Sign offline app installer (Windows)
102+
# if: |
103+
# runner.os == 'Windows' && github.event_name == 'push' &&
104+
# (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'develop')
105+
# uses: lando/code-sign-action@v2
106+
# with:
107+
# file: ${{ env.SETUP_EXE_PATH }}
108+
# certificate-data: ${{ secrets.WINDOZE_CERT_DATA }}
109+
# certificate-password: ${{ secrets.WINDOZE_CERT_PASSWORD }}
110+
# keylocker-host: ${{ secrets.KEYLOCKER_HOST }}
111+
# keylocker-api-key: ${{ secrets.KEYLOCKER_API_KEY }}
112+
# keylocker-cert-sha1-hash: ${{ secrets.KEYLOCKER_CERT_SHA1_HASH }}
113+
114+
- name: Create zip archive of offline app installer for distribution
115+
run: >
116+
python ${{ env.SCRIPTS_PATH }}/ZipAppInstaller.py
117+
${{ env.BRANCH_NAME }} ${{ matrix.os }}
118+
119+
- name: Upload double-zipped offline app installer for the next job step
120+
uses: actions/upload-artifact@v4
121+
with:
122+
name: zipped-app-installer_${{ matrix.os }}-${{ runner.arch }} # zip of another zip
123+
path: ${{ env.DISTRIBUTION_PATH }}/*.zip
124+
compression-level: 0 # no compression
125+
if-no-files-found: error
126+
retention-days: 10
127+
128+
- name: Upload zipped offline app installer to GitHub releases (non-master branch)
129+
if: github.event_name == 'push' && env.BRANCH_NAME != 'master'
130+
uses: ncipollo/release-action@v1
131+
with:
132+
draft: true
133+
prerelease: true
134+
allowUpdates: true
135+
replacesArtifacts: true
136+
token: ${{ secrets.GITHUB_TOKEN }}
137+
artifacts: "${{ env.DISTRIBUTION_PATH }}/*.zip"
138+
tag: ${{ env.BRANCH_NAME }}
139+
name: ${{ env.BRANCH_NAME }}
140+
bodyFile: "RELEASE.md"
141+
142+
- name: Upload zipped offline app installer to GitHub releases (master branch)
143+
if: github.event_name == 'push' && env.BRANCH_NAME == 'master'
144+
uses: ncipollo/release-action@v1
145+
with:
146+
draft: true
147+
prerelease: true
148+
allowUpdates: true
149+
replacesArtifacts: true
150+
token: ${{ secrets.GITHUB_TOKEN }}
151+
artifacts: "${{ env.DISTRIBUTION_PATH }}/*.zip"
152+
tag: ${{ env.RELEASE_TAG }}
153+
name: ${{ env.RELEASE_TITLE }}
154+
bodyFile: "RELEASE.md"
155+
156+
157+
test-installer:
158+
needs: build-installer
159+
160+
timeout-minutes: 15
161+
162+
runs-on: ${{ matrix.os }}
163+
164+
strategy:
165+
fail-fast: false
166+
matrix:
167+
os: [ubuntu-22.04, ubuntu-24.04, windows-2022, macos-13, macos-14]
168+
169+
steps:
170+
- name: Check-out repository
171+
uses: actions/checkout@v4
172+
173+
- name: Set up Python environment
174+
uses: actions/setup-python@v5
175+
with:
176+
python-version: 3.11
177+
178+
- name: Upgrade package installer for Python
179+
run: python -m pip install --upgrade pip
180+
181+
- name: Install Python dependences
182+
run: |
183+
python -m pip install toml
184+
python -m pip install requests
185+
186+
- name: Declare env variables on push only
187+
if: github.event_name == 'push'
188+
shell: bash
189+
run: echo "BRANCH_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
190+
191+
- name: Declare env variables on pull_request only
192+
if: github.event_name == 'pull_request'
193+
shell: bash
194+
run: echo "BRANCH_NAME=$GITHUB_HEAD_REF" >> $GITHUB_ENV
195+
196+
- name: Add extra info to pyproject.toml
197+
run: python utils.py --update
198+
199+
- name: Declare env variables on push and pull_request
200+
shell: bash
201+
run: |
202+
echo "SCRIPTS_PATH=$(python utils.py --get ci.project.subdirs.scripts)" >> $GITHUB_ENV
203+
204+
- name: Set up screen (Linux)
205+
if: runner.os == 'Linux'
206+
run: |
207+
sudo apt-get update
208+
sudo apt-get install libxcb-xinerama0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xfixes0 libxcb-shape0 libxcb-cursor0
209+
sudo apt-get install libpulse-mainloop-glib0
210+
sudo apt-get install libxkbcommon-x11-0
211+
sudo apt-get install libegl1-mesa-dev
212+
Xvfb :0 -screen 0 1920x1080x24 -ac &
213+
echo "DISPLAY=:0" >> $GITHUB_ENV
214+
215+
- name: Download zipped offline app installer from from the previous job step
216+
uses: actions/download-artifact@v4
217+
with:
218+
name: zipped-app-installer_${{ matrix.os }}-${{ runner.arch }} # zip of another zip
219+
220+
- name: Unzip archive with offline app installer for distribution
221+
run: >
222+
python ${{ env.SCRIPTS_PATH }}/UnzipAppInstaller.py
223+
${{ env.BRANCH_NAME }} ${{ matrix.os }}
224+
225+
- name: Make dir for .desktop file (Linux)
226+
if: runner.os == 'Linux'
227+
run: mkdir -p ~/.local/share/applications/
228+
229+
- name: Install app
230+
run: >
231+
python ${{ env.SCRIPTS_PATH }}/InstallApp.py
232+
${{ env.BRANCH_NAME }} ${{ matrix.os }}
233+
234+
- name: Check app installation is done
235+
run: python ${{ env.SCRIPTS_PATH }}/CheckAppExists.py
236+
237+
- name: Run app in testmode and quit (macOS & Linux)
238+
if: runner.os != 'Windows' # disabled because it can't exit app and one can't see what is going on there (no GitHub logging)...
239+
run: python ${{ env.SCRIPTS_PATH }}/RunApp.py --testmode

.github/workflows/snapcraft.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Build Snap Image
2+
3+
on:
4+
workflow_dispatch:
5+
# push:
6+
# branches:
7+
# - "**"
8+
# pull_request:
9+
# branches:
10+
# - "**"
11+
12+
jobs:
13+
build_snap:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: snapcore/action-build@v1
18+
id: snapcraft
19+
- uses: actions/upload-artifact@v3
20+
with:
21+
name: snap
22+
path: ${{ steps.snapcraft.outputs.snap }}
23+
24+
install_test:
25+
runs-on: ubuntu-latest
26+
needs: build_snap
27+
steps:
28+
- uses: actions/download-artifact@v3
29+
with:
30+
name: snap
31+
path: .
32+
- name: Install snap
33+
run: |
34+
sudo snap install --dangerous *.snap
35+
- name: Set up screen dependencies (Linux)
36+
run: |
37+
sudo apt-get -o Acquire::Retries=3 update
38+
sudo apt-get -o Acquire::Retries=3 install libxcb-xinerama0
39+
sudo apt-get -o Acquire::Retries=3 install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xfixes0
40+
sudo apt-get -o Acquire::Retries=3 install libpulse-mainloop-glib0
41+
sudo apt-get -o Acquire::Retries=3 install libxkbcommon-x11-0
42+
Xvfb :0 -screen 0 1920x1080x24 -ac &
43+
echo "DISPLAY=:0" >> $GITHUB_ENV
44+
- name: Run snap
45+
run: |
46+
snap run easyreflectometry &
47+
sleep 60
48+
49+
upload_snap:
50+
runs-on: ubuntu-latest
51+
needs: install_test
52+
steps:
53+
- uses: actions/download-artifact@v3
54+
with:
55+
name: snap
56+
path: .
57+
58+
- name: Get branch names
59+
id: branch-name
60+
uses: tj-actions/branch-names@v6
61+
62+
- name: Get snap filename
63+
run: |
64+
echo "SNAP_FILENAME=$(ls *.snap)" >> $GITHUB_ENV
65+
66+
- name: Publish Develop Branch to snapcraft beta
67+
if: steps.branch-name.outputs.current_branch == 'develop'
68+
uses: snapcore/action-publish@v1
69+
env:
70+
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
71+
with:
72+
snap: ${{ env.SNAP_FILENAME }}
73+
release: beta
74+
75+
#- name: Publish Master Branch to snapcraft stable
76+
# if: steps.branch-name.outputs.current_branch == 'master'
77+
# uses: snapcore/action-publish@v1
78+
# env:
79+
# SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
80+
# with:
81+
# snap: ${{ env.SNAP_FILENAME }}
82+
# release: stable

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ settings.ini*
4646
.ci/
4747
.idea/
4848
.vscode/
49+
ci/
4950

5051
#Snap
5152
*.snap

0 commit comments

Comments
 (0)