Skip to content

Commit e93ca07

Browse files
authored
Merge pull request #13 from zirenjin/master
fix: passing github tests
2 parents c5eddb2 + b52dc0e commit e93ca07

24 files changed

Lines changed: 112 additions & 89 deletions

.github/workflows/build_wheel.yml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.2.24/uv-installer.sh | sh
6060
if: runner.os != 'Linux'
6161
- name: Build wheels
62-
uses: pypa/cibuildwheel@v3.4
62+
uses: pypa/cibuildwheel@v4.0
6363
env:
6464
CIBW_BUILD_VERBOSITY: 1
6565
CIBW_ARCHS: all
@@ -143,15 +143,37 @@ jobs:
143143
images: ghcr.io/deepmodeling/deepmd-kit
144144

145145
- name: Build and push Docker image
146-
uses: docker/build-push-action@v7
147-
with:
148-
context: source/install/docker
149-
push: ${{ github.repository_owner == 'deepmodeling' && github.event_name == 'push' && github.actor != 'dependabot[bot]' }}
150-
tags: ${{ steps.meta.outputs.tags }}${{ matrix.variant }}
151-
labels: ${{ steps.meta.outputs.labels }}
152-
build-args: |
153-
VARIANT=${{ matrix.variant }}
154-
CUDA_VERSION=${{ matrix.cuda_version }}
146+
run: |
147+
set -eo pipefail
148+
should_push="${{ github.repository_owner == 'deepmodeling' && github.event_name == 'push' && github.actor != 'dependabot[bot]' }}"
149+
echo "${{ steps.meta.outputs.tags }}${{ matrix.variant }}" > /tmp/docker_tags.txt
150+
echo "${{ steps.meta.outputs.labels }}" > /tmp/docker_labels.txt
151+
# Build args as a bash array so values with spaces survive word splitting.
152+
args=(
153+
--file source/install/docker/Dockerfile
154+
--build-arg "VARIANT=${{ matrix.variant }}"
155+
--build-arg "CUDA_VERSION=${{ matrix.cuda_version }}"
156+
)
157+
while IFS= read -r t; do
158+
[ -n "$t" ] && args+=(-t "$t")
159+
done < /tmp/docker_tags.txt
160+
while IFS= read -r l; do
161+
[ -n "$l" ] && args+=(--label "$l")
162+
done < /tmp/docker_labels.txt
163+
[ "$should_push" = "true" ] && args+=(--push)
164+
max_retry=3
165+
for i in $(seq 1 $max_retry); do
166+
echo "Docker build attempt $i/$max_retry ..."
167+
set +e
168+
docker buildx build "${args[@]}" source/install/docker
169+
ec=$?
170+
set -e
171+
[ $ec -eq 0 ] && exit 0
172+
echo "Docker build failed (exit $ec), retrying in 5s ..."
173+
sleep 5
174+
done
175+
echo "Docker build failed after $max_retry attempts."
176+
exit 1
155177
156178
build_pypi_index:
157179
needs: [build_wheels, build_sdist]

.github/workflows/property_tools_tests.yml renamed to .github/workflows/dpa_adapt_tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
name: DeePMD Property Tools Tests
1+
name: dpa_adapt Tests
22

33
on:
44
push:
55
paths:
6-
- "deepmd/dpa_adapt/**"
6+
- "dpa_adapt/**"
77
- "source/tests/dpa_adapt/**"
8-
- ".github/workflows/property_tools_tests.yml"
8+
- ".github/workflows/dpa_adapt_tests.yml"
99
pull_request:
1010
paths:
11-
- "deepmd/dpa_adapt/**"
11+
- "dpa_adapt/**"
1212
- "source/tests/dpa_adapt/**"
13-
- ".github/workflows/property_tools_tests.yml"
13+
- ".github/workflows/dpa_adapt_tests.yml"
1414

1515
jobs:
1616
test:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,4 @@ frozen_model.*
7474
# Test system directories
7575
system/
7676
*.expected
77+
examples/dpa_adapt/raw/

dpa_adapt/data/smiles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""SMILES → 3D coordinates → deepmd/npy conversion.
33
44
Provides the molecular data ingestion pipeline originally from
5-
``deepmd_property_tools``:
5+
``dpa_adapt``:
66
77
- Parse CSV files with SMILES (or pre-generated MOL files) and property labels
88
- Generate 3D conformers via RDKit (ETKDGv3 + MMFF/UFF optimisation)

source/tests/dpa_adapt/test_auto_convert.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
except ImportError:
1919
_HAS_RDKIT = False
2020

21-
from deepmd.dpa_adapt.data.convert import (
21+
from dpa_adapt.data.convert import (
2222
_is_smiles_input,
2323
_sniff_csv,
2424
_sniff_xlsx,
@@ -184,7 +184,7 @@ class TestSmoke:
184184
"""Minimal round-trip: SMILES → npy → load_data."""
185185

186186
def test_smiles_round_trip(self, tmp_path):
187-
from deepmd.dpa_adapt.data.loader import (
187+
from dpa_adapt.data.loader import (
188188
load_data,
189189
)
190190

source/tests/dpa_adapt/test_backend_contract.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: LGPL-3.0-or-later
2-
"""Contract tests for ``deepmd.dpa_adapt._backend``.
2+
"""Contract tests for ``dpa_adapt._backend``.
33
44
These tests call **real** deepmd APIs — no mocks — on a minimal synthetic
55
DPA-3 descriptor model. Their purpose is to catch silent breakage when
@@ -134,7 +134,7 @@ class TestBackendContract:
134134
def _require_deepmd(self):
135135
"""Skip if the deepmd model builder is not usable."""
136136
try:
137-
from deepmd.dpa_adapt._backend import (
137+
from dpa_adapt._backend import (
138138
build_model_from_config,
139139
)
140140

@@ -147,7 +147,7 @@ def _extractor(self):
147147
"""Build a model + extractor, yield it, then **always** disable the
148148
descriptor hook so a test failure never leaks global state.
149149
"""
150-
from deepmd.dpa_adapt._backend import (
150+
from dpa_adapt._backend import (
151151
_DescriptorExtraction,
152152
build_model_from_config,
153153
)
@@ -163,7 +163,7 @@ def _extractor(self):
163163

164164
def test_build_model_from_config(self):
165165
"""``build_model_from_config`` succeeds with minimal config."""
166-
from deepmd.dpa_adapt._backend import (
166+
from dpa_adapt._backend import (
167167
build_model_from_config,
168168
)
169169

@@ -258,7 +258,7 @@ def test_get_torch_device_returns_device(self):
258258
if isinstance(sys.modules.get("torch"), MagicMock):
259259
pytest.skip("torch is mocked by another test")
260260

261-
from deepmd.dpa_adapt._backend import (
261+
from dpa_adapt._backend import (
262262
get_torch_device,
263263
)
264264

@@ -276,7 +276,7 @@ def test_load_torch_file_roundtrip(self, tmp_path):
276276

277277
import torch
278278

279-
from deepmd.dpa_adapt._backend import (
279+
from dpa_adapt._backend import (
280280
load_torch_file,
281281
)
282282

@@ -296,7 +296,7 @@ def test_freeze_bundle_has_format_version(self, tmp_path):
296296
patch,
297297
)
298298

299-
from deepmd.dpa_adapt import (
299+
from dpa_adapt import (
300300
DPAFineTuner,
301301
)
302302

@@ -322,7 +322,7 @@ def _fake_extract(self, systems):
322322
ft.fit(str(system), target_key="energy")
323323
frozen = ft.freeze(str(tmp_path / "model.pth"))
324324

325-
from deepmd.dpa_adapt._backend import (
325+
from dpa_adapt._backend import (
326326
load_torch_file,
327327
)
328328

source/tests/dpa_adapt/test_cache.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
import numpy as np
55

6-
from deepmd.dpa_adapt.data.desc_cache import (
6+
from dpa_adapt.data.desc_cache import (
77
_cache_dir,
88
_cache_key,
99
_data_fingerprint,
1010
_per_system_cache_path,
1111
_system_fingerprint,
1212
ensure_per_system_cache,
1313
)
14-
from deepmd.dpa_adapt.data.loader import (
14+
from dpa_adapt.data.loader import (
1515
load_data,
1616
)
1717

@@ -123,7 +123,7 @@ def _extract_features(inner_self, systems):
123123
return np.zeros((2, 8))
124124

125125
monkeypatch.setattr(
126-
"deepmd.dpa_adapt.finetuner.DPAFineTuner",
126+
"dpa_adapt.finetuner.DPAFineTuner",
127127
FakeFineTuner,
128128
)
129129
ensure_per_system_cache(
@@ -150,7 +150,7 @@ def _extract_features(inner_self, systems):
150150
_device = None
151151

152152
monkeypatch.setattr(
153-
"deepmd.dpa_adapt.finetuner.DPAFineTuner",
153+
"dpa_adapt.finetuner.DPAFineTuner",
154154
FakeFineTuner,
155155
)
156156
ensure_per_system_cache(

source/tests/dpa_adapt/test_conditions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ def _pickle_load(path, **kwargs):
3434

3535
sys.modules.setdefault("torch", _mock_torch)
3636

37-
from deepmd.dpa_adapt import (
37+
from dpa_adapt import (
3838
DPAFineTuner,
3939
DPAPredictor,
4040
)
41-
from deepmd.dpa_adapt.conditions import (
41+
from dpa_adapt.conditions import (
4242
ConditionManager,
4343
DPAConditionError,
4444
)

source/tests/dpa_adapt/test_config_merge.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# SPDX-License-Identifier: LGPL-3.0-or-later
2-
"""Tests for recursive dict merge (was deepmd_property_tools ConfigHandler)."""
2+
"""Tests for recursive dict merge (was dpa_adapt ConfigHandler)."""
33

44
from __future__ import (
55
annotations,
66
)
77

8-
from deepmd.dpa_adapt.data.smiles import _deep_merge # re-exported for reuse
8+
from dpa_adapt.data.smiles import _deep_merge # re-exported for reuse
99

1010

1111
def test_merge_deep_updates_nested_dicts() -> None:

0 commit comments

Comments
 (0)