CI workflow (haraka/Haraka)
The CI workflow from haraka/Haraka, 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 CI workflow from the haraka/Haraka 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: CI
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main, master]
env:
CI: true
jobs:
lint:
uses: haraka/.github/.github/workflows/lint.yml@master
permissions:
contents: read
prettier:
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
uses: haraka/.github/.github/workflows/prettier.yml@master
permissions:
contents: write
secrets: inherit
with:
branch: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
coverage:
uses: haraka/.github/.github/workflows/coverage.yml@master
secrets: inherit
permissions:
contents: read
ubuntu:
uses: haraka/.github/.github/workflows/ubuntu.yml@master
permissions:
contents: read
windows:
uses: haraka/.github/.github/workflows/windows.yml@master
permissions:
contents: read
macos:
uses: haraka/.github/.github/workflows/macos.yml@master
permissions:
contents: read
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: CI on: pull_request: types: [opened, synchronize, reopened] push: branches: [main, master] env: CI: true concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: lint: timeout-minutes: 30 uses: haraka/.github/.github/workflows/lint.yml@master permissions: contents: read prettier: timeout-minutes: 30 if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} uses: haraka/.github/.github/workflows/prettier.yml@master permissions: contents: write secrets: inherit with: branch: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }} coverage: timeout-minutes: 30 uses: haraka/.github/.github/workflows/coverage.yml@master secrets: inherit permissions: contents: read ubuntu: timeout-minutes: 30 uses: haraka/.github/.github/workflows/ubuntu.yml@master permissions: contents: read windows: timeout-minutes: 30 uses: haraka/.github/.github/workflows/windows.yml@master permissions: contents: read macos: timeout-minutes: 30 uses: haraka/.github/.github/workflows/macos.yml@master permissions: contents: read
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.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
This workflow runs 6 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.