Skip to content

Commit daeee5c

Browse files
committed
updated deployment workflow
- based on gridData - removed MDAnalysis deployment action - use trusted publishing (as before)
1 parent cfb358e commit daeee5c

1 file changed

Lines changed: 161 additions & 31 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 161 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,50 +8,180 @@ on:
88
types:
99
- published
1010

11+
concurrency:
12+
group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}"
13+
cancel-in-progress: false
14+
15+
defaults:
16+
run:
17+
shell: bash -l {0}
18+
19+
1120
jobs:
12-
testpypi_push:
13-
environment:
14-
name: deploy
15-
url: https://test.pypi.org/p/MDAnalysisData
16-
permissions:
17-
id-token: write
18-
if: |
19-
github.repository == 'MDAnalysis/MDAnalysisData' &&
20-
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
21-
name: Build, upload and test pure Python wheels to TestPypi
21+
build:
22+
name: Build package
2223
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v6
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v6
30+
with:
31+
python-version: "3.14"
32+
33+
- name: Install build dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install build twine
37+
38+
- name: Build package (binary wheel and source distribution package)
39+
run: |
40+
python -m build
41+
42+
- name: Check package
43+
run: |
44+
twine check dist/*
2345
46+
- name: Upload dist files
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: dist-files
50+
path: dist/
51+
retention-days: 1
52+
53+
test-pytest:
54+
name: Run tests
55+
runs-on: ubuntu-latest
56+
needs: build
2457
steps:
25-
- uses: actions/checkout@v6
58+
- name: Set up Python
59+
uses: actions/setup-python@v6
60+
with:
61+
python-version: "3.14"
2662

27-
- name: testpypi_deploy
28-
uses: MDAnalysis/pypi-deployment@main
29-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
63+
- name: Download dist files
64+
uses: actions/download-artifact@v4
3065
with:
31-
test_submission: true
32-
package_name: MDAnalysisData
33-
module_name: 'MDAnalysisData'
34-
test_deps: 'pytest pytest-mock'
66+
name: dist-files
67+
path: dist/
3568

36-
pypi_push:
69+
- name: Install package with test dependencies and tests
70+
run: |
71+
python -m pip install --upgrade pip
72+
WHEEL_FILE=$(ls dist/*.whl)
73+
pip install "$WHEEL_FILE"[test]
74+
75+
- name: Test import
76+
run: |
77+
python -c "import MDAnalysisData; print(f'Package {MDAnalysisData.__version__} imported successfully')"
78+
79+
- name: Run basic tests
80+
run: |
81+
pytest --verbose --pyargs MDAnalysisData
82+
83+
deploy-testpypi:
84+
name: Deploy to TestPyPI
85+
runs-on: ubuntu-latest
86+
needs: [build, test-pytest]
87+
if: |
88+
github.repository == 'MDAnalysis/MDAnalysisData' &&
89+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
3790
environment:
38-
name: deploy
39-
url: https://pypi.org/p/MDAnalysisData
91+
name: testpypi
92+
url: https://test.pypi.org/p/MDAnalysisData
4093
permissions:
41-
id-token: write
94+
id-token: write # IMPORTANT: mandatory for trusted publishing
95+
steps:
96+
- name: Download dist files
97+
uses: actions/download-artifact@v4
98+
with:
99+
name: dist-files
100+
path: dist/
101+
102+
- name: Publish to TestPyPI
103+
uses: pypa/gh-action-pypi-publish@v1.13.0
104+
with:
105+
repository-url: https://test.pypi.org/legacy/
106+
107+
deploy-pypi:
108+
name: Deploy to PyPI
109+
runs-on: ubuntu-latest
110+
needs: [build, test-pytest]
42111
if: |
43112
github.repository == 'MDAnalysis/MDAnalysisData' &&
44113
(github.event_name == 'release' && github.event.action == 'published')
45-
name: Build, upload and test pure Python wheels to PyPi
46-
runs-on: ubuntu-latest
114+
environment:
115+
name: pypi
116+
url: https://pypi.org/p/MDAnalysisData
117+
permissions:
118+
id-token: write # IMPORTANT: mandatory for trusted publishing
119+
steps:
120+
- name: Download dist files
121+
uses: actions/download-artifact@v4
122+
with:
123+
name: dist-files
124+
path: dist/
125+
126+
- name: Publish to PyPI
127+
uses: pypa/gh-action-pypi-publish@v1.13.0
47128

129+
test-deployed-testpypi:
130+
name: Test deployed package (TestPyPI)
131+
runs-on: ${{ matrix.os }}
132+
strategy:
133+
fail-fast: false
134+
matrix:
135+
os: [ubuntu-latest, macos-latest]
136+
needs: deploy-testpypi
137+
if: |
138+
github.repository == 'MDAnalysis/MDAnalysisData' &&
139+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
48140
steps:
49-
- uses: actions/checkout@v6
141+
- name: Set up Python
142+
uses: actions/setup-python@v6
143+
with:
144+
python-version: "3.14"
145+
146+
- name: Install from TestPyPI
147+
run: |
148+
python -m pip install --upgrade pip
149+
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ MDAnalysisData[test]
50150
51-
- name: pypi_deploy
52-
uses: MDAnalysis/pypi-deployment@main
53-
if: github.event_name == 'release' && github.event.action == 'published'
151+
- name: Test import
152+
run: |
153+
python -c "import MDAnalysisData; print(f'Package {MDAnalysisData.__version__} imported successfully from TestPyPi')"
154+
155+
- name: Run basic tests
156+
run: |
157+
pytest --verbose --pyargs MDAnalysisData
158+
159+
test-deployed-pypi:
160+
name: Test deployed package (PyPI)
161+
runs-on: ${{ matrix.os }}
162+
strategy:
163+
fail-fast: false
164+
matrix:
165+
os: [ubuntu-latest, macos-latest]
166+
needs: deploy-pypi
167+
if: |
168+
github.repository == 'MDAnalysis/MDAnalysisData' &&
169+
(github.event_name == 'release' && github.event.action == 'published')
170+
steps:
171+
- name: Set up Python
172+
uses: actions/setup-python@v6
54173
with:
55-
package_name: MDAnalysisData
56-
module_name: 'MDAnalysisData'
57-
test_deps: 'pytest pytest-mock'
174+
python-version: "3.14"
175+
176+
- name: Install from PyPI
177+
run: |
178+
python -m pip install --upgrade pip
179+
pip install MDAnalysisData[test]
180+
181+
- name: Test import
182+
run: |
183+
python -c "import MDAnalysisData; print(f'Package {MDAnalysisData.__version__} imported successfully from PyPi')"
184+
185+
- name: Run basic tests
186+
run: |
187+
pytest --verbose --pyargs MDAnalysisData

0 commit comments

Comments
 (0)