Skip to content

Commit 4d8bcf6

Browse files
authored
Merge pull request hyperspy#142 from ericpre/improve_release_notes
Improve release notes and add caching
2 parents 09c494d + a496a1f commit 4d8bcf6

File tree

3 files changed

+123
-32
lines changed

3 files changed

+123
-32
lines changed

.github/workflows/docs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
miniforge-version: latest
2626
environment-file: conda_environment.yml
2727
activate-environment: hyperspy-bundle
28-
conda-remove-defaults: "true"
2928

3029
- name: Conda info
3130
shell: bash -l {0}

.github/workflows/release.yml

Lines changed: 115 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ env:
2424
PYTEST_QT_API: pyqt5
2525
# workaround for https://github.com/pyxem/pyxem/pull/1175
2626
TEST_DEPS: '"pytest<9" pytest-qt pytest-xdist pytest-rerunfailures pytest-mpl filelock'
27+
CONSTRUCTOR_VERSION: '3.14.0'
28+
CONDA_STANDALONE: '24.11.0'
29+
ROSETTASCIIO_CACHE_NUMBER: 0 # Increase this value to reset cache
30+
31+
defaults:
32+
run:
33+
shell: bash -el {0}
2734

2835
jobs:
2936
create_release_job:
@@ -50,14 +57,65 @@ jobs:
5057
run: |
5158
echo ${{ env.VERSION }}
5259
53-
- name: Find and Replace
60+
- uses: conda-incubator/setup-miniconda@v3
61+
with:
62+
miniforge-version: latest
63+
64+
- name: Install constructor
65+
run: |
66+
# Constructor is needed to parse the list of included packages
67+
conda install constructor==${{ env.CONSTRUCTOR_VERSION }}
68+
69+
- name: Conda info
70+
run: |
71+
conda info
72+
conda list
73+
74+
- name: Find and Replace Version in Release Notes
5475
uses: jacobtomlinson/gha-find-replace@f1069b438f125e5395d84d1c6fd3b559a7880cb5
5576
if: startsWith(github.ref, 'refs/tags/')
5677
with:
5778
find: "__TAG__"
5879
replace: ${{ env.VERSION }}
5980
include: "RELEASE_TEXT.md" # Will match all RELEASE_TEXT.md files in any nested directory
6081

82+
- name: Find and Replace constructor version in Release Notes
83+
uses: jacobtomlinson/gha-find-replace@f1069b438f125e5395d84d1c6fd3b559a7880cb5
84+
if: startsWith(github.ref, 'refs/tags/')
85+
with:
86+
find: "__CONSTRUCTOR_VERSION__"
87+
replace: ${{ env.CONSTRUCTOR_VERSION }}
88+
include: "RELEASE_TEXT.md" # Will match all RELEASE_TEXT.md files in any nested directory
89+
90+
- name: Find and Replace conda-standalone version in Release Notes
91+
uses: jacobtomlinson/gha-find-replace@f1069b438f125e5395d84d1c6fd3b559a7880cb5
92+
if: startsWith(github.ref, 'refs/tags/')
93+
with:
94+
find: "__CONDA_STANDALONE_VERSION__"
95+
replace: ${{ env.CONDA_STANDALONE }}
96+
include: "RELEASE_TEXT.md" # Will match all RELEASE_TEXT.md files in any nested directory
97+
98+
- name: Update packages list
99+
run: |
100+
python parse_list_libraries.py
101+
echo "List of libraries and software"
102+
echo "=============================="
103+
cat ./docs/specs.rst
104+
105+
- name: Save `docs/specs.rst` content as environment variable
106+
run: |
107+
echo "INCLUDED_PACKAGES<<EOF" >> $GITHUB_ENV
108+
cat ./docs/specs.rst >> $GITHUB_ENV
109+
echo "EOF" >> $GITHUB_ENV
110+
111+
- name: Find and Replace included packages in Release Notes
112+
uses: jacobtomlinson/gha-find-replace@f1069b438f125e5395d84d1c6fd3b559a7880cb5
113+
if: startsWith(github.ref, 'refs/tags/')
114+
with:
115+
find: "__INCLUDED_PACKAGES__"
116+
replace: ${{ env.INCLUDED_PACKAGES }}
117+
include: "RELEASE_TEXT.md" # Will match all RELEASE_TEXT.md files in any nested directory
118+
61119
- name: Create Release
62120
if: startsWith(github.ref, 'refs/tags/')
63121
id: create_release
@@ -116,21 +174,15 @@ jobs:
116174
env:
117175
DISPLAY: ':0'
118176

119-
defaults:
120-
run:
121-
shell: bash -el {0}
122-
123177
steps:
124178
- uses: actions/checkout@v6
125179
- uses: conda-incubator/setup-miniconda@v3
126180
with:
127181
miniforge-version: latest
128-
channels: conda-forge
129-
channel-priority: strict
130182

131183
- name: Install constructor
132184
run: |
133-
conda install constructor>=3.12.2
185+
conda install constructor==${{ env.CONSTRUCTOR_VERSION }} conda-standalone==${{ env.CONDA_STANDALONE }}
134186
135187
- name: Conda info
136188
run: |
@@ -223,7 +275,7 @@ jobs:
223275
224276
- name: Check latest available hyperspy version
225277
run: |
226-
conda activate "${{ env.install_dir }}"
278+
conda activate "${{ env.install_dir }}"
227279
python check_hyperspy_latest.py
228280
229281
- name: Install xvfb
@@ -242,6 +294,20 @@ jobs:
242294
conda activate "${{ env.install_dir }}"
243295
mamba install ${{ env.TEST_DEPS }}
244296
297+
- name: Get rosettasciio tests data location
298+
run: |
299+
conda activate "${{ env.install_dir }}"
300+
python -c "from rsciio.tests import registry; print(f'ROSETTASCIIO_TEST_DATA={str(registry.TESTS_PATH / \"data\") }')" >> $GITHUB_ENV
301+
302+
- name: Cache rosettasciio data
303+
uses: actions/cache@v4
304+
with:
305+
path: ${{ env.ROSETTASCIIO_TEST_DATA }}
306+
key:
307+
RosettaSciIO-test_data-${{ env.ROSETTASCIIO_CACHE_NUMBER }}
308+
restore-keys: |
309+
RosettaSciIO-test_data-${{ env.ROSETTASCIIO_CACHE_NUMBER }}
310+
245311
- if: always()
246312
name: Test new distribution (HyperSpyUI)
247313
run: |
@@ -298,7 +364,7 @@ jobs:
298364
run: |
299365
conda activate "${{ env.install_dir }}"
300366
# cause of the TestAddEllipseArrayAsMarkers failure is unknown (seems to be on blas mkl only)
301-
pytest --pyargs pyxem -k "not TestAddEllipseArrayAsMarkers"
367+
pytest --pyargs pyxem -k "not TestAddEllipseArrayAsMarkers and not TestGetEllipseModelRansacSingleFrame"
302368
303369
- name: Run test atomap
304370
if: always()
@@ -335,9 +401,29 @@ jobs:
335401
WP_EXE: winpython.exe
336402
WP_DIR_NAME: WPy64-31280
337403

404+
defaults:
405+
run:
406+
shell: cmd
407+
338408
steps:
339409
- uses: actions/checkout@v6
410+
411+
- name: Cache WinPython data
412+
uses: actions/cache@v4
413+
env:
414+
# Increase this value to reset cache
415+
CACHE_NUMBER: 0
416+
with:
417+
path: ${{ env.WP_EXE }}
418+
key:
419+
WinPython-${{ env.WP_DIR_NAME }}-${{ env.CACHE_NUMBER }}
420+
restore-keys: |
421+
WinPython-${{ env.WP_DIR_NAME }}-${{ env.CACHE_NUMBER }}
422+
340423
- name: Download Winpython
424+
# only run if not in cache
425+
if: hashFiles(env.WP_EXE) == ''
426+
shell: powershell
341427
run: |
342428
Invoke-WebRequest -OutFile ${{ env.WP_EXE }} ${{ env.WP_URL }}
343429
ls
@@ -346,27 +432,26 @@ jobs:
346432
if ($file_hash -ne "${{ env.WP_SHA256 }}") { exit(1) }
347433
348434
- name: Install Winpython
435+
shell: powershell
349436
run: |
350437
.\${{ env.WP_EXE }} -y | Out-Null
351438
ls
352439
ls ${{ env.WP_DIR_NAME }}
353440
354441
- name: Install libraries
355-
shell: cmd
356442
run: |
357443
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
358444
where python
359445
where pip
360446
pip install -r requirement_portable_distribution.txt
361447
362448
- name: Pip list
363-
shell: cmd
364449
run: |
365450
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
366451
pip list
367452
368-
- shell: bash -l {0}
369-
name: Set installer name
453+
- name: Set installer name
454+
shell: bash -l {0}
370455
env:
371456
VERSION: ${{ needs.create_release_job.outputs.VERSION }}
372457
run: |
@@ -375,7 +460,6 @@ jobs:
375460
echo $installer_name
376461
377462
- name: Run pyclean in distribution folder
378-
shell: cmd
379463
run: |
380464
where pip
381465
pip install pyclean
@@ -395,6 +479,7 @@ jobs:
395479
name: ${{ env.asset_name }}
396480

397481
- name: Install new distribution
482+
shell: powershell
398483
run: |
399484
Remove-Item -recurse ${{ env.WP_DIR_NAME }}
400485
ls
@@ -404,94 +489,95 @@ jobs:
404489
echo ${{ env.asset_name }}
405490
406491
- name: Check latest available hyperspy version
407-
shell: cmd
408492
run: |
409493
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
410494
python check_hyperspy_latest.py
411495
496+
- name: Get rosettasciio tests data location
497+
run: |
498+
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
499+
python -c "from rsciio.tests import registry; data_path=str(registry.TESTS_PATH / 'data'); print(f'ROSETTASCIIO_TEST_DATA={data_path}')">> %GITHUB_ENV%
500+
501+
- name: Cache rosettasciio data
502+
uses: actions/cache@v4
503+
with:
504+
path: ${{ env.ROSETTASCIIO_TEST_DATA }}
505+
key:
506+
RosettaSciIO-test_data-${{ env.ROSETTASCIIO_CACHE_NUMBER }}
507+
restore-keys: |
508+
RosettaSciIO-test_data-${{ env.ROSETTASCIIO_CACHE_NUMBER }}
509+
412510
- name: Install testing libraries
413511
if: always()
414-
shell: cmd
415512
run: |
416513
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
417514
pip install ${{ env.TEST_DEPS }}
418515
419516
- name: Run test suite (HyperSpyUI)
420517
if: always()
421-
shell: cmd
422518
run: |
423519
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
424520
# Error on closing figure, not critical
425521
pytest --pyargs hyperspyui -k "not plotting"
426522
427523
- name: Run test hyperspy
428524
if: always()
429-
shell: cmd
430525
run: |
431526
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
432527
pytest --pyargs hyperspy --reruns 3 -n 2
433528
434529
- name: Run test RosettaSciIO
435530
if: always()
436-
shell: cmd
437531
run: |
438532
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
439533
pytest --pyargs rsciio --reruns 3 -n 2 -k "not test_mrcz.py and not test_usid.py"
440534
441535
- name: Run test hyperspy_gui_ipywidgets
442536
if: always()
443-
shell: cmd
444537
run: |
445538
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
446539
pytest --pyargs hyperspy_gui_ipywidgets
447540
448541
- name: Run test hyperspy_gui_traitsui
449542
if: always()
450-
shell: cmd
451543
run: |
452544
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
453545
pytest --pyargs hyperspy_gui_traitsui
454546
455547
- name: Run test exspy
456548
if: always()
457-
shell: cmd
458549
run: |
459550
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
460551
pytest --pyargs exspy
461552
462553
- name: Run test holospy
463554
if: always()
464-
shell: cmd
465555
run: |
466556
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
467557
pytest --pyargs holospy
468558
469559
- name: Run test lumispy
470560
if: always()
471-
shell: cmd
472561
run: |
473562
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
474563
pytest --pyargs lumispy
475564
476565
- name: Run test pyxem
477566
if: always()
478-
shell: cmd
479567
run: |
480568
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
481569
# cause of the TestAddEllipseArrayAsMarkers failure is unknown (seems to be on blas mkl only)
482-
pytest --pyargs pyxem -k "not TestAddEllipseArrayAsMarkers"
570+
pytest --pyargs pyxem -k "not TestAddEllipseArrayAsMarkers and not TestGetEllipseModelRansacSingleFrame"
483571
484572
- name: Run test atomap
485573
if: always()
486-
shell: cmd
487574
run: |
488575
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
489576
# Skip interactive test
490577
pytest --pyargs atomap -k "not TestSelectAtomsWithGui"
491578
492579
- name: Run test kikuchipy
493580
if: always()
494-
shell: cmd
495581
run: |
496582
call "${{ env.WP_DIR_NAME }}\scripts\env.bat"
497583
# https://github.com/pyxem/kikuchipy/issues/707

RELEASE_TEXT.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ For Mac, there are also two variants available:
1616
- `Intel` for Mac computers with Intel CPU, with the MKL library
1717
- `Silicon` for Mac computers with Apple Silicon (M1, M2, etc.) CPU, with the Accelerate library
1818

19-
For included packages, [see documentation](https://hyperspy.org/hyperspy-bundle/index.html#included-software-and-libraries).
19+
<details>
2020

21-
This distribution is built using [constructor 3.6.0](https://conda.github.io/constructor).
21+
<summary>Included packages</summary>
22+
23+
__INCLUDED_PACKAGES__
24+
25+
</details>
26+
27+
This distribution is built using [constructor __CONSTRUCTOR_VERSION__](https://conda.github.io/constructor) and [conda-standalone __CONDA_STANDALONE_VERSION__](https://github.com/conda/conda-standalone).
2228

2329
## Portable (Windows only)
2430
The portable distribution is based on the [WinPython](https://winpython.github.io) distribution and is a self-extracting archive. Running the installer will install the distribution in the current directory. Since the distribution is portable, it can be moved to any directory or run from an external drive.

0 commit comments

Comments
 (0)