CI PR Required workflow (noho/dayu-agent)
The CI PR Required workflow from noho/dayu-agent, explained and optimized by Latchkey.
CI health: A - excellent
Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the CI PR Required workflow from the noho/dayu-agent repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: CI PR Required
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pr-required-min-compat:
name: pr-required min-compat (ubuntu-latest, py3.11)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install minimum supported dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test,dev,browser,web]" -c constraints/min-py311.txt
- name: Run pyright
run: pyright
- name: Run required pytest lane
run: pytest -q --timeout=60 -m "not integration and not slow and not e2e"
pr-required-lock-smoke:
name: pr-required lock-smoke (linux-x64, py3.11)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Free up disk space on runner
run: |
# 离线 bundle 需把 torch / nvidia-cu12 / docling 等大体积 wheel
# 一并解压安装;ubuntu-latest 默认仅约 14GB 可用,容易触发 ENOSPC。
# 这里清理 runner 上对本 job 无用的预装内容,腾出磁盘。
set -eux
BEFORE=$(df -BM --output=avail / | tail -1)
sudo rm -rf /usr/share/dotnet || true
sudo rm -rf /usr/local/lib/android || true
sudo rm -rf /opt/ghc || true
sudo rm -rf /opt/hostedtoolcache/CodeQL || true
sudo rm -rf /usr/local/share/boost || true
sudo rm -rf "$AGENT_TOOLSDIRECTORY"/Ruby || true
sudo rm -rf "$AGENT_TOOLSDIRECTORY"/PyPy || true
sudo rm -rf "$AGENT_TOOLSDIRECTORY"/go || true
sudo rm -rf "$AGENT_TOOLSDIRECTORY"/node || true
sudo docker image prune --all --force || true
AFTER=$(df -BM --output=avail / | tail -1)
echo "Disk before: $BEFORE, after: $AFTER"
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install locked dependencies
uses: ./.github/actions/install-locked-env
with:
constraints-path: constraints/lock-linux-x64-py311.txt
- name: Run required Docling integration smoke
run: |
pytest -q --timeout=120 \
tests/engine/test_docling_processor_integration.py \
tests/fins/test_docling_upload_service_integration.py \
tests/engine/test_web_fetch_docling_integration.py
- name: Build and smoke test offline bundle
uses: ./.github/actions/build-and-smoke-offline-bundle
with:
constraints-path: constraints/lock-linux-x64-py311.txt
platform-id: linux-x64
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: CI PR Required on: pull_request: branches: [main] types: [opened, synchronize, reopened] concurrency: group: ci-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: pr-required-min-compat: timeout-minutes: 30 name: pr-required min-compat (ubuntu-latest, py3.11) runs-on: latchkey-small steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python 3.11 uses: actions/setup-python@v5 with: python-version: "3.11" cache: pip - name: Install minimum supported dependencies run: | python -m pip install --upgrade pip pip install -e ".[test,dev,browser,web]" -c constraints/min-py311.txt - name: Run pyright run: pyright - name: Run required pytest lane run: pytest -q --timeout=60 -m "not integration and not slow and not e2e" pr-required-lock-smoke: timeout-minutes: 30 name: pr-required lock-smoke (linux-x64, py3.11) runs-on: latchkey-small steps: - name: Checkout uses: actions/checkout@v4 - name: Free up disk space on runner run: | # 离线 bundle 需把 torch / nvidia-cu12 / docling 等大体积 wheel # 一并解压安装;ubuntu-latest 默认仅约 14GB 可用,容易触发 ENOSPC。 # 这里清理 runner 上对本 job 无用的预装内容,腾出磁盘。 set -eux BEFORE=$(df -BM --output=avail / | tail -1) sudo rm -rf /usr/share/dotnet || true sudo rm -rf /usr/local/lib/android || true sudo rm -rf /opt/ghc || true sudo rm -rf /opt/hostedtoolcache/CodeQL || true sudo rm -rf /usr/local/share/boost || true sudo rm -rf "$AGENT_TOOLSDIRECTORY"/Ruby || true sudo rm -rf "$AGENT_TOOLSDIRECTORY"/PyPy || true sudo rm -rf "$AGENT_TOOLSDIRECTORY"/go || true sudo rm -rf "$AGENT_TOOLSDIRECTORY"/node || true sudo docker image prune --all --force || true AFTER=$(df -BM --output=avail / | tail -1) echo "Disk before: $BEFORE, after: $AFTER" - name: Set up Python 3.11 uses: actions/setup-python@v5 with: python-version: "3.11" cache: pip - name: Install locked dependencies uses: ./.github/actions/install-locked-env with: constraints-path: constraints/lock-linux-x64-py311.txt - name: Run required Docling integration smoke run: | pytest -q --timeout=120 \ tests/engine/test_docling_processor_integration.py \ tests/fins/test_docling_upload_service_integration.py \ tests/engine/test_web_fetch_docling_integration.py - name: Build and smoke test offline bundle uses: ./.github/actions/build-and-smoke-offline-bundle with: constraints-path: constraints/lock-linux-x64-py311.txt platform-id: linux-x64
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. - Add a job timeout so a hung step cannot burn hours of runner time.
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
- End-to-end and browser tests
This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.