phonopy test with PHONOPY_NO_C_EXT (Rust-only backend) workflow (phonopy/phonopy)
The phonopy test with PHONOPY_NO_C_EXT (Rust-only backend) workflow from phonopy/phonopy, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the phonopy test with PHONOPY_NO_C_EXT (Rust-only backend) workflow from the phonopy/phonopy repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: phonopy test with PHONOPY_NO_C_EXT (Rust-only backend)
# Run the test suite against a wheel built with PHONOPY_NO_C_EXT=1. This
# verifies that lang="Rust" via the phonors crate covers every dispatch
# site that the C extension used to. Anything that fails here is a
# missing-Rust-port site (per phonopy_RUST_MIGRATION.md, Phase 6A).
on:
pull_request:
branches: [main]
jobs:
build-linux-no-c:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
python-version: ["3.13"]
steps:
- uses: actions/checkout@v6
with:
# setuptools_scm needs tags to compute the phonopy version;
# actions/checkout's default shallow clone hides them.
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
- name: Install dependencies
run: |
conda activate test
conda install --yes -c conda-forge python=${{ matrix.python-version }}
conda install --yes -c conda-forge matplotlib-base pyyaml scipy numpy spglib h5py pip pytest pypolymlp ase rust maturin
- name: Setup symfc
run: |
conda activate test
git clone https://github.com/symfc/symfc.git
cd symfc
pip install -e . -vvv
- name: Setup phonors
run: |
conda activate test
git clone https://github.com/phonopy/phonors.git
cd phonors
maturin develop --release
- name: Setup phonopy without C extension
env:
PHONOPY_NO_C_EXT: "1"
# Force the Make generator so scikit-build-core does not look
# for Ninja. CMakeLists.txt early-returns under
# PHONOPY_NO_C_EXT=1, so no actual compilation happens.
CMAKE_GENERATOR: "Unix Makefiles"
run: |
conda activate test
pip install -e . -vvv
- name: Verify _phonopy is absent
run: |
conda activate test
python -c "
try:
import phonopy._phonopy
except ImportError:
print('OK: phonopy._phonopy is absent.')
else:
raise SystemExit('phonopy._phonopy was unexpectedly built.')
"
- name: Test with pytest (Rust backend)
run: |
conda activate test
pytest test
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: phonopy test with PHONOPY_NO_C_EXT (Rust-only backend) # Run the test suite against a wheel built with PHONOPY_NO_C_EXT=1. This # verifies that lang="Rust" via the phonors crate covers every dispatch # site that the C extension used to. Anything that fails here is a # missing-Rust-port site (per phonopy_RUST_MIGRATION.md, Phase 6A). on: pull_request: branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build-linux-no-c: timeout-minutes: 30 runs-on: latchkey-small defaults: run: shell: bash -l {0} strategy: matrix: python-version: ["3.13"] steps: - uses: actions/checkout@v6 with: # setuptools_scm needs tags to compute the phonopy version; # actions/checkout's default shallow clone hides them. fetch-depth: 0 - uses: conda-incubator/setup-miniconda@v3 with: miniforge-version: latest - name: Install dependencies run: | conda activate test conda install --yes -c conda-forge python=${{ matrix.python-version }} conda install --yes -c conda-forge matplotlib-base pyyaml scipy numpy spglib h5py pip pytest pypolymlp ase rust maturin - name: Setup symfc run: | conda activate test git clone https://github.com/symfc/symfc.git cd symfc pip install -e . -vvv - name: Setup phonors run: | conda activate test git clone https://github.com/phonopy/phonors.git cd phonors maturin develop --release - name: Setup phonopy without C extension env: PHONOPY_NO_C_EXT: "1" # Force the Make generator so scikit-build-core does not look # for Ninja. CMakeLists.txt early-returns under # PHONOPY_NO_C_EXT=1, so no actual compilation happens. CMAKE_GENERATOR: "Unix Makefiles" run: | conda activate test pip install -e . -vvv - name: Verify _phonopy is absent run: | conda activate test python -c " try: import phonopy._phonopy except ImportError: print('OK: phonopy._phonopy is absent.') else: raise SystemExit('phonopy._phonopy was unexpectedly built.') " - name: Test with pytest (Rust backend) run: | conda activate test pytest test
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.