Skip to content

Commit f45d52b

Browse files
authored
ensure testing of built version after deployment (#159)
* ensure testing of built version after deployment - fix #158 - remember version that was built - wait for 30s on PyPi/TestPyPi - ensure that we download the built version from TestPyPi or PyPi * updated outdated actions in gh-ci and docs workflow
1 parent b29c1f4 commit f45d52b

3 files changed

Lines changed: 53 additions & 21 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ jobs:
2121
build:
2222
name: Build package
2323
runs-on: ubuntu-latest
24+
outputs:
25+
version: ${{ steps.extract-version.outputs.version }}
2426
steps:
2527
- name: Checkout
26-
uses: actions/checkout@v4
28+
uses: actions/checkout@v6
2729

2830
- name: Set up Python
29-
uses: actions/setup-python@v5
31+
uses: actions/setup-python@v6
3032
with:
3133
python-version: "3.14"
3234

@@ -43,8 +45,26 @@ jobs:
4345
run: |
4446
twine check dist/*
4547
48+
- name: Extract package version
49+
id: extract-version
50+
run: |
51+
WHEEL_FILE=$(ls dist/*.whl)
52+
# Extract version from wheel filename (format: griddataformats-VERSION-py3-none-any.whl)
53+
VERSION=$(basename "$WHEEL_FILE" | sed -n 's/griddataformats-\([^-]*\)-.*/\1/p')
54+
# Fallback: install wheel temporarily and get version
55+
if [ -z "$VERSION" ]; then
56+
# This is a bit dirty; running in a virtual environment would be cleaner.
57+
# (pip install only works because our package's dependencies are easy to install.)
58+
python -m pip install --upgrade pip
59+
pip install "$WHEEL_FILE" --quiet
60+
VERSION=$(python -c "import gridData; print(gridData.__version__)")
61+
pip uninstall -y griddataformats --quiet
62+
fi
63+
echo "version=$VERSION" >> $GITHUB_OUTPUT
64+
echo "Extracted version: $VERSION"
65+
4666
- name: Upload dist files
47-
uses: actions/upload-artifact@v4
67+
uses: actions/upload-artifact@v7
4868
with:
4969
name: dist-files
5070
path: dist/
@@ -56,12 +76,12 @@ jobs:
5676
needs: build
5777
steps:
5878
- name: Set up Python
59-
uses: actions/setup-python@v5
79+
uses: actions/setup-python@v6
6080
with:
6181
python-version: "3.14"
6282

6383
- name: Download dist files
64-
uses: actions/download-artifact@v4
84+
uses: actions/download-artifact@v8
6585
with:
6686
name: dist-files
6787
path: dist/
@@ -94,7 +114,7 @@ jobs:
94114
id-token: write # IMPORTANT: mandatory for trusted publishing
95115
steps:
96116
- name: Download dist files
97-
uses: actions/download-artifact@v4
117+
uses: actions/download-artifact@v8
98118
with:
99119
name: dist-files
100120
path: dist/
@@ -118,7 +138,7 @@ jobs:
118138
id-token: write # IMPORTANT: mandatory for trusted publishing
119139
steps:
120140
- name: Download dist files
121-
uses: actions/download-artifact@v4
141+
uses: actions/download-artifact@v8
122142
with:
123143
name: dist-files
124144
path: dist/
@@ -133,20 +153,26 @@ jobs:
133153
fail-fast: false
134154
matrix:
135155
os: [ubuntu-latest, macos-latest]
136-
needs: deploy-testpypi
156+
needs: [build, deploy-testpypi]
137157
if: |
138158
github.repository == 'MDAnalysis/GridDataFormats' &&
139159
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
140160
steps:
141161
- name: Set up Python
142-
uses: actions/setup-python@v5
162+
uses: actions/setup-python@v6
143163
with:
144164
python-version: "3.14"
145165

166+
- name: Checkout repository for actions
167+
uses: actions/checkout@v6
168+
169+
- name: Wait for version to be available on TestPyPI (30 seconds)
170+
run: sleep 30
171+
146172
- name: Install from TestPyPI
147173
run: |
148174
python -m pip install --upgrade pip
149-
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ GridDataFormats[test]
175+
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ "GridDataFormats[test]==${{ needs.build.outputs.version }}"
150176
151177
- name: Test import
152178
run: |
@@ -163,20 +189,26 @@ jobs:
163189
fail-fast: false
164190
matrix:
165191
os: [ubuntu-latest, macos-latest]
166-
needs: deploy-pypi
192+
needs: [build, deploy-pypi]
167193
if: |
168194
github.repository == 'MDAnalysis/GridDataFormats' &&
169195
(github.event_name == 'release' && github.event.action == 'published')
170196
steps:
171197
- name: Set up Python
172-
uses: actions/setup-python@v5
198+
uses: actions/setup-python@v6
173199
with:
174200
python-version: "3.14"
175201

202+
- name: Checkout repository for actions
203+
uses: actions/checkout@v6
204+
205+
- name: Wait for version to be available on PyPI (30 seconds)
206+
run: sleep 30
207+
176208
- name: Install from PyPI
177209
run: |
178210
python -m pip install --upgrade pip
179-
pip install GridDataFormats[test]
211+
pip install "GridDataFormats[test]==${{ needs.build.outputs.version }}"
180212
181213
- name: Test import
182214
run: |

.github/workflows/docs.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ jobs:
2121
runs-on: ubuntu-latest
2222

2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v6
2525
with:
2626
fetch-depth: 0
2727

2828
- name: "Setup Micromamba"
29-
uses: mamba-org/setup-micromamba@v2
29+
uses: mamba-org/setup-micromamba@v3
3030
with:
3131
environment-file: ci/environment.yaml
3232
environment-name: griddata_env
3333
create-args: >-
34-
python=3.11
34+
python=3.14
3535
init-shell: bash
3636

3737
- name: install package
@@ -43,7 +43,7 @@ jobs:
4343
cd doc && sphinx-build -b html source build
4444
4545
- name: deploy docs
46-
uses: peaceiris/actions-gh-pages@v3
46+
uses: peaceiris/actions-gh-pages@v4
4747
if: github.event_name != 'pull_request'
4848
with:
4949
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/gh-ci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ jobs:
3434
python-version: "3.14"
3535

3636
steps:
37-
- uses: actions/checkout@v4
37+
- uses: actions/checkout@v6
3838

3939
- name: setup_micromamba
40-
uses: mamba-org/setup-micromamba@v2
40+
uses: mamba-org/setup-micromamba@v3
4141
with:
4242
environment-name: mda
4343
create-args: >-
@@ -67,10 +67,10 @@ jobs:
6767
pytest -v --cov=gridData --cov-report=xml --color=yes ./gridData/tests
6868
6969
- name: codecov
70-
uses: codecov/codecov-action@v4
70+
uses: codecov/codecov-action@v6
7171
if: github.event_name != 'schedule'
7272
with:
73-
file: coverage.xml
73+
files: coverage.xml
7474
fail_ci_if_error: True
7575
verbose: True
7676
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)