Run coopr - edsl tests workflow (expectedparrot/edsl)
The Run coopr - edsl tests workflow from expectedparrot/edsl, 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 Run coopr - edsl tests workflow from the expectedparrot/edsl repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Run coopr - edsl tests
on:
pull_request:
branches:
- main
push:
branches:
- '**'
workflow_dispatch:
jobs:
build-and-test:
if: ${{ github.event_name == 'push' && contains(github.event.head_commit.message, 'coopr') || github.event_name == 'pull_request' }}
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Determine last commit hash
id: get_last_commit
run: |
if [ "${{ github.head_ref }}" != "" ]; then
# Pull Request: Get the last commit from the source branch
echo "COMMIT=$(git rev-parse ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV
else
# Push: Get the last commit directly
echo "COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
fi
- name: Update pyproject.toml for EDSL target commit
run: |
cd /home/stefan/expectedparrot/coopr/backend
git checkout -f main
git fetch origin
git pull
sed -i -E "s|edsl = \{git = \"https://github.com/expectedparrot/edsl.git\", rev = \".*\"\}|edsl = {git = \"https://github.com/expectedparrot/edsl.git\", rev = \"$COMMIT\"}|" pyproject.toml
sed -i -E "s|edsl = \{git = \"https://github.com/expectedparrot/edsl.git\",branch = \".*\"\}|edsl = {git = \"https://github.com/expectedparrot/edsl.git\", rev = \"$COMMIT\"}|" pyproject.toml
source /home/stefan/expectedparrot/coopr/backend/project/bin/activate
poetry lock
- name: Run Docker Compose
run: |
cd /home/stefan/expectedparrot/coopr
# Scale voice-agent to 0: the LiveKit agent has no healthcheck and
# exits (0) in CI (no LiveKit backend to attach to), and `--wait`
# treats any container stopping mid-wait as a failure -> exit 1,
# failing the build before make test-coop even runs. Nothing
# depends_on voice-agent, so skipping it is safe.
docker compose up --build --wait --scale voice-agent=0
- name: Fetch and checkout last commit in EDSL
run: |
cd /home/stefan/expectedparrot/edsl
git fetch origin
git checkout -f $COMMIT || git checkout -f origin/main # Fallback to main if commit is unavailable
- name: Run make coop-test
run: |
cd /home/stefan/expectedparrot/edsl
source ./project/bin/activate
poetry install
make test-coop
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Run coopr - edsl tests on: pull_request: branches: - main push: branches: - '**' workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build-and-test: timeout-minutes: 30 if: ${{ github.event_name == 'push' && contains(github.event.head_commit.message, 'coopr') || github.event_name == 'pull_request' }} runs-on: self-hosted steps: - name: Checkout repository uses: actions/checkout@v3 - name: Determine last commit hash id: get_last_commit run: | if [ "${{ github.head_ref }}" != "" ]; then # Pull Request: Get the last commit from the source branch echo "COMMIT=$(git rev-parse ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV else # Push: Get the last commit directly echo "COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV fi - name: Update pyproject.toml for EDSL target commit run: | cd /home/stefan/expectedparrot/coopr/backend git checkout -f main git fetch origin git pull sed -i -E "s|edsl = \{git = \"https://github.com/expectedparrot/edsl.git\", rev = \".*\"\}|edsl = {git = \"https://github.com/expectedparrot/edsl.git\", rev = \"$COMMIT\"}|" pyproject.toml sed -i -E "s|edsl = \{git = \"https://github.com/expectedparrot/edsl.git\",branch = \".*\"\}|edsl = {git = \"https://github.com/expectedparrot/edsl.git\", rev = \"$COMMIT\"}|" pyproject.toml source /home/stefan/expectedparrot/coopr/backend/project/bin/activate poetry lock - name: Run Docker Compose run: | cd /home/stefan/expectedparrot/coopr # Scale voice-agent to 0: the LiveKit agent has no healthcheck and # exits (0) in CI (no LiveKit backend to attach to), and `--wait` # treats any container stopping mid-wait as a failure -> exit 1, # failing the build before make test-coop even runs. Nothing # depends_on voice-agent, so skipping it is safe. docker compose up --build --wait --scale voice-agent=0 - name: Fetch and checkout last commit in EDSL run: | cd /home/stefan/expectedparrot/edsl git fetch origin git checkout -f $COMMIT || git checkout -f origin/main # Fallback to main if commit is unavailable - name: Run make coop-test run: | cd /home/stefan/expectedparrot/edsl source ./project/bin/activate poetry install make test-coop
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
- 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 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.