CI workflow (copy/v86)
The CI workflow from copy/v86, 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 CI workflow from the copy/v86 repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-2-Clause license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: CI
on:
push:
pull_request:
jobs:
eslint:
name: eslint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Run eslint
run: sudo npm install -g eslint; make eslint
test:
runs-on: ubuntu-latest
name: Build and test
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
filter: tree:0
- name: Setup Node.js version
uses: actions/setup-node@v6
with:
node-version: '24.17.0'
registry-url: 'https://registry.npmjs.org'
- name: Setup toolchain
run: |
rustup toolchain install stable --profile minimal
rustup target add wasm32-unknown-unknown
rustup component add rustfmt
- name: Install APT packages
run: |
sudo apt-get update -y
sudo apt-get install nasm gdb qemu-system-x86 libc6-dev-i386 -y
- name: Build all-debug
run: |
rustc --version
make all-debug
- name: Build all
run: make all
- name: Build fallback
run: make build/v86-fallback.wasm
- name: rustfmt check
run: make rustfmt
- name: Fetch kvm-unit-test cache
uses: actions/cache@v5
id: cache-kvm-unit-test
with:
path: tests/kvm-unit-tests/
key: ${{ runner.os }}-kvm-unit-test
- name: Build kvm-unit-test
if: steps.cache-kvm-unit-test.outputs.cache-hit != 'true'
run: tests/kvm-unit-tests/build.sh
- name: Run kvm-unit-test
run: |
tests/kvm-unit-tests/run.mjs tests/kvm-unit-tests/x86/taskswitch.flat
tests/kvm-unit-tests/run.mjs tests/kvm-unit-tests/x86/taskswitch2.flat
tests/kvm-unit-tests/run.mjs tests/kvm-unit-tests/x86/realmode.flat
- name: Fetch namsmtests cache
uses: actions/cache@v5
id: cache-nasmtests
with:
path: tests/nasm/build/
key: ${{ runner.os }}-nasmtests
- name: Run nasmtests
run: MAX_PARALLEL_TESTS=1 make nasmtests
- name: Run nasmtests-force-jit
run: MAX_PARALLEL_TESTS=1 make nasmtests-force-jit
- name: Run rust-test
run: make rust-test
- name: Fetch image cache
uses: actions/cache@v5
id: cache-images
with:
path: images/
key: ${{ runner.os }}-images-v2
- name: Download uncached images
if: steps.cache-images.outputs.cache-hit != 'true'
run: mkdir -p images && curl --compressed --output-dir images --remote-name-all https://i.copy.sh/{linux.iso,linux3.iso,linux4.iso,buildroot-bzimage68.bin,TinyCore-11.0.iso,oberon.img,msdos.img,openbsd-floppy.img,kolibri.img,windows101.img,os8.img,freedos722.img,mobius-fd-release5.img,msdos622.img}
- name: Run api-tests
run: make api-tests
- name: Run qemutests
run: make qemutests
- name: Run qemutests-release
run: make qemutests-release
- name: Run jitpagingtests
run: make jitpagingtests
- name: Run integration tests
run: MAX_PARALLEL_TESTS=1 make tests
- name: Run devices tests
run: make devices-test
- name: Run expect tests
run: make expect-tests
- name: Update package.json version
run: make update-package-json-version
- name: Upload the artifact
uses: actions/upload-artifact@v7
with:
name: v86
path: |
package.json
LICENSE
Readme.md
v86.d.ts
build/libv86*.js
build/libv86*.js.map
build/v86*.wasm
build/*.mjs
upload:
name: Upload release
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master'
permissions:
id-token: write
contents: write
steps:
- name: Delete old release and tag
uses: dev-drprasad/delete-tag-and-release@v1.0.1
with:
delete_release: true
tag_name: latest
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Get artifacts
uses: actions/download-artifact@v8
with:
name: v86
- name: Display structure of downloaded files
run: ls -R
- uses: actions/setup-node@v6
with:
node-version: '24.17.0'
registry-url: 'https://registry.npmjs.org'
- name: Release to GitHub
uses: ncipollo/release-action@v1
with:
name: Latest Release
tag: latest
commit: master
body: ${{ github.event.head_commit.message }}
artifacts: "build/libv86*.js,build/libv86*.js.map,build/*.mjs,build/v86*.wasm"
prerelease: true
- name: Release to NPM
run: npm publish --provenance --access public
if: github.repository == 'copy/v86'
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: CI on: push: pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: eslint: timeout-minutes: 30 name: eslint runs-on: latchkey-small steps: - name: Checkout repository uses: actions/checkout@v7 - name: Run eslint run: sudo npm install -g eslint; make eslint test: runs-on: latchkey-small name: Build and test timeout-minutes: 60 steps: - name: Checkout repository uses: actions/checkout@v7 with: fetch-depth: 0 filter: tree:0 - name: Setup Node.js version uses: actions/setup-node@v6 with: cache: 'npm' node-version: '24.17.0' registry-url: 'https://registry.npmjs.org' - name: Setup toolchain run: | rustup toolchain install stable --profile minimal rustup target add wasm32-unknown-unknown rustup component add rustfmt - name: Install APT packages run: | sudo apt-get update -y sudo apt-get install nasm gdb qemu-system-x86 libc6-dev-i386 -y - name: Build all-debug run: | rustc --version make all-debug - name: Build all run: make all - name: Build fallback run: make build/v86-fallback.wasm - name: rustfmt check run: make rustfmt - name: Fetch kvm-unit-test cache uses: actions/cache@v5 id: cache-kvm-unit-test with: path: tests/kvm-unit-tests/ key: ${{ runner.os }}-kvm-unit-test - name: Build kvm-unit-test if: steps.cache-kvm-unit-test.outputs.cache-hit != 'true' run: tests/kvm-unit-tests/build.sh - name: Run kvm-unit-test run: | tests/kvm-unit-tests/run.mjs tests/kvm-unit-tests/x86/taskswitch.flat tests/kvm-unit-tests/run.mjs tests/kvm-unit-tests/x86/taskswitch2.flat tests/kvm-unit-tests/run.mjs tests/kvm-unit-tests/x86/realmode.flat - name: Fetch namsmtests cache uses: actions/cache@v5 id: cache-nasmtests with: path: tests/nasm/build/ key: ${{ runner.os }}-nasmtests - name: Run nasmtests run: MAX_PARALLEL_TESTS=1 make nasmtests - name: Run nasmtests-force-jit run: MAX_PARALLEL_TESTS=1 make nasmtests-force-jit - name: Run rust-test run: make rust-test - name: Fetch image cache uses: actions/cache@v5 id: cache-images with: path: images/ key: ${{ runner.os }}-images-v2 - name: Download uncached images if: steps.cache-images.outputs.cache-hit != 'true' run: mkdir -p images && curl --compressed --output-dir images --remote-name-all https://i.copy.sh/{linux.iso,linux3.iso,linux4.iso,buildroot-bzimage68.bin,TinyCore-11.0.iso,oberon.img,msdos.img,openbsd-floppy.img,kolibri.img,windows101.img,os8.img,freedos722.img,mobius-fd-release5.img,msdos622.img} - name: Run api-tests run: make api-tests - name: Run qemutests run: make qemutests - name: Run qemutests-release run: make qemutests-release - name: Run jitpagingtests run: make jitpagingtests - name: Run integration tests run: MAX_PARALLEL_TESTS=1 make tests - name: Run devices tests run: make devices-test - name: Run expect tests run: make expect-tests - name: Update package.json version run: make update-package-json-version - name: Upload the artifact uses: actions/upload-artifact@v7 with: name: v86 path: | package.json LICENSE Readme.md v86.d.ts build/libv86*.js build/libv86*.js.map build/v86*.wasm build/*.mjs upload: timeout-minutes: 30 name: Upload release runs-on: latchkey-small needs: test if: github.ref == 'refs/heads/master' permissions: id-token: write contents: write steps: - name: Delete old release and tag uses: dev-drprasad/delete-tag-and-release@v1.0.1 with: delete_release: true tag_name: latest github_token: ${{ secrets.GITHUB_TOKEN }} - name: Get artifacts uses: actions/download-artifact@v8 with: name: v86 - name: Display structure of downloaded files run: ls -R - uses: actions/setup-node@v6 with: cache: 'npm' node-version: '24.17.0' registry-url: 'https://registry.npmjs.org' - name: Release to GitHub uses: ncipollo/release-action@v1 with: name: Latest Release tag: latest commit: master body: ${{ github.event.head_commit.message }} artifacts: "build/libv86*.js,build/libv86*.js.map,build/*.mjs,build/v86*.wasm" prerelease: true - name: Release to NPM run: npm publish --provenance --access public if: github.repository == 'copy/v86'
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.
2 third-party actions are referenced by a movable tag. Pin them 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:
- Dependency installs
- Network fetches
This workflow runs 3 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.