CI workflow (FalkorDB/GraphRAG-SDK)
The CI workflow from FalkorDB/GraphRAG-SDK, explained and optimized by Latchkey.
CI health: D - needs work
Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the CI workflow from the FalkorDB/GraphRAG-SDK 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
on:
push:
branches: [main, staging]
pull_request:
branches: [main, staging]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: graphrag_sdk
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- run: pip install ruff
- name: Ruff check (src)
run: ruff check src/
- name: Ruff format check (src)
run: ruff format --check src/
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
defaults:
run:
working-directory: graphrag_sdk
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e ".[dev]"
- name: Run tests
run: python -m pytest tests/ -q
- name: Run tests with coverage (3.12 only)
if: matrix.python-version == '3.12'
run: python -m pytest tests/ --cov=src/graphrag_sdk --cov-report=term-missing -q
integration:
name: Integration (real FalkorDB)
runs-on: ubuntu-latest
services:
falkordb:
image: falkordb/falkordb:v4.18.0
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 10
defaults:
run:
working-directory: graphrag_sdk
env:
RUN_INTEGRATION: "1"
FALKOR_HOST: localhost
FALKOR_PORT: "6379"
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- run: pip install -e ".[dev]"
- name: Wait for FalkorDB
# The service container is healthchecked above, but give the
# graph layer an extra moment to be reachable from Python.
# The loop MUST fail the step if readiness never arrives -
# otherwise pytest runs against a dead service and surfaces
# a much less obvious error.
run: |
for _ in $(seq 1 20); do
if python -c "import redis; redis.Redis(host='localhost', port=6379).ping()"; then
exit 0
fi
sleep 1
done
echo "FalkorDB did not become reachable within 20 attempts" >&2
exit 1
- name: Run real-FalkorDB integration tests
run: >
python -m pytest -v
-m integration
tests/test_integration.py
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: CI on: push: branches: [main, staging] pull_request: branches: [main, staging] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: lint: timeout-minutes: 30 name: Lint runs-on: latchkey-small defaults: run: working-directory: graphrag_sdk steps: - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: cache: 'pip' python-version: "3.12" - run: pip install ruff - name: Ruff check (src) run: ruff check src/ - name: Ruff format check (src) run: ruff format --check src/ test: timeout-minutes: 30 runs-on: latchkey-small strategy: matrix: python-version: ["3.10", "3.11", "3.12"] defaults: run: working-directory: graphrag_sdk steps: - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: cache: 'pip' python-version: ${{ matrix.python-version }} - run: pip install -e ".[dev]" - name: Run tests run: python -m pytest tests/ -q - name: Run tests with coverage (3.12 only) if: matrix.python-version == '3.12' run: python -m pytest tests/ --cov=src/graphrag_sdk --cov-report=term-missing -q integration: timeout-minutes: 30 name: Integration (real FalkorDB) runs-on: latchkey-small services: falkordb: image: falkordb/falkordb:v4.18.0 ports: - 6379:6379 options: >- --health-cmd "redis-cli ping" --health-interval 5s --health-timeout 3s --health-retries 10 defaults: run: working-directory: graphrag_sdk env: RUN_INTEGRATION: "1" FALKOR_HOST: localhost FALKOR_PORT: "6379" steps: - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: cache: 'pip' python-version: "3.12" - run: pip install -e ".[dev]" - name: Wait for FalkorDB # The service container is healthchecked above, but give the # graph layer an extra moment to be reachable from Python. # The loop MUST fail the step if readiness never arrives - # otherwise pytest runs against a dead service and surfaces # a much less obvious error. run: | for _ in $(seq 1 20); do if python -c "import redis; redis.Redis(host='localhost', port=6379).ping()"; then exit 0 fi sleep 1 done echo "FalkorDB did not become reachable within 20 attempts" >&2 exit 1 - name: Run real-FalkorDB integration tests run: > python -m pytest -v -m integration tests/test_integration.py
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.
- 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.
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 3 jobs (5 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.