Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/torchnep-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish TorchNEP to PyPI

# Publishes the torchnep/ package to PyPI. Triggered by pushing a tag of the
# form `torchnep-vX.Y.Z` (a dedicated prefix so it never clashes with GPUMD's
# own version tags). The published version comes from torchnep/__init__.py
# (__version__) — bump it before tagging. `workflow_dispatch` allows a manual,
# non-publishing build for verification (publish step is skipped unless tagged).
on:
push:
tags:
- 'torchnep-v*'
workflow_dispatch:

jobs:
build:
name: Build sdist + wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Build distributions
run: |
python -m pip install --upgrade pip build twine
python -m build torchnep --outdir dist
twine check dist/*

- uses: actions/upload-artifact@v4
with:
name: torchnep-dist
path: dist/

publish:
name: Publish to PyPI
needs: build
# Only publish on an actual tag push, never on manual/dispatch dry runs.
if: startsWith(github.ref, 'refs/tags/torchnep-v')
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # required for PyPI Trusted Publishing (OIDC)
steps:
- uses: actions/download-artifact@v4
with:
name: torchnep-dist
path: dist/

- uses: pypa/gh-action-pypi-publish@release/v1
48 changes: 48 additions & 0 deletions .github/workflows/torchnep-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: TorchNEP tests

# Run the TorchNEP pytest suite only when TorchNEP *code* changes — i.e. a .py
# file under torchnep/, the package config, or this workflow itself. Doc-only
# edits (README, etc.) do NOT trigger it, and ordinary GPUMD (C++/CUDA) pull
# requests are unaffected.
on:
pull_request:
paths:
- 'torchnep/**.py'
- 'torchnep/pyproject.toml'
- '.github/workflows/torchnep-test.yml'
push:
branches: [master]
paths:
- 'torchnep/**.py'
- 'torchnep/pyproject.toml'
- '.github/workflows/torchnep-test.yml'

defaults:
run:
working-directory: torchnep

jobs:
test:
name: pytest (CPU, py3.10)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip

- name: Install CPU PyTorch + TorchNEP (with test extras)
run: |
python -m pip install --upgrade pip
# CPU-only torch wheel — keeps CI light and avoids CUDA downloads.
pip install torch --index-url https://download.pytorch.org/whl/cpu
# torch is already satisfied above; this pulls numpy + ase + pytest.
pip install -e '.[torch,ase,dev]'

- name: Run tests (CPU)
env:
TEST_DEVICE: cpu
run: pytest -q
Loading
Loading