Skip to content
Latchkey

Continuous Integration workflow (jekyll/jekyll)

The Continuous Integration workflow from jekyll/jekyll, 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: jekyll/jekyll.github/workflows/ci.ymlLicense MITView source

What it does

This is the Continuous Integration workflow from the jekyll/jekyll 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: Continuous Integration

on:
  push:
    branches:
      - master
      - "*-stable"
    paths-ignore:
      - "docs/**"
  pull_request:
    branches:
      - master
      - "*-stable"
    paths-ignore:
      - "docs/**"

jobs:
  ci:
    name: "Run Tests (${{ matrix.ruby.label }} on ${{ matrix.os.label }})"
    runs-on: ${{ matrix.os.image }}
    strategy:
      fail-fast: false
      matrix:
        ruby:
          - label: Ruby 2.7
            version: "2.7"
          - label: Ruby 3.3
            version: "3.3"
          - label: Ruby 3.4
            version: "3.4"
        os:
          - label: Linux
            image: "ubuntu-latest"
          - label: Windows
            image: "windows-latest"
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4
      - name: "Set up ${{ matrix.ruby.label }}"
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby.version }}
          bundler-cache: true
      - name: Run Minitest based tests
        run: bash script/test
      - name: Run Cucumber based tests
        run: bash script/cucumber --color
      - name: Generate and Build a new site
        run: bash script/default-site

  xtras:
    name: "${{ matrix.job_name }} (${{ matrix.setup_label }})"
    runs-on: "ubuntu-latest"
    strategy:
      fail-fast: false
      matrix:
        include:
          - job_name: "Unit Test with JRuby"
            setup_label: "JRuby 9.4.8.0"
            step_name: "Run Minitest based tests"
            script_file: "test"
            ruby_version: "jruby-9.4.8.0"
          - job_name: "Smoke Test with JRuby"
            setup_label: "JRuby 9.4.8.0"
            step_name: "Generate and Build a new site"
            script_file: "default-site"
            ruby_version: "jruby-9.4.8.0"
          - job_name: "Profile Docs Site"
            setup_label: "Ruby 2.7"
            step_name: "Build and Profile docs site"
            script_file: "profile-docs"
            ruby_version: "2.7"
          - job_name: "Style Check"
            setup_label: "Ruby 2.7"
            step_name: "Run RuboCop"
            script_file: "fmt"
            ruby_version: "2.7"
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4
      - name: "Set up ${{ matrix.setup_label }}"
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby_version }}
          bundler-cache: true
      - name: ${{ matrix.step_name }}
        run: bash script/${{ matrix.script_file }}

The same workflow, on Latchkey

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

name: Continuous Integration
 
on:
  push:
    branches:
      - master
      - "*-stable"
    paths-ignore:
      - "docs/**"
  pull_request:
    branches:
      - master
      - "*-stable"
    paths-ignore:
      - "docs/**"
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  ci:
    timeout-minutes: 30
    name: "Run Tests (${{ matrix.ruby.label }} on ${{ matrix.os.label }})"
    runs-on: ${{ matrix.os.image }}
    strategy:
      fail-fast: false
      matrix:
        ruby:
          - label: Ruby 2.7
            version: "2.7"
          - label: Ruby 3.3
            version: "3.3"
          - label: Ruby 3.4
            version: "3.4"
        os:
          - label: Linux
            image: "ubuntu-latest"
          - label: Windows
            image: "windows-latest"
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4
      - name: "Set up ${{ matrix.ruby.label }}"
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby.version }}
          bundler-cache: true
      - name: Run Minitest based tests
        run: bash script/test
      - name: Run Cucumber based tests
        run: bash script/cucumber --color
      - name: Generate and Build a new site
        run: bash script/default-site
 
  xtras:
    timeout-minutes: 30
    name: "${{ matrix.job_name }} (${{ matrix.setup_label }})"
    runs-on: "ubuntu-latest"
    strategy:
      fail-fast: false
      matrix:
        include:
          - job_name: "Unit Test with JRuby"
            setup_label: "JRuby 9.4.8.0"
            step_name: "Run Minitest based tests"
            script_file: "test"
            ruby_version: "jruby-9.4.8.0"
          - job_name: "Smoke Test with JRuby"
            setup_label: "JRuby 9.4.8.0"
            step_name: "Generate and Build a new site"
            script_file: "default-site"
            ruby_version: "jruby-9.4.8.0"
          - job_name: "Profile Docs Site"
            setup_label: "Ruby 2.7"
            step_name: "Build and Profile docs site"
            script_file: "profile-docs"
            ruby_version: "2.7"
          - job_name: "Style Check"
            setup_label: "Ruby 2.7"
            step_name: "Run RuboCop"
            script_file: "fmt"
            ruby_version: "2.7"
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4
      - name: "Set up ${{ matrix.setup_label }}"
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby_version }}
          bundler-cache: true
      - name: ${{ matrix.step_name }}
        run: bash script/${{ matrix.script_file }}
 

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.

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