Skip to content
Latchkey

Node CI workflow (nklayman/vue-cli-plugin-electron-builder)

The Node CI workflow from nklayman/vue-cli-plugin-electron-builder, explained and optimized by Latchkey.

C

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 →
Source: nklayman/vue-cli-plugin-electron-builder.github/workflows/nodeCI.ymlLicense MITView source

What it does

This is the Node CI workflow from the nklayman/vue-cli-plugin-electron-builder 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

workflow (.yml)
name: Node CI

on:
  push:
  pull_request:

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-20.04, windows-latest]
        node: [ '14', '16' ]
        include:
        - os: windows-latest
          commandPrefix: ''
        - os: ubuntu-20.04
          commandPrefix: xvfb-run
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v3
    - name: Setup Node
      uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node }}
        cache: yarn
    - name: yarn install
      run: yarn install
    - name: yarn test
      run: ${{ matrix.commandPrefix }} yarn test --runInBand --coverage
      env:
        CI: true
    - name: Upload coverage to Codecov
      if: runner.os == 'Linux'
      uses: codecov/codecov-action@v3
      with:
        token: ${{secrets.CODECOV_TOKEN}}
        file: ./coverage/clover.xml

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Node CI
 
on:
  push:
  pull_request:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-20.04, windows-latest]
        node: [ '14', '16' ]
        include:
        - os: windows-latest
          commandPrefix: ''
        - os: ubuntu-20.04
          commandPrefix: xvfb-run
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v3
    - name: Setup Node
      uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node }}
        cache: yarn
    - name: yarn install
      run: yarn install
    - name: yarn test
      run: ${{ matrix.commandPrefix }} yarn test --runInBand --coverage
      env:
        CI: true
    - name: Upload coverage to Codecov
      if: runner.os == 'Linux'
      uses: codecov/codecov-action@v3
      with:
        token: ${{secrets.CODECOV_TOKEN}}
        file: ./coverage/clover.xml
 

What changed

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:

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.

Actions used in this workflow