PR code review workflow (easy-graph/Easy-Graph)
The PR code review workflow from easy-graph/Easy-Graph, explained and optimized by Latchkey.
CI health: C - fair
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the PR code review workflow from the easy-graph/Easy-Graph 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: PR code review
on:
workflow_dispatch:
pull_request:
branches:
- pybind11
push:
branches:
- pybind11
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
python-version: ["3.9", "3.12"]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Installing dependencies
uses: py-actions/py-dependency-install@v4
with:
path: "requirements.txt"
- name: Add requirements
run: python -m pip install --upgrade setuptools wheel build packaging
- name: Build and install
run: pip install --verbose .
- name: Smoke test
run: python -c "import os, tempfile; os.chdir(tempfile.gettempdir()); import easygraph as eg; G = eg.Graph(); G.add_edge(1, 2); assert G.number_of_nodes() == 2; assert G.number_of_edges() == 1"
The same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
name: PR code review on: workflow_dispatch: pull_request: branches: - pybind11 push: branches: - pybind11 concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: timeout-minutes: 30 strategy: fail-fast: false matrix: platform: [windows-latest, macos-latest, ubuntu-latest] python-version: ["3.9", "3.12"] runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v4 with: submodules: true - uses: actions/setup-python@v5 with: cache: 'pip' python-version: ${{ matrix.python-version }} - name: Upgrade pip run: python -m pip install --upgrade pip - name: Installing dependencies uses: py-actions/py-dependency-install@v4 with: path: "requirements.txt" - name: Add requirements run: python -m pip install --upgrade setuptools wheel build packaging - name: Build and install run: pip install --verbose . - name: Smoke test run: python -c "import os, tempfile; os.chdir(tempfile.gettempdir()); import easygraph as eg; G = eg.Graph(); G.add_edge(1, 2); assert G.number_of_nodes() == 2; assert G.number_of_edges() == 1"
What changed
- Cache dependency installs on the setup step so they are served from cache.
- 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 (6 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.