Skip to content
Merged
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
48 changes: 25 additions & 23 deletions .github/workflows/interface.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ jobs:
prefix: Bi2Se3_advanced
basis: lcao

defaults:
run:
working-directory: interfaces/Wannier90_interface/examples_python

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -36,7 +40,7 @@ jobs:
- name: Install abacusw90
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e ..

- name: Confirm no wannier90.x in environment
run: |
Expand All @@ -46,12 +50,6 @@ jobs:
fi
echo "OK: no wannier90.x (dryrun mode)"

# ================================================================
# Shared mock + patch
# NOTE: env: MUST be a sibling of run: (same indent level).
# run: uses block scalar literal (|) so the heredoc inside
# is passed to bash with YAML indentation stripped.
# ================================================================
- name: Create mock data & patch script
env:
SCRIPT: ${{ matrix.script }}
Expand Down Expand Up @@ -90,11 +88,22 @@ jobs:
os.makedirs(d, exist_ok=True)

# ── 3. Mock STRU (scf/ + wannier/) ────────────────────
stru = textwrap.dedent("""\
ATOMIC_SPECIES
Bi 208.980 Bi.upf
Se 78.960 Se.upf

if basis == "pw":
atom_species = (
"ATOMIC_SPECIES\n"
"Bi 208.980 Bi_pbe_fr.upf\n"
"Se 78.960 Bi_pbe_fr.upf\n"
"\n"
)
else:
atom_species = (
"ATOMIC_SPECIES\n"
"Bi 208.980 Bi_pbe_fr.upf Bi_gga_10au_100Ry_2s2p2d.orb\n"
"Se 78.960 Bi_pbe_fr.upf Se_gga_10au_100Ry_2s2p2d.orb\n"
"\n"
)

lattice_block = textwrap.dedent("""\
LATTICE_CONSTANT
1.0

Expand All @@ -115,6 +124,8 @@ jobs:
0.206 0.206 0.118 1 1 1
0.794 0.794 0.882 1 1 1
""")

stru = atom_species + lattice_block
for d in [f"{prefix}/scf", f"{prefix}/wannier"]:
p = os.path.join(d, "STRU")
with open(p, "w") as f:
Expand Down Expand Up @@ -161,9 +172,9 @@ jobs:
print(f"[mock] {nnkp} ({len(lines)} lines)")

# ── 5. Mock PP & ORB files ─────────────────────────────
orb_dir = "tests/PP_ORB/for_interface/Wannier90_interface"
orb_dir = os.path.abspath("../../../tests/PP_ORB/")
os.makedirs(orb_dir, exist_ok=True)
for name in ["Bi.upf", "Se.upf", "Bi.orb", "Se.orb"]:
for name in ["Bi_pbe_fr.upf", "Se_pbe_fr.upf", "Bi_gga_10au_100Ry_2s2p2d.orb", "Se_gga_10au_100Ry_2s2p2d.orb"]:
p = os.path.join(orb_dir, name)
with open(p, "w") as f:
f.write("# mock for CI dryrun\n")
Expand All @@ -172,15 +183,9 @@ jobs:
print("\n[done] all mocks ready")
PYEOF

# ================================================================
# Run
# ================================================================
- name: Run ${{ matrix.script }} — dryrun
run: python ${{ matrix.script }} 2>&1 | tee run.log

# ================================================================
# Validate
# ================================================================
- name: Check dryrun completion banner
run: |
if grep -q "DRY RUN COMPLETE" run.log; then
Expand Down Expand Up @@ -269,9 +274,6 @@ jobs:
echo " ALL CHECKS PASSED (${{ matrix.name }})"
echo "=========================================="

# ================================================================
# Debug (always runs, even on failure)
# ================================================================
- name: Show full script output
if: always()
run: cat run.log
Expand Down
Loading