Skip to content
Latchkey

phonopy test using conda-forge environment workflow (phonopy/phonopy)

The phonopy test using conda-forge environment workflow from phonopy/phonopy, explained and optimized by Latchkey.

C

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.

Grade your own workflow free or run it on Latchkey →
Source: phonopy/phonopy.github/workflows/phonopy-pytest-conda.ymlLicense BSD-3-ClauseView source

What it does

This is the phonopy test using conda-forge environment 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

workflow (.yml)
name: phonopy test using conda-forge environment

on:
  pull_request:
    branches: [main]

jobs:
  build-linux:
    runs-on: ubuntu-latest
    defaults:
      run:
        shell: bash -l {0}
    strategy:
      matrix:
        python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

    steps:
      - uses: actions/checkout@v6
      - uses: conda-incubator/setup-miniconda@v3
        with:
          activate-environment: test
          auto-activate-base: false
          miniforge-version: latest
          python-version: ${{ matrix.python-version }}
      - 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 codecov pytest-cov c-compiler cxx-compiler cmake pypolymlp ase maturin
      - name: Setup symfc
        run: |
          conda activate test
          git clone https://github.com/symfc/symfc.git
          cd symfc
          pip install -e . -vvv
          cd ..
      - name: Build and install phonors
        run: |
          conda activate test
          git clone https://github.com/phonopy/phonors.git
          cd phonors
          maturin develop --release
      - name: Setup phonopy
        run: |
          conda activate test
          pip install -e . -vvv
      - name: Test with pytest
        run: |
          conda activate test
          pytest --cov=./ --cov-report=xml test
      - name: Upload coverage to Codecov
        if: matrix.python-version == '3.14'
        uses: codecov/codecov-action@v5
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          verbose: true

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: phonopy test using conda-forge environment
 
on:
  pull_request:
    branches: [main]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build-linux:
    timeout-minutes: 30
    runs-on: latchkey-small
    defaults:
      run:
        shell: bash -l {0}
    strategy:
      matrix:
        python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
 
    steps:
      - uses: actions/checkout@v6
      - uses: conda-incubator/setup-miniconda@v3
        with:
          activate-environment: test
          auto-activate-base: false
          miniforge-version: latest
          python-version: ${{ matrix.python-version }}
      - 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 codecov pytest-cov c-compiler cxx-compiler cmake pypolymlp ase maturin
      - name: Setup symfc
        run: |
          conda activate test
          git clone https://github.com/symfc/symfc.git
          cd symfc
          pip install -e . -vvv
          cd ..
      - name: Build and install phonors
        run: |
          conda activate test
          git clone https://github.com/phonopy/phonors.git
          cd phonors
          maturin develop --release
      - name: Setup phonopy
        run: |
          conda activate test
          pip install -e . -vvv
      - name: Test with pytest
        run: |
          conda activate test
          pytest --cov=./ --cov-report=xml test
      - name: Upload coverage to Codecov
        if: matrix.python-version == '3.14'
        uses: codecov/codecov-action@v5
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          verbose: true
 

What changed

2 third-party actions are referenced by a movable tag. Pin them 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:

This workflow runs 1 job (5 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow