Skip to content

Commit ebd27c5

Browse files
committed
update build
1 parent 5d72677 commit ebd27c5

File tree

2 files changed

+43
-21
lines changed

2 files changed

+43
-21
lines changed

.github/workflows/build.yml

+43-19
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ jobs:
2222
strategy:
2323
fail-fast: False
2424
matrix:
25-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
25+
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
2626
steps:
2727
- name: Checkout repository
2828
uses: actions/checkout@v4
2929
with:
3030
submodules: true
3131

3232
- name: Setup Python ${{ matrix.python-version }}
33-
uses: actions/setup-python@v2
33+
uses: actions/setup-python@v4
3434
with:
3535
python-version: ${{ matrix.python-version }}
3636

@@ -41,8 +41,9 @@ jobs:
4141
ls -al ./dist
4242
4343
- name: Place wheels in artifacts folder
44-
uses: actions/upload-artifact@v2
44+
uses: actions/upload-artifact@v4
4545
with:
46+
name: windows-${{ matrix.python-version }}
4647
path: ./dist/*.whl
4748

4849
build_wheels_unix:
@@ -59,7 +60,7 @@ jobs:
5960
submodules: true
6061

6162
- name: Setup Python ${{ matrix.python-version }}
62-
uses: actions/setup-python@v2
63+
uses: actions/setup-python@v4
6364
with:
6465
python-version: '3.11'
6566

@@ -78,8 +79,9 @@ jobs:
7879
ls -R dist
7980
8081
- name: Place wheels in artifacts folder
81-
uses: actions/upload-artifact@v2
82+
uses: actions/upload-artifact@v4
8283
with:
84+
name: ${{ matrix.os }}
8385
path: ./dist/*.whl
8486

8587
test-wheels:
@@ -89,23 +91,27 @@ jobs:
8991
strategy:
9092
matrix:
9193
os: [ windows-latest, ubuntu-latest, macos-latest ]
92-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
94+
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
9395

9496
steps:
9597
- name: Checkout repository
9698
uses: actions/checkout@v4
9799
with:
98100
submodules: true
99101
- name: Setup Python ${{ matrix.python-version }}
100-
uses: actions/setup-python@v2
102+
uses: actions/setup-python@v4
101103
with:
102104
python-version: ${{ matrix.python-version }}
103105

104106
- name: Retrieve packages
105-
uses: actions/download-artifact@v2
107+
uses: actions/download-artifact@v4
106108
with:
107109
path: dist
108110

111+
- name: List items
112+
run: |
113+
ls -alR dist
114+
109115
- name: Test Package Installation
110116
run: |
111117
python -m pip install --upgrade pip
@@ -131,34 +137,52 @@ jobs:
131137
python extern/nlopt/test/t_python.py
132138
133139
deploy:
134-
name: deploy packages
140+
name: Deploy packages
135141
runs-on: ubuntu-latest
136142
needs: test-wheels
137-
if: startsWith(github.ref, 'refs/tags/')
143+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
138144

139145
steps:
140146
- name: Setup Python ${{ matrix.python-version }}
141-
uses: actions/setup-python@v2
147+
uses: actions/setup-python@v4
142148
with:
143149
python-version: ${{ matrix.python-version }}
144150

145151
- name: Retrieve packages
146-
uses: actions/download-artifact@v2
152+
uses: actions/download-artifact@v4
147153
with:
148-
name: artifact
149154
path: dist
150155

151156
- name: Install twine
152157
run: pip install twine
153158

159+
- name: Move files to top level directory
160+
run: |
161+
ls -ltR dist
162+
python - << EOF
163+
from pathlib import Path
164+
import shutil
165+
166+
d = Path('dist')
167+
for f in d.rglob('*.whl'):
168+
shutil.move(f, d / f.name)
169+
170+
for f in d.iterdir():
171+
if f.is_dir():
172+
shutil.rmtree(f)
173+
174+
EOF
175+
154176
- name: Upload packages to testpypi
177+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
155178
env:
156-
TWINE_USERNAME: ${{ secrets.PYPI_TEST_UID }}
157-
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PWD }}
158-
run: python -m twine upload --skip-existing --repository testpypi dist/*
179+
TWINE_USERNAME: ${{ secrets.PYPI_TEST_TOKEN_NAME }}
180+
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_API_TOKEN }}
181+
run: python -m twine upload --skip-existing --repository testpypi dist/* --verbose
159182

160183
- name: Upload packages to pypi
184+
if: startsWith(github.ref, 'refs/tags/')
161185
env:
162-
TWINE_USERNAME: ${{ secrets.PYPI_UID }}
163-
TWINE_PASSWORD: ${{ secrets.PYPI_PWD }}
164-
run: python -m twine upload --skip-existing dist/*
186+
TWINE_USERNAME: ${{ secrets.PYPI_PROD_TOKEN_NAME }}
187+
TWINE_PASSWORD: ${{ secrets.PYPI_PROD_API_TOKEN }}
188+
run: python -m twine upload --skip-existing dist/* --verbose

setup.py

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
from extensions import NLOptBuild, NLOptBuildExtension
77

8-
from wheel.bdist_wheel import bdist_wheel
9-
108
with open("README.md") as f:
119
long_description = f.read()
1210

0 commit comments

Comments
 (0)