Skip to content
Latchkey

CI workflow (sunspot/sunspot)

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

F

CI health: F - at risk

Point runs-on at Latchkey and get caching, run de-duplication, 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: sunspot/sunspot.github/workflows/ci.ymlLicense MITView source

What it does

This is the CI workflow from the sunspot/sunspot 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, pull_request]

jobs:
  skip_concurrent_build:
    name: Skip Concurrent Builds
    runs-on: ubuntu-latest
    outputs:
      should_skip: ${{ steps.skip_check.outputs.should_skip }}
    steps:
      - uses: fkirc/skip-duplicate-actions@v5.3.1
        id: skip_check
        with:
          concurrent_skipping: 'same_content'
          github_token: ${{ github.token }}
          do_not_skip: '["pull_request"]'
          cancel_others: 'true'
          skip_after_successful_duplicate: 'false'
          
  build:
    needs: skip_concurrent_build
    if: ${{ needs.skip_concurrent_build.outputs.should_skip != 'true' }}
    runs-on: ubuntu-latest
    timeout-minutes: 60
    strategy:
      fail-fast: false
      matrix:
        ruby-version:
          - '2.5'
          - '2.6'
          - '2.7'
          - '3.0'
          - '3.1'
          - '3.2'
          - '3.3'
          - '3.4'
          - 'head'
        gem: ['sunspot', 'sunspot_rails', 'sunspot_solr']
        update-format: ['xml', 'json']
    steps:
    - uses: actions/checkout@v4
    - name: Set up JDK 1.8
      uses: actions/setup-java@v4
      with:
        java-version: '8'
        distribution: 'adopt'
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby-version }}
        bundler: '1'
        bundler-cache: true # 'bundle install' and cache are handled automatically
    - name: Test
      run: ci/sunspot_test_script.sh
      env:
        GEM: ${{ matrix.gem }}
        UPDATE_FORMAT: ${{ matrix.update-format }}

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: CI
 
on: [push, pull_request]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  skip_concurrent_build:
    timeout-minutes: 30
    name: Skip Concurrent Builds
    runs-on: latchkey-small
    outputs:
      should_skip: ${{ steps.skip_check.outputs.should_skip }}
    steps:
      - uses: fkirc/skip-duplicate-actions@v5.3.1
        id: skip_check
        with:
          concurrent_skipping: 'same_content'
          github_token: ${{ github.token }}
          do_not_skip: '["pull_request"]'
          cancel_others: 'true'
          skip_after_successful_duplicate: 'false'
          
  build:
    needs: skip_concurrent_build
    if: ${{ needs.skip_concurrent_build.outputs.should_skip != 'true' }}
    runs-on: latchkey-small
    timeout-minutes: 60
    strategy:
      fail-fast: false
      matrix:
        ruby-version:
          - '2.5'
          - '2.6'
          - '2.7'
          - '3.0'
          - '3.1'
          - '3.2'
          - '3.3'
          - '3.4'
          - 'head'
        gem: ['sunspot', 'sunspot_rails', 'sunspot_solr']
        update-format: ['xml', 'json']
    steps:
    - uses: actions/checkout@v4
    - name: Set up JDK 1.8
      uses: actions/setup-java@v4
      with:
        cache: 'maven'
        java-version: '8'
        distribution: 'adopt'
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby-version }}
        bundler: '1'
        bundler-cache: true # 'bundle install' and cache are handled automatically
    - name: Test
      run: ci/sunspot_test_script.sh
      env:
        GEM: ${{ matrix.gem }}
        UPDATE_FORMAT: ${{ matrix.update-format }}
 

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.

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 2 jobs (55 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