|
7 | 7 |
|
8 | 8 | jobs: |
9 | 9 | build-and-publish-pypi: |
| 10 | + if: ${{ github.event.release.preprelease == false }} |
10 | 11 | runs-on: ubuntu-latest |
11 | 12 | steps: |
12 | 13 | - name: Checkout code |
13 | | - uses: actions/checkout@v2 |
| 14 | + uses: actions/checkout@v4 |
14 | 15 |
|
15 | 16 | - name: Setup Python |
16 | | - uses: actions/setup-python@v2 |
| 17 | + uses: actions/setup-python@v5 |
17 | 18 | with: |
18 | 19 | python-version: '3.10' |
19 | 20 |
|
20 | 21 | - name: Install dependencies |
21 | 22 | run: | |
22 | 23 | python -m pip install --upgrade pip |
23 | | - pip install setuptools wheel twine |
| 24 | + pip install build twine |
24 | 25 |
|
25 | | - - name: Build package |
26 | | - run: python setup.py sdist bdist_wheel |
| 26 | + - name: Build dists (sdist+wheel) |
| 27 | + run: python -m build |
| 28 | + |
| 29 | + - name: Twine check |
| 30 | + run: python -m twine check dist/* |
| 31 | + |
| 32 | + - name: Smoke install & import |
| 33 | + run: | |
| 34 | + python -m venv .venv |
| 35 | + . .venv/bin/activate |
| 36 | + python -m pip install -U pip |
| 37 | + python -m pip install dist/*.whl |
| 38 | + python - <<'PY' |
| 39 | + import importlib.metadata as md |
| 40 | + tops = {str(f).split('/')[0] for d in md.distributions() |
| 41 | + for f in (d.files or [])} |
| 42 | + assert "tpot" in tops, "tpot not packaged at top level" |
| 43 | + import tpot |
| 44 | + from tpot import TPOTClassifier, TPOTRegressor |
| 45 | + print("OK: imports") |
| 46 | + PY |
| 47 | +
|
| 48 | + - name: TPOT fit smoke |
| 49 | + run: | |
| 50 | + . .venv/bin/activate |
| 51 | + python - <<'PY' |
| 52 | + import numpy as np |
| 53 | + from tpot import TPOTClassifier |
| 54 | + X = np.random.RandomState(0).randn(40, 5) |
| 55 | + y = (X[:,0] > 0).astype(int) |
| 56 | + t = TPOTClassifier(generations=1, population_size=5, |
| 57 | + max_time_mins=0.1, verbosity=0) |
| 58 | + t.fit(X, y) |
| 59 | + print("OK: fit") |
| 60 | + PY |
27 | 61 |
|
28 | 62 | - name: Upload to PyPI |
29 | 63 | env: |
30 | 64 | TWINE_USERNAME: __token__ |
31 | 65 | TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
32 | | - run: twine upload dist/* |
| 66 | + run: python -m twine upload dist/* |
33 | 67 |
|
0 commit comments