V8 Build workflow (rogchap/v8go)
The V8 Build workflow from rogchap/v8go, explained and optimized by Latchkey.
CI health: B - good
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 V8 Build workflow from the rogchap/v8go repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: V8 Build
on: workflow_dispatch
jobs:
build:
name: Build V8 for ${{ matrix.platform }} ${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
# We use macos-11 over macos-latest because macos-latest defaults to Catalina(10.15) and not Big Sur(11.0)
# We can switch to macos-latest whenever Big Sur becomes the default
# See https://github.com/actions/virtual-environments#available-environments
#
# We need xcode 12.4 or newer to cross compile between arm64/amd64
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md#xcode
platform: [ubuntu-22.04, macos-11]
arch: [x86_64, arm64]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 1
- name: Update depot_tools fetch config
run: cd deps/depot_tools && git config --unset-all remote.origin.fetch; git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
shell: bash
- name: Install g++-aarch64-linux-gnu
if: matrix.platform == 'ubuntu-22.04' && matrix.arch == 'arm64'
run: sudo apt update && sudo apt install g++-aarch64-linux-gnu -y
- name: Build V8 linux
if: matrix.platform == 'ubuntu-22.04'
run: cd deps && ./build.py --no-clang --arch ${{ matrix.arch }}
- name: Build V8 macOS
if: matrix.platform == 'macos-11'
run: cd deps && ./build.py --arch ${{ matrix.arch }}
- name: Create PR
uses: peter-evans/create-pull-request@v3
with:
commit-message: Update V8 static library for ${{ matrix.platform }} ${{ matrix.arch }}
branch-suffix: random
delete-branch: true
title: V8 static library for ${{ matrix.platform }} ${{ matrix.arch }}
body: Auto-generated pull request to build V8 for ${{ matrix.platform }} ${{ matrix.arch }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: V8 Build on: workflow_dispatch jobs: build: timeout-minutes: 30 name: Build V8 for ${{ matrix.platform }} ${{ matrix.arch }} strategy: fail-fast: false matrix: # We use macos-11 over macos-latest because macos-latest defaults to Catalina(10.15) and not Big Sur(11.0) # We can switch to macos-latest whenever Big Sur becomes the default # See https://github.com/actions/virtual-environments#available-environments # # We need xcode 12.4 or newer to cross compile between arm64/amd64 # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md#xcode platform: [ubuntu-22.04, macos-11] arch: [x86_64, arm64] runs-on: ${{ matrix.platform }} steps: - name: Checkout uses: actions/checkout@v2 with: submodules: true fetch-depth: 1 - name: Update depot_tools fetch config run: cd deps/depot_tools && git config --unset-all remote.origin.fetch; git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* shell: bash - name: Install g++-aarch64-linux-gnu if: matrix.platform == 'ubuntu-22.04' && matrix.arch == 'arm64' run: sudo apt update && sudo apt install g++-aarch64-linux-gnu -y - name: Build V8 linux if: matrix.platform == 'ubuntu-22.04' run: cd deps && ./build.py --no-clang --arch ${{ matrix.arch }} - name: Build V8 macOS if: matrix.platform == 'macos-11' run: cd deps && ./build.py --arch ${{ matrix.arch }} - name: Create PR uses: peter-evans/create-pull-request@v3 with: commit-message: Update V8 static library for ${{ matrix.platform }} ${{ matrix.arch }} branch-suffix: random delete-branch: true title: V8 static library for ${{ matrix.platform }} ${{ matrix.arch }} body: Auto-generated pull request to build V8 for ${{ matrix.platform }} ${{ matrix.arch }}
What changed
- 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:
- Dependency installs
This workflow runs 1 job (4 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.