Platform Tests (All) workflow (sveltejs/kit)
The Platform Tests (All) workflow from sveltejs/kit, explained and optimized by Latchkey.
A
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 Platform Tests (All) workflow from the sveltejs/kit 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
workflow (.yml)
name: Platform Tests (All)
on:
workflow_dispatch:
inputs:
sha:
description: 'Commit SHA to test and update check status on'
required: false
default: ''
permissions:
contents: write
jobs:
vercel:
uses: ./.github/workflows/platform-tests-vercel.yml
with:
sha: ${{ inputs.sha }}
secrets: inherit
netlify:
uses: ./.github/workflows/platform-tests-netlify.yml
with:
sha: ${{ inputs.sha }}
secrets: inherit
node:
uses: ./.github/workflows/platform-tests-node.yml
with:
sha: ${{ inputs.sha }}
secrets: inherit
report-status:
if: always()
needs: [vercel, netlify, node]
runs-on: ubuntu-latest
steps:
- name: Determine outcome
id: outcome
run: |
if [ "${{ contains(needs.*.result, 'failure') }}" = "true" ]; then
echo "conclusion=failure" >> "$GITHUB_OUTPUT"
echo "title=Platform tests failed" >> "$GITHUB_OUTPUT"
echo "summary=One or more platform test jobs failed. See the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details." >> "$GITHUB_OUTPUT"
elif [ "${{ contains(needs.*.result, 'cancelled') }}" = "true" ]; then
echo "conclusion=cancelled" >> "$GITHUB_OUTPUT"
echo "title=Platform tests cancelled" >> "$GITHUB_OUTPUT"
echo "summary=Platform tests were cancelled before completing." >> "$GITHUB_OUTPUT"
else
echo "conclusion=success" >> "$GITHUB_OUTPUT"
echo "title=Platform tests passed" >> "$GITHUB_OUTPUT"
echo "summary=All platform test jobs passed." >> "$GITHUB_OUTPUT"
fi
- name: Report results
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api repos/${{ github.repository }}/dispatches \
-f event_type=platform-tests-result \
-f 'client_payload[sha]=${{ inputs.sha || github.sha }}' \
-f 'client_payload[conclusion]=${{ steps.outcome.outputs.conclusion }}' \
-f 'client_payload[title]=${{ steps.outcome.outputs.title }}' \
-f 'client_payload[summary]=${{ steps.outcome.outputs.summary }}' \
-f 'client_payload[details_url]=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Platform Tests (All) on: workflow_dispatch: inputs: sha: description: 'Commit SHA to test and update check status on' required: false default: '' permissions: contents: write jobs: vercel: timeout-minutes: 30 uses: ./.github/workflows/platform-tests-vercel.yml with: sha: ${{ inputs.sha }} secrets: inherit netlify: timeout-minutes: 30 uses: ./.github/workflows/platform-tests-netlify.yml with: sha: ${{ inputs.sha }} secrets: inherit node: timeout-minutes: 30 uses: ./.github/workflows/platform-tests-node.yml with: sha: ${{ inputs.sha }} secrets: inherit report-status: timeout-minutes: 30 if: always() needs: [vercel, netlify, node] runs-on: latchkey-small steps: - name: Determine outcome id: outcome run: | if [ "${{ contains(needs.*.result, 'failure') }}" = "true" ]; then echo "conclusion=failure" >> "$GITHUB_OUTPUT" echo "title=Platform tests failed" >> "$GITHUB_OUTPUT" echo "summary=One or more platform test jobs failed. See the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details." >> "$GITHUB_OUTPUT" elif [ "${{ contains(needs.*.result, 'cancelled') }}" = "true" ]; then echo "conclusion=cancelled" >> "$GITHUB_OUTPUT" echo "title=Platform tests cancelled" >> "$GITHUB_OUTPUT" echo "summary=Platform tests were cancelled before completing." >> "$GITHUB_OUTPUT" else echo "conclusion=success" >> "$GITHUB_OUTPUT" echo "title=Platform tests passed" >> "$GITHUB_OUTPUT" echo "summary=All platform test jobs passed." >> "$GITHUB_OUTPUT" fi - name: Report results env: GH_TOKEN: ${{ github.token }} run: | gh api repos/${{ github.repository }}/dispatches \ -f event_type=platform-tests-result \ -f 'client_payload[sha]=${{ inputs.sha || github.sha }}' \ -f 'client_payload[conclusion]=${{ steps.outcome.outputs.conclusion }}' \ -f 'client_payload[title]=${{ steps.outcome.outputs.title }}' \ -f 'client_payload[summary]=${{ steps.outcome.outputs.summary }}' \ -f 'client_payload[details_url]=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
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.
This workflow runs 4 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.