Skip to content

Commit

Permalink
split packaging and publishing into separate jobs; try to enforce set…
Browse files Browse the repository at this point in the history
…uptools ver (#1199)
  • Loading branch information
slayoo authored Dec 6, 2023
1 parent 91e44a5 commit edb6ea7
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 13 deletions.
52 changes: 41 additions & 11 deletions .github/workflows/tests+artifacts+pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand Down Expand Up @@ -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:
Expand All @@ -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
4 changes: 4 additions & 0 deletions examples/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
[tool.setuptools_scm]

# TODO #1200
[build-system]
requires = ['setuptools==56.0.0', 'setuptools-scm==6.0.1']
1 change: 0 additions & 1 deletion examples/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "",
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
profile = "black"

[tool.setuptools_scm]

# TODO #1200
[build-system]
requires = ['setuptools==56.0.0', 'setuptools-scm==6.0.1']
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit edb6ea7

Please sign in to comment.