Call e2e test workflow (Project-HAMi/HAMi)
The Call e2e test workflow from Project-HAMi/HAMi, explained and optimized by Latchkey.
CI health: A - excellent
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 Call e2e test workflow from the Project-HAMi/HAMi 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: Call e2e test
on:
workflow_call:
inputs:
ref:
description: 'Reference id to run tests'
required: true
type: string
type:
description: 'E2E type'
required: true
type: string
default: pullrequest
jobs:
e2e-test:
strategy:
matrix:
include:
- device: nvidia
type: tesla-p4
# - device: nvidia
# type: rtx-4090
# - device: huawei
# type: ascend-910b3
runs-on: [ "${{ matrix.device }}", "${{ matrix.type }}" ]
environment: ${{ matrix.device }}
env:
E2E_TYPE: ${{ inputs.type }}
HAMI_VERSION: ${{ inputs.ref }}
steps:
- name: checkout code
uses: actions/checkout@v7
- name: Acquire shared e2e runner lock
run: bash hack/e2e-runner-lock.sh acquire
- name: install Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: setup e2e env
run: |
make e2e-env-setup
- name: download hami helm
if: inputs.type == 'pullrequest'
uses: actions/download-artifact@v8
with:
name: chart_package_artifact
path: charts/
- name: download hami image
if: inputs.type == 'pullrequest'
uses: actions/download-artifact@v8
with:
name: hami-image
path: ./image
- name: load e2e image
if: inputs.type == 'pullrequest'
run: |
echo "Loading Docker image from image.tar..."
# Import directly into the k8s.io containerd namespace so kubelet can use it
# without pulling from the registry.
sudo ctr -n k8s.io images import ./image/image.tar
sudo ctr -n k8s.io images ls | grep hami
- name: deploy hami helm
run: |
make helm-deploy
- name: e2e test
run: |
make e2e-test
- name: cleanup e2e env
if: always()
run: |
echo "Cleaning up HAMi deployment..."
helm uninstall hami -n hami-system --kubeconfig "${KUBE_CONF:-${HOME}/.kube/config}" 2>/dev/null || true
kubectl wait --for=delete pod --all -n hami-system \
--timeout=120s --kubeconfig "${KUBE_CONF:-${HOME}/.kube/config}" 2>/dev/null || true
kubectl annotate node --all \
hami.io/mutex.lock- hami.io/node-handshake- \
hami.io/node-nvidia-register- hami.io/nvidia-license- \
--kubeconfig "${KUBE_CONF:-${HOME}/.kube/config}" 2>/dev/null || true
echo "Cleanup done."
- name: Release shared e2e runner lock
if: always()
run: bash hack/e2e-runner-lock.sh release
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Call e2e test on: workflow_call: inputs: ref: description: 'Reference id to run tests' required: true type: string type: description: 'E2E type' required: true type: string default: pullrequest jobs: e2e-test: timeout-minutes: 30 strategy: matrix: include: - device: nvidia type: tesla-p4 # - device: nvidia # type: rtx-4090 # - device: huawei # type: ascend-910b3 runs-on: [ "${{ matrix.device }}", "${{ matrix.type }}" ] environment: ${{ matrix.device }} env: E2E_TYPE: ${{ inputs.type }} HAMI_VERSION: ${{ inputs.ref }} steps: - name: checkout code uses: actions/checkout@v7 - name: Acquire shared e2e runner lock run: bash hack/e2e-runner-lock.sh acquire - name: install Go uses: actions/setup-go@v6 with: go-version-file: go.mod - name: setup e2e env run: | make e2e-env-setup - name: download hami helm if: inputs.type == 'pullrequest' uses: actions/download-artifact@v8 with: name: chart_package_artifact path: charts/ - name: download hami image if: inputs.type == 'pullrequest' uses: actions/download-artifact@v8 with: name: hami-image path: ./image - name: load e2e image if: inputs.type == 'pullrequest' run: | echo "Loading Docker image from image.tar..." # Import directly into the k8s.io containerd namespace so kubelet can use it # without pulling from the registry. sudo ctr -n k8s.io images import ./image/image.tar sudo ctr -n k8s.io images ls | grep hami - name: deploy hami helm run: | make helm-deploy - name: e2e test run: | make e2e-test - name: cleanup e2e env if: always() run: | echo "Cleaning up HAMi deployment..." helm uninstall hami -n hami-system --kubeconfig "${KUBE_CONF:-${HOME}/.kube/config}" 2>/dev/null || true kubectl wait --for=delete pod --all -n hami-system \ --timeout=120s --kubeconfig "${KUBE_CONF:-${HOME}/.kube/config}" 2>/dev/null || true kubectl annotate node --all \ hami.io/mutex.lock- hami.io/node-handshake- \ hami.io/node-nvidia-register- hami.io/nvidia-license- \ --kubeconfig "${KUBE_CONF:-${HOME}/.kube/config}" 2>/dev/null || true echo "Cleanup done." - name: Release shared e2e runner lock if: always() run: bash hack/e2e-runner-lock.sh release
What changed
- 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:
- End-to-end and browser tests
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.