Skip to content

Commit 157fcac

Browse files
authored
Merge pull request #11 from Becksteinlab/ci-cd
updated GitHub Actions workflow for package deployment
2 parents e37accf + e14e78d commit 157fcac

File tree

3 files changed

+188
-34
lines changed

3 files changed

+188
-34
lines changed

.github/workflows/deploy.yaml

Lines changed: 171 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and upload to PyPi
1+
name: Build and Deploy Package
22

33
on:
44
push:
@@ -9,45 +9,188 @@ on:
99
- published
1010

1111
jobs:
12-
test_pypi_push:
13-
environment:
14-
name: deploy
15-
url: https://test.pypi.org/p/mdpow-molconfgen
16-
permissions:
17-
id-token: write
18-
if: |
19-
github.repository == 'Becksteinlab/mdpow-molconfgen' &&
20-
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
21-
name: Build, upload and test pure Python wheels to TestPypi
12+
build:
13+
name: Build package
2214
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.x"
23+
24+
- name: Install build dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install build twine
28+
29+
- name: Build package (binary wheel and source distribution package)
30+
run: |
31+
python -m build
32+
33+
- name: Check package
34+
run: |
35+
twine check dist/*
2336
37+
- name: Upload dist files
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: dist-files
41+
path: dist/
42+
retention-days: 1
43+
44+
test-install:
45+
name: Test package installation
46+
runs-on: ubuntu-latest
47+
needs: build
2448
steps:
25-
- uses: actions/checkout@v4
49+
- name: Set up Python
50+
uses: actions/setup-python@v5
51+
with:
52+
python-version: "3.x"
2653

27-
- name: testpypi_deploy
28-
uses: MDAnalysis/pypi-deployment@main
29-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
54+
- name: Download dist files
55+
uses: actions/download-artifact@v4
3056
with:
31-
test_submission: true
32-
package_name: 'molconfgen'
57+
name: dist-files
58+
path: dist/
3359

34-
pypi_push:
60+
- name: Install package
61+
run: |
62+
python -m pip install --upgrade pip
63+
pip install dist/*.whl
64+
65+
- name: Test import
66+
run: |
67+
python -c "import molconfgen; print('Package imported successfully')"
68+
69+
test-pytest:
70+
name: Run tests
71+
runs-on: ubuntu-latest
72+
needs: build
73+
steps:
74+
- name: Set up Python
75+
uses: actions/setup-python@v5
76+
with:
77+
python-version: "3.x"
78+
79+
- name: Download dist files
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: dist-files
83+
path: dist/
84+
85+
- name: Install system dependencies (GROMACS)
86+
run: |
87+
sudo apt-get update
88+
sudo apt-get install -y gromacs
89+
90+
- name: Install package with test dependencies
91+
run: |
92+
python -m pip install --upgrade pip
93+
WHEEL_FILE=$(ls dist/*.whl)
94+
pip install "$WHEEL_FILE"[test]
95+
96+
- name: Run tests
97+
run: |
98+
pytest -n auto --verbose --pyargs molconfgen
99+
100+
deploy-testpypi:
101+
name: Deploy to TestPyPI
102+
runs-on: ubuntu-latest
103+
needs: [build, test-install, test-pytest]
104+
if: |
105+
github.repository == 'Becksteinlab/mdpow-molconfgen' &&
106+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
35107
environment:
36-
name: deploy
37-
url: https://pypi.org/p/mdpow-molconfgen
108+
name: testpypi
109+
url: https://test.pypi.org/p/mdpow-molconfgen
38110
permissions:
39-
id-token: write
111+
id-token: write # IMPORTANT: mandatory for trusted publishing
112+
steps:
113+
- name: Download dist files
114+
uses: actions/download-artifact@v4
115+
with:
116+
name: dist-files
117+
path: dist/
118+
119+
- name: Publish to TestPyPI
120+
uses: pypa/gh-action-pypi-publish@v1.12.4
121+
with:
122+
repository-url: https://test.pypi.org/legacy/
123+
124+
deploy-pypi:
125+
name: Deploy to PyPI
126+
runs-on: ubuntu-latest
127+
needs: [build, test-install, test-pytest]
40128
if: |
41129
github.repository == 'Becksteinlab/mdpow-molconfgen' &&
42130
(github.event_name == 'release' && github.event.action == 'published')
43-
name: Build, upload and test pure Python wheels to PyPi
44-
runs-on: ubuntu-latest
131+
environment:
132+
name: pypi
133+
url: https://pypi.org/p/mdpow-molconfgen
134+
permissions:
135+
id-token: write # IMPORTANT: mandatory for trusted publishing
136+
steps:
137+
- name: Download dist files
138+
uses: actions/download-artifact@v4
139+
with:
140+
name: dist-files
141+
path: dist/
45142

143+
- name: Publish to PyPI
144+
uses: pypa/gh-action-pypi-publish@v1.12.4
145+
146+
test-deployed-testpypi:
147+
name: Test deployed package (TestPyPI)
148+
runs-on: ubuntu-latest
149+
needs: deploy-testpypi
150+
if: |
151+
github.repository == 'Becksteinlab/mdpow-molconfgen' &&
152+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
46153
steps:
47-
- uses: actions/checkout@v4
154+
- name: Set up Python
155+
uses: actions/setup-python@v5
156+
with:
157+
python-version: "3.x"
48158

49-
- name: pypi_deploy
50-
uses: MDAnalysis/pypi-deployment@main
51-
if: github.event_name == 'release' && github.event.action == 'published'
159+
- name: Install from TestPyPI
160+
run: |
161+
python -m pip install --upgrade pip
162+
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ mdpow-molconfgen[test]
163+
164+
- name: Test import
165+
run: |
166+
python -c "import molconfgen; print('Package imported successfully from TestPyPI')"
167+
168+
- name: Run basic tests
169+
run: |
170+
python -c "import molconfgen; print('Package version:', molconfgen.__version__)"
171+
172+
test-deployed-pypi:
173+
name: Test deployed package (PyPI)
174+
runs-on: ubuntu-latest
175+
needs: deploy-pypi
176+
if: |
177+
github.repository == 'Becksteinlab/mdpow-molconfgen' &&
178+
(github.event_name == 'release' && github.event.action == 'published')
179+
steps:
180+
- name: Set up Python
181+
uses: actions/setup-python@v5
52182
with:
53-
package_name: 'molconfgen'
183+
python-version: "3.x"
184+
185+
- name: Install from PyPI
186+
run: |
187+
python -m pip install --upgrade pip
188+
pip install mdpow-molconfgen[test]
189+
190+
- name: Test import
191+
run: |
192+
python -c "import molconfgen; print('Package imported successfully from PyPI')"
193+
194+
- name: Run basic tests
195+
run: |
196+
python -c "import molconfgen; print('Package version:', molconfgen.__version__)"

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Generation of conformers of small molecules.
2626

2727

2828
### Initial testing systems ###
29-
From the [COW dataset](https://github.com/Becksteinlab/sampl5-distribution-water-cyclohexane/tree/master/11_validation_dataset92):
29+
From the [COW dataset](https://github.com/Becksteinlab/cow-dataset):
3030

3131
- V36-methylacetate : 1 dihedral
3232
- V46-2-methyl-1-nitrobenzene : steric hindrance
@@ -47,7 +47,17 @@ If possible, we strongly recommend that you use
4747
Below we provide instructions both for `mamba` and
4848
for `pip`.
4949

50-
#### With mamba
50+
Note that for some functionality you also need a working [GROMACS](https://www.gromacs.org) installation.
51+
52+
#### With pip from PyPi
53+
54+
You can directly install the [mdpow-molconfgen package](https://pypi.org/project/mdpow-molconfgen/) PyPi package with
55+
```
56+
pip install mdpow-molconfgen
57+
```
58+
This will install all dependencies (except GROMACS).
59+
60+
#### With mamba from source
5161

5262
Ensure that you have [mamba](https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html) installed.
5363

@@ -83,7 +93,7 @@ And when you are finished, you can exit the virtual environment with:
8393
mamba deactivate
8494
```
8595

86-
#### With pip
96+
#### With pip from source
8797

8898
To build the package from source, run:
8999

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ readme = "README.md"
2121
requires-python = ">=3.9"
2222
dependencies = [
2323
"MDAnalysis>=2.0.0",
24+
"pyedr",
2425
"rdkit",
2526
"numpy",
2627
"tqdm",
@@ -44,9 +45,9 @@ doc = [
4445
"sphinx_rtd_theme",
4546
]
4647

47-
# [project.urls]
48-
# source = "https://github.com/becksteinlab/mdpow-molconfgen"
49-
# documentation = "https://mdpow-molconfgen.readthedocs.io"
48+
[project.urls]
49+
source = "https://github.com/becksteinlab/mdpow-molconfgen"
50+
documentation = "https://mdpow-molconfgen.readthedocs.io"
5051

5152
[tool.setuptools]
5253
packages = ["molconfgen", "molconfgen.tests", "molconfgen.data"]

0 commit comments

Comments
 (0)