From 5d7267783901afe67f8126359727a44edc9fab2d Mon Sep 17 00:00:00 2001 From: Daniel Bok Date: Wed, 3 Apr 2024 08:28:17 +0800 Subject: [PATCH 1/2] Update nlopt submodule --- .python-version | 1 + extern/nlopt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .python-version diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..8531a3b --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.12.2 diff --git a/extern/nlopt b/extern/nlopt index c40b548..7a7587e 160000 --- a/extern/nlopt +++ b/extern/nlopt @@ -1 +1 @@ -Subproject commit c40b5486c12da6eb994984021bfbfb2ef160cbf6 +Subproject commit 7a7587e5ef1cb15f412515d852d1fc261c863e96 From ebd27c5c81848c4cacc8f6f5cebe53609d3ccc83 Mon Sep 17 00:00:00 2001 From: Daniel Bok Date: Wed, 3 Apr 2024 08:28:41 +0800 Subject: [PATCH 2/2] update build --- .github/workflows/build.yml | 62 +++++++++++++++++++++++++------------ setup.py | 2 -- 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d4b54f..836bfb5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: False matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] steps: - name: Checkout repository uses: actions/checkout@v4 @@ -30,7 +30,7 @@ jobs: submodules: true - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} @@ -41,8 +41,9 @@ jobs: ls -al ./dist - name: Place wheels in artifacts folder - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: + name: windows-${{ matrix.python-version }} path: ./dist/*.whl build_wheels_unix: @@ -59,7 +60,7 @@ jobs: submodules: true - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.11' @@ -78,8 +79,9 @@ jobs: ls -R dist - name: Place wheels in artifacts folder - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: + name: ${{ matrix.os }} path: ./dist/*.whl test-wheels: @@ -89,7 +91,7 @@ jobs: strategy: matrix: os: [ windows-latest, ubuntu-latest, macos-latest ] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] steps: - name: Checkout repository @@ -97,15 +99,19 @@ jobs: with: submodules: true - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Retrieve packages - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: path: dist + - name: List items + run: | + ls -alR dist + - name: Test Package Installation run: | python -m pip install --upgrade pip @@ -131,34 +137,52 @@ jobs: python extern/nlopt/test/t_python.py deploy: - name: deploy packages + name: Deploy packages runs-on: ubuntu-latest needs: test-wheels - if: startsWith(github.ref, 'refs/tags/') + if: ${{ !startsWith(github.ref, 'refs/tags/') }} steps: - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Retrieve packages - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: - name: artifact path: dist - name: Install twine run: pip install twine + - name: Move files to top level directory + run: | + ls -ltR dist + python - << EOF + from pathlib import Path + import shutil + + d = Path('dist') + for f in d.rglob('*.whl'): + shutil.move(f, d / f.name) + + for f in d.iterdir(): + if f.is_dir(): + shutil.rmtree(f) + + EOF + - name: Upload packages to testpypi + if: ${{ !startsWith(github.ref, 'refs/tags/') }} env: - TWINE_USERNAME: ${{ secrets.PYPI_TEST_UID }} - TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PWD }} - run: python -m twine upload --skip-existing --repository testpypi dist/* + TWINE_USERNAME: ${{ secrets.PYPI_TEST_TOKEN_NAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_TEST_API_TOKEN }} + run: python -m twine upload --skip-existing --repository testpypi dist/* --verbose - name: Upload packages to pypi + if: startsWith(github.ref, 'refs/tags/') env: - TWINE_USERNAME: ${{ secrets.PYPI_UID }} - TWINE_PASSWORD: ${{ secrets.PYPI_PWD }} - run: python -m twine upload --skip-existing dist/* + TWINE_USERNAME: ${{ secrets.PYPI_PROD_TOKEN_NAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PROD_API_TOKEN }} + run: python -m twine upload --skip-existing dist/* --verbose diff --git a/setup.py b/setup.py index f015eb3..c1d96ca 100644 --- a/setup.py +++ b/setup.py @@ -5,8 +5,6 @@ from extensions import NLOptBuild, NLOptBuildExtension -from wheel.bdist_wheel import bdist_wheel - with open("README.md") as f: long_description = f.read()