Project

local_ci

0.0
No release in over 3 years
A way to run CI locally but also able to run easily on your hosted CI
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

 Project Readme

LocalCI

Run your CI suite locally

Gem Version Total Gem Downloads

LocalCI is a tool for running your Continuous Integration (CI) both locally and on CI platforms.

Usage Locally

If you don't have a Gemfile you should run bundle init before running bundle add local_ci --group development,testing --source https://rubygems.org.

In your Rakefile add the following:

require "local_ci"

LocalCI::Rake.setup(self)

setup do
  job "Run before everything", "echo 'Run before everything'"
end

teardown do
  job "Run after everything", "echo 'Run after everything'"
end

flow "Example flow" do
  setup do
    job "Run before everything in this flow" do
      run "echo 'Run before everything in this flow'"
    end
  end

  teardown do
    job "Run after everything in this flow" do
      run "echo 'Run after everything in this flow'"
    end
  end

  job "Some Job" do
    run "echo 'do something here'"
  end

  job "Some Other Job" do
    run "echo 'do something here'"
  end
end

Test it by running bunde exec rake ci and you should see output similar to this.

Example output from bundle exec rake ci

Usage on CI Platforms

Buildkite

Build status

In your Buildkite project settings, go to the "Steps" and define the "YAML Steps" like this:

steps:
  - label: ":pipeline: Pipeline upload"
    commands:
      - bundle check &> /dev/null || bundle install
      - bundle exec rake ci:generate:buildkite | buildkite-agent pipeline upload

This will automatically generate a Buildkite pipeline for you from your Rakefile.

SemaphoreCI

Semaphore CI 2.0 Build Status

In your project run bundle exec rake ci:generate:semaphore_ci, this will create a .semaphore/semaphore.yml file for you.

Warning

You will need to keep this is sync with your Rakefile. I recommend setting up a pre-push git hook that checks to see if the file has changed.

task "pre-push:semaphore:check" => "ci:generate:semaphore_ci"
task "pre-push:semaphore:check" do
  puts "=== Checking there would be no changes to `.semaphore/semaphore.yml` ==="
  sh "git diff -s --exit-code .semaphore/semaphore.yml"
  puts "[✓] No changes"
rescue RuntimeError
  puts "[x] Changes detected, check `git diff`"
  exit 1
end