@@ -15,15 +15,19 @@ concurrency:
1515defaults :
1616 run :
1717 shell : bash -l {0}
18-
1918
2019jobs :
2120 build :
2221 name : Build package
2322 runs-on : ubuntu-latest
23+ outputs :
24+ version : ${{ steps.extract-version.outputs.version }}
2425 steps :
2526 - name : Checkout
2627 uses : actions/checkout@v6
28+ with :
29+ fetch-depth : 0
30+ fetch-tags : true
2731
2832 - name : Set up Python
2933 uses : actions/setup-python@v6
@@ -36,12 +40,24 @@ jobs:
3640 pip install build twine
3741
3842 - name : Build package (binary wheel and source distribution package)
39- run : |
40- python -m build
43+ run : python -m build
4144
4245 - name : Check package
46+ run : twine check dist/*
47+
48+ - name : Extract package version
49+ id : extract-version
4350 run : |
44- twine check dist/*
51+ WHEEL_FILE=$(ls dist/*.whl)
52+ VERSION=$(basename "$WHEEL_FILE" | sed -n 's/mdanalysisdata-\([^-]*\)-.*/\1/p')
53+ if [ -z "$VERSION" ]; then
54+ python -m pip install --upgrade pip
55+ pip install "$WHEEL_FILE" --quiet
56+ VERSION=$(python -c "import MDAnalysisData; print(MDAnalysisData.__version__)")
57+ pip uninstall -y MDAnalysisData --quiet
58+ fi
59+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
60+ echo "Extracted version: $VERSION"
4561
4662 - name : Upload dist files
4763 uses : actions/upload-artifact@v7
@@ -70,13 +86,13 @@ jobs:
7086 run : |
7187 python -m pip install --upgrade pip
7288 WHEEL_FILE=$(ls dist/*.whl)
73- pip install "$WHEEL_FILE" [test]
89+ pip install "${ WHEEL_FILE} [test]"
7490
7591 - name : Test import
7692 run : |
7793 python -c "import MDAnalysisData; print(f'Package {MDAnalysisData.__version__} imported successfully')"
7894
79- - name : Run basic tests
95+ - name : Run tests (without data file downloads)
8096 run : |
8197 pytest --verbose -m "not online" --pyargs MDAnalysisData
8298
@@ -134,7 +150,7 @@ jobs:
134150 fail-fast : false
135151 matrix :
136152 os : [ubuntu-latest, macos-latest]
137- needs : deploy-testpypi
153+ needs : [build, deploy-testpypi]
138154 if : |
139155 github.repository == 'MDAnalysis/MDAnalysisData' &&
140156 (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
@@ -144,16 +160,26 @@ jobs:
144160 with :
145161 python-version : " 3.14"
146162
163+ - name : Checkout repository for actions
164+ uses : actions/checkout@v6
165+
166+ - name : Wait for version to be available on TestPyPI
167+ uses : ./.github/actions/wait-for-pypi-version
168+ with :
169+ repository : testpypi
170+ package : MDAnalysisData
171+ version : ${{ needs.build.outputs.version }}
172+
147173 - name : Install from TestPyPI
148174 run : |
149175 python -m pip install --upgrade pip
150- pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ MDAnalysisData[test]
176+ pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ " MDAnalysisData[test]==${{ needs.build.outputs.version }}"
151177
152178 - name : Test import
153179 run : |
154180 python -c "import MDAnalysisData; print(f'Package {MDAnalysisData.__version__} imported successfully from TestPyPi')"
155181
156- - name : Run basic tests
182+ - name : Run tests
157183 run : |
158184 pytest --verbose -m "not online" --pyargs MDAnalysisData
159185
@@ -164,7 +190,7 @@ jobs:
164190 fail-fast : false
165191 matrix :
166192 os : [ubuntu-latest, macos-latest]
167- needs : deploy-pypi
193+ needs : [build, deploy-pypi]
168194 if : |
169195 github.repository == 'MDAnalysis/MDAnalysisData' &&
170196 (github.event_name == 'release' && github.event.action == 'published')
@@ -174,15 +200,25 @@ jobs:
174200 with :
175201 python-version : " 3.14"
176202
203+ - name : Checkout repository for actions
204+ uses : actions/checkout@v6
205+
206+ - name : Wait for version to be available on PyPI
207+ uses : ./.github/actions/wait-for-pypi-version
208+ with :
209+ repository : pypi
210+ package : MDAnalysisData
211+ version : ${{ needs.build.outputs.version }}
212+
177213 - name : Install from PyPI
178214 run : |
179215 python -m pip install --upgrade pip
180- pip install MDAnalysisData[test]
216+ pip install " MDAnalysisData[test]==${{ needs.build.outputs.version }}"
181217
182218 - name : Test import
183219 run : |
184220 python -c "import MDAnalysisData; print(f'Package {MDAnalysisData.__version__} imported successfully from PyPi')"
185221
186- - name : Run basic tests
222+ - name : Run tests
187223 run : |
188224 pytest --verbose -m "not online" --pyargs MDAnalysisData
0 commit comments