Skip to content
Latchkey

CI workflow (dillonzq/LoveIt)

The CI workflow from dillonzq/LoveIt, explained and optimized by Latchkey.

B

CI health: B - good

Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: dillonzq/LoveIt.github/workflows/ci.ymlLicense MITView source

What it does

This is the CI workflow from the dillonzq/LoveIt 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: CI

on:
  push:
    branches: [ "master" ]
  pull_request:

permissions:
  contents: read

concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build-and-validate:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        hugo_version: [ "0.146.0", "0.157.0" ]
        hugo_env: [ production, development ]
        include:
          - hugo_env: production
            build_args: "--source exampleSite --gc --minify --panicOnWarning"
          - hugo_env: development
            build_args: "--source exampleSite --buildDrafts --buildFuture"
    env:
      HUGO_ENV: ${{ matrix.hugo_env }}

    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          submodules: recursive

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v3
        with:
          hugo-version: ${{ matrix.hugo_version }}
          extended: true

      - name: Build
        run: |
          hugo ${{ matrix.build_args }}

      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: "3.3"

      - name: Install Validator
        run: gem install html-proofer -v 5.2.0

      - name: Validate Output
        run: |
          htmlproofer ./exampleSite/public \
            --disable-external \
            --ignore-missing-alt \
            --no-enforce-https

  ci-gate:
    runs-on: ubuntu-latest
    needs: [ build-and-validate ]
    if: always()
    steps:
      - run: |
          echo "build-and-validate result: ${{ needs.build-and-validate.result }}"
          if [ "${{ needs.build-and-validate.result }}" != "success" ]; then
            exit 1
          fi

The same workflow, on Latchkey

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

name: CI
 
on:
  push:
    branches: [ "master" ]
  pull_request:
 
permissions:
  contents: read
 
concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build-and-validate:
    timeout-minutes: 30
    runs-on: latchkey-small
    strategy:
      fail-fast: false
      matrix:
        hugo_version: [ "0.146.0", "0.157.0" ]
        hugo_env: [ production, development ]
        include:
          - hugo_env: production
            build_args: "--source exampleSite --gc --minify --panicOnWarning"
          - hugo_env: development
            build_args: "--source exampleSite --buildDrafts --buildFuture"
    env:
      HUGO_ENV: ${{ matrix.hugo_env }}
 
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          submodules: recursive
 
      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v3
        with:
          hugo-version: ${{ matrix.hugo_version }}
          extended: true
 
      - name: Build
        run: |
          hugo ${{ matrix.build_args }}
 
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: "3.3"
 
      - name: Install Validator
        run: gem install html-proofer -v 5.2.0
 
      - name: Validate Output
        run: |
          htmlproofer ./exampleSite/public \
            --disable-external \
            --ignore-missing-alt \
            --no-enforce-https
 
  ci-gate:
    timeout-minutes: 30
    runs-on: latchkey-small
    needs: [ build-and-validate ]
    if: always()
    steps:
      - run: |
          echo "build-and-validate result: ${{ needs.build-and-validate.result }}"
          if [ "${{ needs.build-and-validate.result }}" != "success" ]; then
            exit 1
          fi
 

What changed

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.

This workflow runs 2 jobs (5 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