install workflow (santinic/how2)
The install workflow from santinic/how2, explained and optimized by Latchkey.
CI health: F - at risk
Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the install workflow from the santinic/how2 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: install
run-name: Test install on every OS
on: [push]
jobs:
npm:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: '16'
- uses: actions/checkout@master
- id: ver
uses: Saionaro/extract-package-version@v1.0.6
- run: npm i -g how2
- run: how2
- run: how2 decompress tar gz
- run: |
ver=`how2 --version`
echo $ver
if [ $ver != ${{ steps.ver.outputs.version }} ]; then exit 1; fi
- run: how2 --set-token 8b2fee4d-95g3-4e35-b8ea-edede6500533
- run: how2 --get-token
linux-binary:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- id: ver
uses: Saionaro/extract-package-version@v1.0.6
- run: wget https://github.com/santinic/how2/releases/download/v${{ steps.ver.outputs.version }}/how2-linux-x64.tar.gz
- run: tar xvzf how2-linux-x64.tar.gz
- run: mv how2-linux how2
- run: ./how2
- run: ./how2 decompress tar gz
- run: |
ver=`./how2 --version`
echo $ver
if [ $ver != ${{ steps.ver.outputs.version }} ]; then exit 1; fi
- run: ./how2 --set-token 8b2fee4d-95g3-4e35-b8ea-edede6500533
- run: ./how2 --get-token
deb:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- id: ver
uses: Saionaro/extract-package-version@v1.0.6
- run: wget how2terminal.com/how2.deb
- run: sudo dpkg -i how2.deb
- run: how2
- run: how2 decompress tar gz
- run: |
ver=`how2 --version`
echo $ver
if [ $ver != $latest ]; then exit 1; fi
- run: how2 --set-token 8b2fee4d-95g3-4e35-b8ea-edede6500533
- run: how2 --get-token
brew-tap:
runs-on: macos-12
steps:
- uses: actions/checkout@master
- id: ver
uses: Saionaro/extract-package-version@v1.0.6
- run: brew tap how2terminal/how2
- run: brew install how2
- run: how2
- run: how2 decompress tar gz
- run: |
ver=`how2 --version`
echo $ver
if [ $ver != ${{ steps.ver.outputs.version }} ]; then exit 1; fi
- run: how2 --set-token 8b2fee4d-95g3-4e35-b8ea-edede6500533
- run: how2 --get-token
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@master
- id: ver
uses: Saionaro/extract-package-version@v1.0.6
- name: Download and decompress artifact
shell: pwsh
run: |
$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile("https://github.com/santinic/how2/releases/download/v${{ steps.ver.outputs.version }}/how2-win.zip", "how2-win.zip")
Expand-Archive -Path .\how2-win.zip .
- run: mv how2-win.exe how2.exe
- name: Without options
run: .\how2
- name: Simple search
run: .\how2 Download file
- run: .\how2 --set-token 8b2fee4d-95g3-4e35-b8ea-edede6500533
- run: .\how2 --get-token
The same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
name: install run-name: Test install on every OS on: [push] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: npm: timeout-minutes: 30 runs-on: latchkey-small steps: - uses: actions/setup-node@v3 with: cache: 'npm' node-version: '16' - uses: actions/checkout@master - id: ver uses: Saionaro/extract-package-version@v1.0.6 - run: npm i -g how2 - run: how2 - run: how2 decompress tar gz - run: | ver=`how2 --version` echo $ver if [ $ver != ${{ steps.ver.outputs.version }} ]; then exit 1; fi - run: how2 --set-token 8b2fee4d-95g3-4e35-b8ea-edede6500533 - run: how2 --get-token linux-binary: timeout-minutes: 30 runs-on: latchkey-small steps: - uses: actions/checkout@master - id: ver uses: Saionaro/extract-package-version@v1.0.6 - run: wget https://github.com/santinic/how2/releases/download/v${{ steps.ver.outputs.version }}/how2-linux-x64.tar.gz - run: tar xvzf how2-linux-x64.tar.gz - run: mv how2-linux how2 - run: ./how2 - run: ./how2 decompress tar gz - run: | ver=`./how2 --version` echo $ver if [ $ver != ${{ steps.ver.outputs.version }} ]; then exit 1; fi - run: ./how2 --set-token 8b2fee4d-95g3-4e35-b8ea-edede6500533 - run: ./how2 --get-token deb: timeout-minutes: 30 runs-on: latchkey-small steps: - uses: actions/checkout@master - id: ver uses: Saionaro/extract-package-version@v1.0.6 - run: wget how2terminal.com/how2.deb - run: sudo dpkg -i how2.deb - run: how2 - run: how2 decompress tar gz - run: | ver=`how2 --version` echo $ver if [ $ver != $latest ]; then exit 1; fi - run: how2 --set-token 8b2fee4d-95g3-4e35-b8ea-edede6500533 - run: how2 --get-token brew-tap: timeout-minutes: 30 runs-on: macos-12 steps: - uses: actions/checkout@master - id: ver uses: Saionaro/extract-package-version@v1.0.6 - run: brew tap how2terminal/how2 - run: brew install how2 - run: how2 - run: how2 decompress tar gz - run: | ver=`how2 --version` echo $ver if [ $ver != ${{ steps.ver.outputs.version }} ]; then exit 1; fi - run: how2 --set-token 8b2fee4d-95g3-4e35-b8ea-edede6500533 - run: how2 --get-token windows: timeout-minutes: 30 runs-on: windows-latest steps: - uses: actions/checkout@master - id: ver uses: Saionaro/extract-package-version@v1.0.6 - name: Download and decompress artifact shell: pwsh run: | $WebClient = New-Object System.Net.WebClient $WebClient.DownloadFile("https://github.com/santinic/how2/releases/download/v${{ steps.ver.outputs.version }}/how2-win.zip", "how2-win.zip") Expand-Archive -Path .\how2-win.zip . - run: mv how2-win.exe how2.exe - name: Without options run: .\how2 - name: Simple search run: .\how2 Download file - run: .\how2 --set-token 8b2fee4d-95g3-4e35-b8ea-edede6500533 - run: .\how2 --get-token
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.
- Cache dependency installs on the setup step so they are served from cache.
- 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.
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:
- Network fetches
This workflow runs 5 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.