• Stars
    star
    188
  • Rank 204,404 (Top 5 %)
  • Language
    Haskell
  • License
    MIT License
  • Created over 3 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A CI server written in Simple Haskell.

Quad CI

Build Status

Quad CI is a simple, tiny and beginner friendly Continuous Integration system written in Haskell.

Features

  • sandboxed builds in docker containers
  • multi-node architecture with agents picking up jobs to work on
  • http api to interact with the frontend and other nodes
  • support for triggering builds with github webhooks

All in 1K lines of code!

Screenshot

📼 Watch the Intro video (~2 minutes).


Check out the Simple Haskell Handbook where we start from zero lines of code and build Quad CI from scratch!



Getting Started

# Needed for RecordDotSyntax
$ stack install record-dot-preprocessor

# Run server
$ stack run -- start-server

# Run agent
$ stack run -- start-agent

Try running a simple build:

$ curl -X POST -H "Content-Type: application/json" -d \
@test/github-payload.sample.json "http://localhost:9000/webhook/github"

Quad CI comes with a web UI, which can be accessed at http://localhost:3000. To install it, run the following:

cd frontend/
yarn
yarn next

Why?

This project tries to answer the question: How do I build an application with Haskell?

Intermediate level practical resources on Haskell are notoriously hard to find. My goal is to provide a real world example of an Haskell application, while keeping the scope small (Quad CI is only 1000 lines of code, including tests).

Another goal is to showcase Simple Haskell (or at least my own interpretation of it).

Finally, I think RecordDotSytax is one of the coolest things that happened in Haskell land recently and I wanted to show how to use it in practice.

Architecture

Single server - multiple agents.

Builds share workspace.

STM queue

1 build/agent concurrency limit

Codebase overview

src/Core.hs
Domain types (Build, Pipeline etc.) along with main state machine (progress)

src/Docker.hs
Talks to Docker api

src/Runner.hs
Runs a single build, collecting logs (Core.collectLogs) and processing state updates (Core.progress)

src/JobHandler.hs
Introduces Job type, which is just a Build that can be queued and scheduled

src/JobHandler/Memory.hs
An in-memory implementation of JobHandler, built on top of STM

src/Github.hs
Talks to Github api

src/Agent.hs
Agents ask the server for work to do, run builds (Runner) and send updates back to the server

src/Server.hs
The server collects jobs to be run (when receiving webhook events). It keeps an internal job queue (JobHandler) exposed as an http api (used by web ui)

src/Cli.hs
Main entrypoint. Calls either Server.run or Agent.run

src/Socket.hs
Low-level code to send http requests to a socket. Not interesting, can be ignored.


For a full overview of the codebase, check out the Simple Haskell Handbook where we start from zero lines of code and build Quad CI from scratch!

More Repositories

1

zero-bs-haskell

Learn Haskell, with tiny lessons.
Haskell
558
star
2

elm-to-purescript-cheatsheet

Purescript for Elm devs. 🚀
PureScript
175
star
3

max4node

Control Ableton Live through Node.js. Yes, holy shit.
CoffeeScript
114
star
4

react-native-media-queries

Media queries like functionality for React Native
JavaScript
72
star
5

elm-hn

An Hacker News clone written in Elm.
Elm
67
star
6

runelm.io

A place to share and run elm code.
JavaScript
25
star
7

tex

Minimalistic file explorer, written in Haskell.
Haskell
17
star
8

elm-date-distance

Date/Time distance helpers: time ago, less than 5 minutes, about 1 month...
Elm
16
star
9

wadoo

An XML/XSLT static site generator written in PHP.
PHP
13
star
10

xpathr

be very very *very* careful
PHP
11
star
11

elm-star-dodge

A simple star dodge game clone.
Elm
11
star
12

purescript-simplecrypto

A set of useful cryptographic utilities for blockchain development.
PureScript
11
star
13

openid_auth

A Symphony CMS extension that allow users to authenticate with their OpenID.
PHP
8
star
14

resave_entries

A simple Symphony CMS extension that let you resave your entries after structural section changes.
PHP
7
star
15

shorten

A Symphony CMS field that shorten entry ids to tiny alphanumeric strings (like u8X).
PHP
7
star
16

node-xonek2

Node api for the awesome XONE:K2 MIDI controller by Allen & Heath
CoffeeScript
5
star
17

elm-mastermind

Mastermind game written in Elm. Play with a runnable demo at https://runelm.io/c/f2t
Elm
5
star
18

elm-memory-game

Memory Game written in Elm. Play with a runnable demo at https://runelm.io/c/fbi
Elm
5
star
19

builder-workspace

PHP
5
star
20

builder

Builder extension for Symphony CMS
PHP
4
star
21

xpathr-old

santa claus is coming to town ♫ (he's a bit late)
PHP
4
star
22

purescript-merkle-tree

Merkle Trees in Purescript.
PureScript
4
star
23

image_info

Iptc and Exif metadata for Symphony CMS
PHP
3
star
24

alpacaaa.github.io

HTML
3
star
25

quad-sample-pipeline

JavaScript
3
star
26

elm-rock-paper-scissors

Rock paper scissors game written in Elm. Play with a runnable demo at https://runelm.io/c/9cr
Elm
3
star
27

yothisiscool

Show some love to the amazing people behind cool open source projects!
HTML
3
star
28

trunk.life

There's only one branch that matters #trunklife
CSS
2
star
29

elm-roguelike

Elm
2
star
30

referendum2011

Python
2
star
31

redux-purify

Purify your actions and reducers, no more boilerplate and purified sin free code for ya
JavaScript
2
star
32

simpledb-backup

Simple solution to backup mysql dbs and push them to a remote server (ssh).
PHP
1
star
33

osso

PureScript
1
star
34

haybale

Haskell
1
star
35

purescript-AoC2017

I am perfectly aware I will never complete it.
PureScript
1
star
36

peanocoin

Simple cryptocurrency in Purescript.
PureScript
1
star