integration-app-harness workflow (dot-agent/nextpy)
The integration-app-harness workflow from dot-agent/nextpy, explained and optimized by Latchkey.
CI health: A - excellent
Point runs-on at Latchkey and get run de-duplication, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the integration-app-harness workflow from the dot-agent/nextpy 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: integration-app-harness
on:
push:
branches: [ "main" ]
paths-ignore:
- '**/*.md'
pull_request:
branches: [ "main" ]
paths-ignore:
- '**/*.md'
permissions:
contents: read
jobs:
integration-app-harness:
timeout-minutes: 30
strategy:
matrix:
state_manager: [ "redis", "memory" ]
runs-on: ubuntu-latest
services:
# Label used to access the service container
redis:
image: ${{ matrix.state_manager == 'redis' && 'redis' || '' }}
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup_build_env
with:
python-version: "3.11.5"
run-poetry-install: true
create-venv-at-path: .venv
- run: poetry run pip install pyvirtualdisplay pillow
- name: Run app harness tests
env:
SCREENSHOT_DIR: /tmp/screenshots
REDIS_URL: ${{ matrix.state_manager == 'redis' && 'redis://localhost:6379' || '' }}
run: |
poetry run pytest integration
- uses: actions/upload-artifact@v3
name: Upload failed test screenshots
if: always()
with:
name: failed_test_screenshots
path: /tmp/screenshotsThe same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: integration-app-harness on: push: branches: [ "main" ] paths-ignore: - '**/*.md' pull_request: branches: [ "main" ] paths-ignore: - '**/*.md' permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: integration-app-harness: timeout-minutes: 30 strategy: matrix: state_manager: [ "redis", "memory" ] runs-on: latchkey-small services: # Label used to access the service container redis: image: ${{ matrix.state_manager == 'redis' && 'redis' || '' }} # Set health checks to wait until redis has started options: >- --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 ports: # Maps port 6379 on service container to the host - 6379:6379 steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup_build_env with: python-version: "3.11.5" run-poetry-install: true create-venv-at-path: .venv - run: poetry run pip install pyvirtualdisplay pillow - name: Run app harness tests env: SCREENSHOT_DIR: /tmp/screenshots REDIS_URL: ${{ matrix.state_manager == 'redis' && 'redis://localhost:6379' || '' }} run: | poetry run pytest integration - uses: actions/upload-artifact@v3 name: Upload failed test screenshots if: always() with: name: failed_test_screenshots path: /tmp/screenshots
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.
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 (2 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.