Build Web Application workflow (derisk-ai/OpenDerisk)
The Build Web Application workflow from derisk-ai/OpenDerisk, 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 Build Web Application workflow from the derisk-ai/OpenDerisk 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: Build Web Application
# Triggered when the web directory or this file is changed
on:
pull_request:
branches:
- main
paths:
- web/**
- .github/workflows/build-web.yml
push:
branches:
- main
paths:
- web/**
- .github/workflows/build-web.yml
concurrency:
group: ${{ github.event.number || github.run_id }}
cancel-in-progress: true
defaults:
run:
# Runs all jobs in the web directory
working-directory: ./web
jobs:
build-web:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# FIXME: Add windows-latest support
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: |
yarn install
- name: Build web application
run: |
yarn build
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: Build Web Application # Triggered when the web directory or this file is changed on: pull_request: branches: - main paths: - web/** - .github/workflows/build-web.yml push: branches: - main paths: - web/** - .github/workflows/build-web.yml concurrency: group: ${{ github.event.number || github.run_id }} cancel-in-progress: true defaults: run: # Runs all jobs in the web directory working-directory: ./web jobs: build-web: timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: # FIXME: Add windows-latest support os: [ubuntu-latest, macos-latest] steps: - uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: cache: 'npm' node-version: 20 - name: Install dependencies run: | yarn install - name: Build web application run: | yarn build
What changed
- 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.
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 (2 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.