From edb6ea7172b31c23206bd8814e1444700807aa59 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 6 Dec 2023 19:01:33 +0100 Subject: [PATCH] split packaging and publishing into separate jobs; try to enforce setuptools ver (#1199) --- .github/workflows/tests+artifacts+pypi.yml | 52 +++++++++++++++++----- examples/pyproject.toml | 4 ++ examples/setup.py | 1 - pyproject.toml | 4 ++ setup.py | 1 - 5 files changed, 49 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests+artifacts+pypi.yml b/.github/workflows/tests+artifacts+pypi.yml index a20cb1a03..eb65d777b 100644 --- a/.github/workflows/tests+artifacts+pypi.yml +++ b/.github/workflows/tests+artifacts+pypi.yml @@ -70,9 +70,9 @@ jobs: with: python-version: 3.9 - run: | - pip install pdoc3 setuptools==58.1.0 - pip install -e . setuptools==58.1.0 - pip install -e examples setuptools==58.1.0 + pip install pdoc3 + pip install -e . + pip install -e examples python -We -m pdoc --html PySDM examples/PySDM_examples python -We .github/workflows/pdoc_index_workaround.py - if: ${{ github.ref == 'refs/heads/main' && matrix.platform == 'ubuntu-latest' }} @@ -227,16 +227,12 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: pytest --durations=10 -v -s -We -p no:unraisableexception -k "not test_run_notebooks" tests/devops_tests - dist: + package: strategy: matrix: packages-dir: [".", "examples"] fail-fast: false runs-on: ubuntu-latest - timeout-minutes: 90 - needs: [tests, examples, devops] - permissions: - id-token: write steps: - uses: actions/checkout@v2 with: @@ -254,15 +250,49 @@ jobs: python -m build 2>&1 | tee build.log exit `fgrep -i warning build.log | grep -v impl_numba/warnings.py | grep -v "no previously-included files matching" | wc -l` twine check --strict dist/* - cd .. + + - uses: actions/upload-artifact@v2 + with: + path: ${{ matrix.packages-dir}}/dist + name: dist + + pkg_install_check: + strategy: + matrix: + platform: [ubuntu-latest, macos-latest, windows-latest] + python-version: ["3.8", "3.10"] + runs-on: ${{ matrix.platform }} + needs: [package] + steps: + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/download-artifact@v2 + with: + name: dist + path: dist + - run: pip install dist/*.whl + - run: python -c "import PySDM; print(PySDM.__version__)" + - run: python -c "import PySDM_examples; print(PySDM_examples.__version__)" + + publish: + runs-on: ubuntu-latest + needs: [tests, examples, devops, package, pkg_install_check] + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v2 + with: + name: dist + path: dist - if: github.event_name == 'push' && github.ref == 'refs/heads/main' uses: pypa/gh-action-pypi-publish@unstable/v1 with: repository_url: https://test.pypi.org/legacy/ - packages-dir: ${{ matrix.packages-dir }}/dist + packages-dir: dist - if: startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@unstable/v1 with: - packages-dir: ${{ matrix.packages-dir }}/dist + packages-dir: dist diff --git a/examples/pyproject.toml b/examples/pyproject.toml index 10d5fb8a9..35c56ed16 100644 --- a/examples/pyproject.toml +++ b/examples/pyproject.toml @@ -1 +1,5 @@ [tool.setuptools_scm] + +# TODO #1200 +[build-system] +requires = ['setuptools==56.0.0', 'setuptools-scm==6.0.1'] diff --git a/examples/setup.py b/examples/setup.py index 11a4585f4..42be821ac 100644 --- a/examples/setup.py +++ b/examples/setup.py @@ -21,7 +21,6 @@ def get_long_description(): "version_scheme": "post-release", "root": "..", }, - setup_requires=["setuptools_scm"], install_requires=[ "PySDM", "PyMPDATA" + ">=1.0.15" if CI else "", diff --git a/pyproject.toml b/pyproject.toml index 54f82a025..75861c208 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,3 +2,7 @@ profile = "black" [tool.setuptools_scm] + +# TODO #1200 +[build-system] +requires = ['setuptools==56.0.0', 'setuptools-scm==6.0.1'] diff --git a/setup.py b/setup.py index 223d5363a..5758d0e19 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,6 @@ def get_long_description(): " cloud microphysics package with box, parcel & 1D/2D prescribed-flow" " examples in Python, Julia and Matlab", use_scm_version={"local_scheme": lambda _: "", "version_scheme": "post-release"}, - setup_requires=["setuptools_scm"], install_requires=[ "ThrustRTC==0.3.20", "CURandRTC" + ("==0.1.6" if CI else ">=0.1.2"),