Skip to content

Commit ce4ea08

Browse files
authored
Merge pull request #115 from samuelstjean/actions
split release action
2 parents f895ec6 + 8602f13 commit ce4ea08

File tree

8 files changed

+38
-62
lines changed

8 files changed

+38
-62
lines changed

.github/workflows/cibuildwheel.yml

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -62,26 +62,6 @@ jobs:
6262
with:
6363
path: dist/*.tar.gz
6464

65-
upload_pypi:
66-
needs: [build_wheels, build_sdist]
67-
runs-on: ubuntu-latest
68-
# upload to PyPI on every tag starting with 'v'
69-
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
70-
# alternatively, to publish when a GitHub Release is created, use the following rule:
71-
if: github.event_name == 'release' && github.event.action == 'published'
72-
steps:
73-
- uses: actions/download-artifact@v3
74-
with:
75-
name: artifact
76-
path: dist
77-
78-
- uses: pypa/gh-action-pypi-publish@release/v1
79-
with:
80-
user: ${{ secrets.PYPI_USERNAME }}
81-
password: ${{ secrets.PYPI_PASSWORD }}
82-
# password: ${{ secrets.testpypi_password }}
83-
# repository_url: https://test.pypi.org/legacy/
84-
8565
build_pyinstaller:
8666
name: Build pyinstaller on ${{ matrix.os }}
8767
runs-on: ${{ matrix.os }}
@@ -109,11 +89,6 @@ jobs:
10989
pyinstaller ./scripts/nlsam_denoising -F --clean --add-data ${path}:./distributed/ --noupx
11090
fi
11191
112-
- uses: actions/upload-artifact@v3
113-
with:
114-
name: nlsam_${{ env.version }}_${{ runner.os }}
115-
path: ./dist/nlsam_denoising*
116-
11792
- uses: actions/upload-artifact@v3
11893
with:
11994
name: nlsam_${{ env.version }}_${{ runner.os }}
@@ -122,3 +97,4 @@ jobs:
12297
README.md
12398
LICENSE
12499
example/*
100+
./dist/nlsam_denoising*

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
upload_pypi:
9+
needs: [build_wheels, build_sdist]
10+
runs-on: ubuntu-latest
11+
# upload to PyPI on every tag starting with 'v'
12+
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
13+
# alternatively, to publish when a GitHub Release is created, use the following rule:
14+
if: github.event_name == 'release' && github.event.action == 'published'
15+
steps:
16+
- uses: actions/download-artifact@v3
17+
with:
18+
name: artifact
19+
path: dist
20+
21+
- uses: pypa/gh-action-pypi-publish@release/v1
22+
with:
23+
verbose: true
24+
print-hash: true
25+
user: ${{ secrets.PYPI_USERNAME }}
26+
password: ${{ secrets.PYPI_PASSWORD }}
27+
# password: ${{ secrets.testpypi_password }}
28+
# repository_url: https://test.pypi.org/legacy/

nlsam/tests/test_angular_tools.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
#! /usr/bin/env python
2-
31
import numpy as np
4-
from numpy.testing import assert_almost_equal, assert_equal, run_module_suite
2+
from numpy.testing import assert_almost_equal, assert_equal
53

64
from nlsam.angular_tools import angular_neighbors, _angle, greedy_set_finder, split_per_shell
75

@@ -89,6 +87,3 @@ def test_split_per_shell():
8987

9088
for n, ii in enumerate(idx):
9189
assert_equal(np.unique(greedy_set_finder(ii)), true_idx[n])
92-
93-
if __name__ == "__main__":
94-
run_module_suite()

nlsam/tests/test_bias_correction.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
#! /usr/bin/env python
2-
31
import numpy as np
4-
from numpy.testing import assert_allclose, assert_array_less, run_module_suite
2+
from numpy.testing import assert_allclose, assert_array_less
53

64
from nlsam.bias_correction import root_finder_sigma, multiprocess_stabilization
75

@@ -138,7 +136,3 @@ def test_stabilization():
138136
# The answer is a bit off for the last values of the final output, might be due to different numerical schemes
139137
assert_allclose(output[:80], answer[:80], atol=1e-2, rtol=1e-5)
140138
assert_allclose(eta, eta_koay, atol=1e-2, rtol=1e-6)
141-
142-
143-
if __name__ == "__main__":
144-
run_module_suite()

nlsam/tests/test_reshaping.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
#! /usr/bin/env python
2-
31
import numpy as np
4-
from numpy.testing import assert_allclose, run_module_suite
2+
from numpy.testing import assert_allclose
53

64
from nlsam.utils import col2im_nd, im2col_nd
75
from autodmri.blocks import extract_patches
@@ -52,7 +50,3 @@ def test_reshaping():
5250
out = extract_patches(a, (2, 2, 2, 10), (1, 1, 1, 10)).reshape(-1, 2**3 * 10).T
5351
redo = col2im_nd(out, (2, 2, 2, 10), (10, 10, 10, 10), (0, 0, 0, 0))
5452
assert_allclose(a, redo)
55-
56-
57-
if __name__ == "__main__":
58-
run_module_suite()

nlsam/tests/test_smoothing.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
#! /usr/bin/env python
2-
31
import numpy as np
4-
from numpy.testing import assert_array_less, run_module_suite
2+
from numpy.testing import assert_array_less
53

64
from nlsam.bias_correction import xi
75
from nlsam.smoothing import local_standard_deviation
@@ -42,7 +40,3 @@ def test_local_standard_deviation():
4240

4341
# everything less than 10% error of real value?
4442
assert_array_less(np.abs(std - corrected_std.mean()) / std, 0.1)
45-
46-
47-
if __name__ == "__main__":
48-
run_module_suite()

nlsam/tests/test_stabilizer.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
#! /usr/bin/env python
2-
31
import numpy as np
4-
from numpy.testing import assert_allclose, assert_equal, run_module_suite
2+
from numpy.testing import assert_allclose, assert_equal
53
from itertools import product
64

75
from nlsam.stabilizer import (_test_marcumq_cython,
@@ -322,7 +320,3 @@ def test_marcumq_octave():
322320

323321
for (a, b), q in zip(product(A, B), Q):
324322
assert_allclose(_test_marcumq_cython(a, b, M), q, atol=1e-4, rtol=1e-6)
325-
326-
327-
if __name__ == "__main__":
328-
run_module_suite()

scripts/nlsam_denoising

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ if __name__ == "__main__":
542542
n_cores = args.cores
543543

544544
client = Client(threads_per_worker=1, n_workers=n_cores)
545-
parallel_backend("dask")
546-
547-
main()
545+
with parallel_backend("dask"):
546+
main()
547+
else:
548+
main()

0 commit comments

Comments
 (0)