-
Notifications
You must be signed in to change notification settings - Fork 1
738 lines (735 loc) · 32.9 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
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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
name: Build
on:
push:
branches: [ master ]
tags: '*'
pull_request:
branches: [ master ]
env:
tool-id: nionswift-tool
tool-package: nionswift
tool-exe: nionswift --app
jobs:
build_linux:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
python-version: ["3.11", "3.12", "3.13"]
qt-version: ["6.8.0"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -c "import sys; print(sys.executable)"
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt-version }}
host: 'linux'
target: 'desktop'
arch: 'linux_gcc_64'
- name: Build
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install setuptools --upgrade
python -m pip install packaging build cibuildwheel
pushd launcher
PYTHON=`python -c "import sys; print(sys.executable, end='')"`
cmake CMakeLists.txt -DPython3_EXECUTABLE="$PYTHON"
cmake --build . --config Release
mkdir -p linux
mv build linux/x64
popd
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libQt6Core.so.6 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libQt6DBus.so.6 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libQt6Gui.so.6 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libQt6OpenGL.so.6 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libQt6Widgets.so.6 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libQt6XcbQpa.so.6 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libicui18n.so.73 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libicudata.so.73 launcher/linux/x64
cp ../Qt/${{ matrix.qt-version }}/gcc_64/lib/libicuuc.so.73 launcher/linux/x64
mkdir -p launcher/linux/x64/plugins/platforms
mkdir -p launcher/linux/x64/plugins/imageformats
cp ../Qt/${{ matrix.qt-version }}/gcc_64/plugins/platforms/libqxcb.so launcher/linux/x64/plugins/platforms
cp ../Qt/${{ matrix.qt-version }}/gcc_64/plugins/imageformats/libq* launcher/linux/x64/plugins/imageformats
rm launcher/linux/x64/plugins/imageformats/libqsvg.so
chrpath -r "\$ORIGIN" launcher/linux/x64/libicu*.so.73
chrpath -r "\$ORIGIN/../.." launcher/linux/x64/plugins/platforms/libqxcb.so
chrpath -r "\$ORIGIN/../.." launcher/linux/x64/plugins/imageformats/*.so
printf "[Paths]\nPrefix=.\nPlugins=plugins\n" > launcher/linux/x64/qt.conf
python -m build .
- name: Set up Miniconda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.11"
miniconda-version: "latest"
- name: Build Conda Package
shell: bash -l {0}
run: |
python -c "import sys; print(sys.version)"
python -c "import sys; print(sys.executable)"
conda update --all -q -y
conda install -q conda-build -y
conda build -q --python ${{ matrix.python-version }} ./.github/workflows/recipe
OUT_FILE=$(conda build --python ${{ matrix.python-version }} --output ./.github/workflows/recipe)
mv $OUT_FILE dist
- name: Upload Wheel
uses: actions/upload-artifact@v4
with:
name: ${{ env.tool-id }}-linux-whl-${{ matrix.python-version }}
path: dist/*.whl
- name: Upload Conda Package
uses: actions/upload-artifact@v4
with:
name: ${{ env.tool-id }}-linux-conda-${{ matrix.python-version }}
path: dist/*.tar.bz2
build_macos:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13]
python-version: ["3.11", "3.12", "3.13"]
architecture: [x86_64]
qt-version: ["6.8.0"]
include:
- os: macos-14
python-version: "3.12"
architecture: arm64
qt-version: "6.8.0"
- os: macos-14
python-version: "3.13"
architecture: arm64
qt-version: "6.8.0"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -c "import sys; print(sys.executable)"
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt-version }}
host: 'mac'
target: 'desktop'
- name: Build
shell: bash
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_KEYCHAIN_PASSWORD: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }}
MACOS_DEVELOPER_TEAM_ID: ${{ secrets.MACOS_DEVELOPER_TEAM_ID }}
run: |
APPNAME="Nion Swift"
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install packaging build cibuildwheel
pushd launcher
PYTHON=`python -c "import sys; print(sys.executable, end='')"`
cmake CMakeLists.txt -DPython3_EXECUTABLE="$PYTHON"
cmake --build . --config Release
pushd build
echo -n "$MACOS_CERTIFICATE" | base64 -d > certificate.p12
echo "Create keychain"
security create-keychain -p "$MACOS_KEYCHAIN_PASSWORD" build.keychain
echo "Set default keychain"
security default-keychain -s build.keychain
echo "Unlock keychain"
security unlock-keychain -p "$MACOS_KEYCHAIN_PASSWORD" build.keychain
echo "Import certificate (disabled)"
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
echo "Find identity"
security find-identity -v
echo "Set key partition list (avoids dialog)"
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_KEYCHAIN_PASSWORD" build.keychain
echo "Code sign"
# remove files that will not be signed and have can be regenerated
find "$APPNAME.app" -name "__pycache__" -exec rm -rf {} \; -prune
find "$APPNAME.app" -name "*.pyc" -exec rm -rf {} \; -prune
# sign files from the inside out. first ensure that dylibs are executable. then find all executable files
# and sign them. then sign apps within frameworks. then sign frameworks. then sign the app itself.
codesign --remove-signature --deep --force "$APPNAME.app/Contents/MacOS/$APPNAME"
find "$APPNAME.app" -name "*.dylib" -exec chmod +x {} \;
find "$APPNAME.app" -type f -perm +111 -and -not -name "*.py" -exec /usr/bin/codesign -s "$MACOS_DEVELOPER_TEAM_ID" {} --options runtime --timestamp --deep --force --verbose \;
find "$APPNAME.app/Contents/Frameworks" -name "*.app" -exec /usr/bin/codesign -s "$MACOS_DEVELOPER_TEAM_ID" {} --options runtime --timestamp --deep --force --verbose \;
find "$APPNAME.app" -name "*.framework" -exec /usr/bin/codesign -s "$MACOS_DEVELOPER_TEAM_ID" {} --options runtime --timestamp --deep --force --verbose \;
/usr/bin/codesign -s "$MACOS_DEVELOPER_TEAM_ID" "$APPNAME.app" --entitlements ../entitlements.xml --options runtime --timestamp --deep --force --verbose
rm certificate.p12
popd
mkdir -p build/Release
mv build/*.app build/Release
tar -czf "build/Release/$APPNAME.app.tar.gz" "build/Release/$APPNAME.app"
popd
PYTHON_VERSION_COMPRESSED=$(echo "${{ matrix.python-version }}" | sed 's/\.//g')
export CIBW_ARCHS_MACOS="${{ matrix.architecture }}"
export CIBW_BUILD=cp$PYTHON_VERSION_COMPRESSED-macosx_${{ matrix.architecture }}
export CIBW_REPAIR_WHEEL_COMMAND=""
python -m cibuildwheel --output-dir dist
- name: Upload Wheel
uses: actions/upload-artifact@v4
with:
name: ${{ env.tool-id }}-macos-whl-${{ matrix.architecture }}-${{ matrix.python-version }}
path: dist/*.whl
- name: Set up Miniconda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.11"
miniconda-version: "latest"
architecture: ${{ matrix.architecture }}
- name: Build Conda Package
shell: bash -l {0}
run: |
python -c "import sys; print(sys.version)"
python -c "import sys; print(sys.executable)"
conda update --all -q -y
conda install -q conda-build -y
conda build -q --python ${{ matrix.python-version }} ./.github/workflows/recipe
OUT_FILE=$(conda build --python ${{ matrix.python-version }} --output ./.github/workflows/recipe)
mv $OUT_FILE dist
- name: Upload Conda Package
uses: actions/upload-artifact@v4
with:
name: ${{ env.tool-id }}-macos-conda-${{ matrix.architecture }}-${{ matrix.python-version }}
path: dist/*.tar.bz2
build_win:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019]
python-version: ["3.11", "3.12", "3.13"]
qt-version: ["6.8.0"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
shell: pwsh
run: |
python -c "import sys; print(sys.version)"
python -c "import sys; print(sys.executable)"
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt-version }}
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2022_64'
- name: Build
shell: pwsh
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install packaging build cibuildwheel
pushd launcher
$PYTHON_EXEC = python -c "import sys; print(sys.executable, end='')"
cmake CMakeLists.txt -DPython3_EXECUTABLE="$PYTHON_EXEC"
cmake --build . --config Release
Get-ChildItem -Include *.pdb -Recurse | foreach { $_.Delete() }
Get-ChildItem build\Release\imageformats -Include *d.dll -Recurse | foreach { $_.Delete() }
Rename-Item -Path build\Release\NionSwiftLauncher.exe -NewName NionSwift.exe
Remove-Item -Recurse -Force x64\*
Move-Item -Path build\Release -Destination x64
popd
python -m build .
- name: Set up Miniconda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.11"
miniconda-version: "latest"
- name: Build Conda Package
shell: bash -l {0}
run: |
python -c "import sys; print(sys.version)"
python -c "import sys; print(sys.executable)"
conda update --all -q -y
conda install -q conda-build -y
conda build -q --python ${{ matrix.python-version }} ./.github/workflows/recipe
OUT_FILE=$(conda build --python ${{ matrix.python-version }} --output ./.github/workflows/recipe)
mv $OUT_FILE dist
- name: Upload Wheel
uses: actions/upload-artifact@v4
with:
name: ${{ env.tool-id }}-win-whl-${{ matrix.python-version }}
path: dist/*.whl
- name: Upload Conda Package
uses: actions/upload-artifact@v4
with:
name: ${{ env.tool-id }}-win-conda-${{ matrix.python-version }}
path: dist/*.tar.bz2
test_linux:
needs: build_linux
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Download Wheel
uses: actions/download-artifact@v4
id: download_wheel
with:
name: ${{ env.tool-id }}-linux-whl-${{ matrix.python-version }}
path: downloads
- name: Download Conda
uses: actions/download-artifact@v4
id: download_conda
with:
name: ${{ env.tool-id }}-linux-conda-${{ matrix.python-version }}
path: conda_downloads
- name: Set up Python ${{ matrix.python-version }} with official build
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Virtual screen
shell: bash
run: |
# update package list. see https://github.com/actions/runner-images/issues/10785#issuecomment-2420741561
sudo apt-get update
sudo apt-get install xvfb -y
# libopengl0: see https://bugreports.qt.io/browse/QTBUG-89754
sudo apt-get install libopengl0 -y
# see https://doc.qt.io/qt-6/linux-requirements.html
sudo apt-get install libegl1 libfontconfig1 libfreetype6 libxcb1 libxcb-glx0 libxcb-keysyms1 libxcb-image0 libxcb-shm0 libxcb-icccm4 libxcb-xfixes0 libxcb-shape0 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xkb1 libxkbcommon-x11-0 libxcb-sync1 libxcb-cursor0 -y
# sudo apt-get install libx11 libx11-xcb libxext libxfixes libxi libxrender libxcb-sync libxcb-util libxkbcommon
- name: Test system Python installed with official build with virtual environment
shell: bash
run: |
sudo apt update
python -m pip install --upgrade pip
SYSTEM_PYTHON_EXE=python
$SYSTEM_PYTHON_EXE -m venv test_venv
source test_venv/bin/activate
python -m pip install --upgrade pip
python -m pip install setuptools
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# python -m pip install ${{ env.tool-package }}
python -m pip install ${{steps.download_wheel.outputs.download-path}}/*.whl
python -m pip install numpy scipy h5py
pushd nionui_app_test
python -m pip install .
popd
echo "Running test... ${{ env.tool-exe }}"
xvfb-run -a ${{ env.tool-exe }} nionui_app.test_ack
sleep 5
xvfb-run -a ${{ env.tool-exe }} nionui_app.test_ack | grep ACK
sleep 5
deactivate
- name: Set up Miniconda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: test-environment
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
auto-activate-base: false
- name: Test Conda
# this test is disabled on ubuntu until default channel supports numpy 2
if: False
shell: bash -l {0}
run: |
# use conda versions instead of pypi versions. install before anything else.
conda create -q -n test-env-conda -c conda-forge python=${{ matrix.python-version }} numpy scipy h5py imageio setuptools pip -y
conda activate test-env-conda
# this does not work on ubuntu with Qt 6.8.
# until numpy 2 is available, use pip
# pip install numpy scipy h5py imageio setuptools
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# conda install -q -y -c nion ${{ env.tool-package }}
conda install -q -y ${{steps.download_conda.outputs.download-path}}/*.tar.bz2
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
conda list
xvfb-run -a ${{ env.tool-exe }} nionui_app.test_ack
sleep 5
xvfb-run -a ${{ env.tool-exe }} nionui_app.test_ack | grep ACK
sleep 5
conda deactivate
- name: Test Conda Forge
shell: bash -l {0}
run: |
# use conda versions instead of pypi versions. install before anything else.
conda create -q -n test-env -c conda-forge python=${{ matrix.python-version }} numpy scipy h5py imageio setuptools -y
conda activate test-env
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# conda install -q -y -c nion -c conda-forge ${{ env.tool-package }}
conda install -q -y -c conda-forge ${{steps.download_conda.outputs.download-path}}/*.tar.bz2
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
conda list
xvfb-run -a ${{ env.tool-exe }} nionui_app.test_ack
sleep 5
xvfb-run -a ${{ env.tool-exe }} nionui_app.test_ack | grep ACK
sleep 5
conda deactivate
- name: Build/publish anaconda package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && matrix.os == 'ubuntu-20.04'
shell: bash -l {0}
run: |
# make a directory to avoid name conflicts with the channel. argh.
mkdir conda_build
pushd conda_build
echo "conda create anaconda-client env"
conda create -n upload-env -q conda-build anaconda-client -y
echo "activate"
conda activate upload-env
echo "conda info"
conda info
echo "conda list"
conda list
echo "directory list"
ls -Rl ${{steps.download_conda.outputs.download-path}}
echo "anaconda upload"
anaconda --token ${{ secrets.anaconda_token }} upload --user nion --skip-existing ${{steps.download_conda.outputs.download-path}}/*.tar.bz2
echo "deactivate"
conda deactivate
echo "popd"
popd
test_macos:
needs: build_macos
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13]
python-version: ["3.11", "3.12", "3.13"]
architecture: [x86_64]
qt-version: ["6.8.0"]
include:
- os: macos-14
python-version: "3.12"
architecture: arm64
qt-version: "6.8.0"
- os: macos-14
python-version: "3.13"
architecture: arm64
qt-version: "6.8.0"
steps:
- uses: actions/checkout@v4
- name: Download Wheel
uses: actions/download-artifact@v4
id: download_wheel
with:
name: ${{ env.tool-id }}-macos-whl-${{ matrix.architecture }}-${{ matrix.python-version }}
path: downloads
- name: Download Conda
uses: actions/download-artifact@v4
id: download_conda
with:
name: ${{ env.tool-id }}-macos-conda-${{ matrix.architecture }}-${{ matrix.python-version }}
path: conda_downloads
- name: Set up Python ${{ matrix.python-version }} with official build
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Test system Python installed with brew with virtual environment
shell: bash
run: |
brew update
brew install python@${{ matrix.python-version }} || true
SYSTEM_PYTHON_EXE=/usr/local/bin/python${{ matrix.python-version }}
$SYSTEM_PYTHON_EXE -m venv test_venv
source test_venv/bin/activate
python -m pip install --upgrade pip
python -m pip install setuptools
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# python -m pip install ${{ env.tool-package }}
python -m pip install ${{steps.download_wheel.outputs.download-path}}/*.whl
python --version
python -m pip install numpy scipy h5py
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
${{ env.tool-exe }} nionui_app.test_ack
${{ env.tool-exe }} nionui_app.test_ack | grep ACK
- name: Test system Python installed with official build with virtual environment
shell: bash
run: |
SYSTEM_PYTHON_EXE=python3
$SYSTEM_PYTHON_EXE -m venv test_venv
source test_venv/bin/activate
python -m pip install --upgrade pip
python -m pip install setuptools
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# python -m pip install ${{ env.tool-package }}
python -m pip install ${{steps.download_wheel.outputs.download-path}}/*.whl
python --version
python -m pip install numpy scipy h5py
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
${{ env.tool-exe }} nionui_app.test_ack
${{ env.tool-exe }} nionui_app.test_ack | grep ACK
deactivate
- name: Set up Miniconda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: test-environment
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
auto-activate-base: false
- name: Test Conda
shell: bash -l {0}
run: |
# use conda versions instead of pypi versions. install before anything else.
# until numpy 2 is available, use pip
pip install numpy scipy h5py imageio setuptools
## use nomkl until anaconda gets its act together
# conda install -q nomkl numpy scipy h5py imageio setuptools -y
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# conda install -q -y -c nion ${{ env.tool-package }}
FILENAME=$(find '${{steps.download_conda.outputs.download-path}}' -name "*.tar.bz2")
echo "Installing '$FILENAME'"
conda install -q -y -c conda-forge $FILENAME
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
conda list
${{ env.tool-exe }} nionui_app.test_ack
${{ env.tool-exe }} nionui_app.test_ack | grep ACK
- name: Test Conda Forge
shell: bash -l {0}
run: |
# use conda versions instead of pypi versions. install before anything else.
# use nomkl until anaconda gets its act together
conda create -n test-env -c conda-forge -q python=${{ matrix.python-version }} numpy scipy h5py imageio setuptools -y
conda activate test-env
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# conda install -q -y -c nion -c conda-forge ${{ env.tool-package }}
FILENAME=$(find '${{steps.download_conda.outputs.download-path}}' -name "*.tar.bz2")
echo "Installing '$FILENAME'"
conda install -q -y -c conda-forge $FILENAME
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
conda list
${{ env.tool-exe }} nionui_app.test_ack
${{ env.tool-exe }} nionui_app.test_ack | grep ACK
conda deactivate
- name: Build/publish anaconda package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
shell: bash -l {0}
run: |
# make a directory to avoid name conflicts with the channel. argh.
mkdir conda_build
pushd conda_build
conda create -n upload-env -q conda-build anaconda-client -y
conda activate upload-env
FILENAME=$(find '${{steps.download_conda.outputs.download-path}}' -name "*.tar.bz2")
echo "Send to Anaconda '$FILENAME'"
anaconda --token ${{ secrets.anaconda_token }} upload --user nion --skip-existing $FILENAME
conda deactivate
popd
test_win:
needs: build_win
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019]
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Download Wheel
uses: actions/download-artifact@v4
id: download_wheel
with:
name: ${{ env.tool-id }}-win-whl-${{ matrix.python-version }}
path: downloads
- name: Download Conda
uses: actions/download-artifact@v4
id: download_conda
with:
name: ${{ env.tool-id }}-win-conda-${{ matrix.python-version }}
path: conda_downloads
- name: Set up Python ${{ matrix.python-version }} with official build
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Test system Python installed with official build with virtual environment
shell: pwsh
run: |
python -m pip install --upgrade pip
python -m venv test_venv
test_venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install setuptools
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# python -m pip install ${{ env.tool-package }}
$filename = Get-ChildItem -name ${{steps.download_wheel.outputs.download-path}}\*.whl
python -m pip install ${{steps.download_wheel.outputs.download-path}}\$filename
python --version
python -m pip install numpy scipy h5py
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
${{ env.tool-exe }} nionui_app.test_ack
${{ env.tool-exe }} nionui_app.test_ack | grep ACK
deactivate
- name: Set up Miniconda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: test-environment
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
auto-activate-base: false
- name: Test Conda
shell: pwsh
run: |
# use conda versions instead of pypi versions. install before anything else.
conda update -q --all -y
# until numpy 2 is available, use pip
pip install numpy scipy h5py imageio setuptools
# conda install -q numpy scipy h5py imageio setuptools pip -y
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# conda install -q -y -c nion ${{ env.tool-package }}
$filename = Get-ChildItem -name ${{steps.download_conda.outputs.download-path}}\*.tar.bz2
conda install -q -y ${{steps.download_conda.outputs.download-path}}\$filename
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
conda list
${{ env.tool-exe }} nionui_app.test_ack
${{ env.tool-exe }} nionui_app.test_ack | grep ACK
- name: Test Conda Forge
shell: pwsh
run: |
# use conda versions instead of pypi versions. install before anything else.
conda create -n test-env -c conda-forge -q python=${{ matrix.python-version }} numpy scipy h5py imageio setuptools -y
conda activate test-env
# until numpy 2 compatible versions are on nion channel, use direct source
pip install git+https://github.com/nion-software/nionutils.git#egg=nionutils
pip install git+https://github.com/nion-software/nionui.git#egg=nionui
pip install git+https://github.com/nion-software/niondata.git#egg=niondata
pip install git+https://github.com/nion-software/nionswift-io.git#egg=nionswift-io
pip install git+https://github.com/nion-software/nionswift.git#egg=nionswift
# conda install -q -y -c nion -c conda-forge ${{ env.tool-package }}
$filename = Get-ChildItem -name ${{steps.download_conda.outputs.download-path}}\*.tar.bz2
conda install -q -y -c conda-forge ${{steps.download_conda.outputs.download-path}}\$filename
pushd nionui_app_test
python -m pip install .
popd
echo "Running test..."
conda list
${{ env.tool-exe }} nionui_app.test_ack
${{ env.tool-exe }} nionui_app.test_ack | grep ACK
conda deactivate
- name: Build/publish anaconda package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && matrix.os == 'windows-2019'
shell: bash -l {0}
run: |
# make a directory to avoid name conflicts with the channel. argh.
mkdir conda_build
pushd conda_build
conda create -n upload-env -q conda-build anaconda-client -y
conda activate upload-env
FILENAME=$(find '${{steps.download_conda.outputs.download-path}}' -name "*.tar.bz2")
echo "Send to Anaconda '$FILENAME'"
anaconda --token ${{ secrets.anaconda_token }} upload --user nion --skip-existing $FILENAME
conda deactivate
popd
pypi-publish:
name: Upload release to PyPI
needs: [test_linux, test_macos, test_win]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
environment:
name: release
url: https://pypi.org/p/nionswift-tool
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4
- name: Remove all the files except the ones to upload to PyPI.
shell: bash
run: |
mkdir dist
find . -name "*cp311*.whl" -exec cp {} dist \;
ls -Rl .
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
print-hash: true