-
Notifications
You must be signed in to change notification settings - Fork 11
141 lines (123 loc) · 4.31 KB
/
cibuildwheel.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
name: Build and upload to PyPI
on:
pull_request:
release:
types:
- published
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-12, macos-14]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD_FRONTEND: "build"
CIBW_ARCHS: "auto64"
CIBW_SKIP: "pp* *musllinux*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND_WINDOWS: pytest --pyargs nlsam --verbose
CIBW_TEST_COMMAND: >
pytest --pyargs nlsam --verbose &&
cd {package}/example &&
chmod +x {package}/nlsam/tests/test_scripts1.sh &&
bash {package}/nlsam/tests/test_scripts1.sh &&
chmod +x {package}/nlsam/tests/test_scripts2.sh &&
bash {package}/nlsam/tests/test_scripts2.sh
- name: Test against oldest supported numpy version
shell: bash
run: |
python -m pip install ./wheelhouse/*cp310*.whl
python -m pip install numpy==1.21.3 scipy==1.8 pytest
pytest --pyargs nlsam --verbose
- uses: actions/upload-artifact@v4
with:
name: cibw-nlsam_${{ matrix.os }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'
- name: Build sdist
run: |
python -m pip install build
python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
build_pyinstaller:
name: Build pyinstaller on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macos-12, macos-14]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'
- name: Get pyinstaller
shell: bash
run: |
python -m pip install pyinstaller dask[distributed]
python -m pip install .
path=$(python -c "import distributed; print(distributed.__path__[0]);")
echo "version=v$(python -c "from importlib.metadata import version; print(version('nlsam'));")" >> $GITHUB_ENV
if [ "$RUNNER_OS" == "Windows" ]; then
pyinstaller ./scripts/nlsam_denoising -F --clean --add-data "${path};.\\distributed\\" --noupx
else
pyinstaller ./scripts/nlsam_denoising -F --clean --add-data ${path}:./distributed/ --noupx
fi
- uses: actions/upload-artifact@v4
with:
name: nlsam_${{ env.version }}_${{ runner.os }}_${{ runner.arch }}
path: |
./dist/nlsam_denoising*
CHANGELOG.md
README.md
LICENSE
example/*
publish_artifacts:
needs: [build_wheels, build_sdist] #, build_pyinstaller]
runs-on: ubuntu-latest
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
# upload to PyPI on every tag starting with 'v'
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
if: ${{ github.event.workflow_run.conclusion == 'success' }} && github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Download builds
uses: actions/download-artifact@v4
with:
path: dist
pattern: cibw-*
merge-multiple: true
- name: upload to pypi
uses: pypa/gh-action-pypi-publish@release/v1
- name: publish to github release
uses: softprops/action-gh-release@v2
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/*