Skip to content

Commit 297938e

Browse files
committed
Add smoke test and upgrade test to release build workflow
After wheels are built: - smoke_test: install from wheel, download en_core_web_sm, verify entities - upgrade_test: install previous spacy, download model, upgrade from wheel, verify model still loads and produces entities
1 parent fdca647 commit 297938e

1 file changed

Lines changed: 83 additions & 0 deletions

File tree

.github/workflows/cibuildwheel.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,86 @@ jobs:
2222
secrets:
2323
gh-token: ${{ secrets.GITHUB_TOKEN }}
2424

25+
smoke_test:
26+
name: Smoke test
27+
needs: build_wheels
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: read
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- uses: actions/setup-python@v5
35+
with:
36+
python-version: "3.12"
37+
38+
- uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1
39+
with:
40+
tag: ${{ github.ref_name }}
41+
fileName: "spacy-*cp312*manylinux*x86_64*.whl"
42+
out-file-path: "dist"
43+
44+
- name: Install from wheel
45+
run: |
46+
WHEEL=$(ls dist/spacy-*cp312*manylinux*x86_64*.whl | head -1)
47+
pip install "$WHEEL"
48+
49+
- name: Test import
50+
run: python -c "import spacy; print('spacy==' + spacy.__version__)"
51+
52+
- name: Download and load model
53+
run: |
54+
python -m spacy download en_core_web_sm
55+
python -c "
56+
import spacy
57+
nlp = spacy.load('en_core_web_sm')
58+
doc = nlp('Apple is looking at buying U.K. startup for \$1 billion')
59+
assert len(doc.ents) > 0, 'No entities found'
60+
print('Model load OK:', nlp.meta['name'], '@', nlp.meta['version'])
61+
print('Entities:', [(ent.text, ent.label_) for ent in doc.ents])
62+
"
63+
64+
upgrade_test:
65+
name: Upgrade test
66+
needs: build_wheels
67+
runs-on: ubuntu-latest
68+
permissions:
69+
contents: read
70+
steps:
71+
- uses: actions/checkout@v4
72+
73+
- uses: actions/setup-python@v5
74+
with:
75+
python-version: "3.12"
76+
77+
- name: Install previous spaCy version
78+
run: |
79+
pip install "spacy>=3.8.0,<${{ github.ref_name }}" || pip install "spacy<4"
80+
python -m spacy download en_core_web_sm
81+
python -c "
82+
import spacy
83+
nlp = spacy.load('en_core_web_sm')
84+
print('Pre-upgrade:', spacy.__version__, nlp.meta['name'], '@', nlp.meta['version'])
85+
"
86+
87+
- uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1
88+
with:
89+
tag: ${{ github.ref_name }}
90+
fileName: "spacy-*cp312*manylinux*x86_64*.whl"
91+
out-file-path: "dist"
92+
93+
- name: Upgrade to new version
94+
run: |
95+
WHEEL=$(ls dist/spacy-*cp312*manylinux*x86_64*.whl | head -1)
96+
pip install "$WHEEL"
97+
98+
- name: Test model still loads after upgrade
99+
run: |
100+
python -c "
101+
import spacy
102+
nlp = spacy.load('en_core_web_sm')
103+
doc = nlp('Apple is looking at buying U.K. startup for \$1 billion')
104+
assert len(doc.ents) > 0, 'No entities found after upgrade'
105+
print('Post-upgrade:', spacy.__version__, nlp.meta['name'], '@', nlp.meta['version'])
106+
print('Entities:', [(ent.text, ent.label_) for ent in doc.ents])
107+
"

0 commit comments

Comments
 (0)