Skip to content

Commit e30d393

Browse files
Merge pull request #3 from chenmoneygithub/prerelease-test
Add testing before pypi publish
2 parents 2957c5f + 18978db commit e30d393

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

.github/workflows/build_and_release.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ jobs:
4848
run: python3 -m build
4949
# Test the locally built wheel
5050
- name: Create test environment
51-
run: python -m venv test_env
51+
run: python -m venv test_before_testpypi
5252
- name: Test package installation and functionality
5353
run: |
54-
source test_env/bin/activate
54+
source test_before_testpypi/bin/activate
5555
# Install the locally built wheel and testing dependencies
5656
pip install dist/*.whl pytest
5757
python -c "import dspy; print(dspy.__version__)"
@@ -93,6 +93,16 @@ jobs:
9393
run: sed -i '/#replace_package_name_marker/{n;s/__name__ *= *"[^"]*"/__name__="dspy"/;}' ./dspy/__metadata__.py
9494
- name: Build a binary wheel
9595
run: python3 -m build
96+
# Test the locally built wheel before publishing to pypi
97+
- name: Create test environment
98+
run: python -m venv test_before_pypi
99+
- name: Test package installation and functionality
100+
run: |
101+
source test_before_pypi/bin/activate
102+
# Install the locally built wheel and testing dependencies
103+
pip install dist/*.whl pytest
104+
pytest tests/metadata/test_metadata.py tests/predict
105+
deactivate
96106
- name: Publish distribution 📦 to PyPI (dspy)
97107
uses: pypa/gh-action-pypi-publish@release/v1
98108
with:

tests/metadata/test_metadata.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import dspy
2+
import re
3+
4+
5+
def test_metadata():
6+
assert dspy.__name__ == "dspy"
7+
assert re.match(r"\d+\.\d+\.\d+", dspy.__version__)
8+
assert dspy.__author__ == "Omar Khattab"
9+
assert dspy.__author_email__ == "[email protected]"
10+
assert dspy.__url__ == "https://github.com/stanfordnlp/dspy"
11+
assert dspy.__description__ == "DSPy"

0 commit comments

Comments
 (0)