{"id":13681409,"url":"https://github.com/alpacaaa/quad-ci","last_synced_at":"2026-02-09T02:08:25.696Z","repository":{"id":42520764,"uuid":"323908315","full_name":"alpacaaa/quad-ci","owner":"alpacaaa","description":"A CI server written in Simple Haskell.","archived":false,"fork":false,"pushed_at":"2022-04-01T16:30:43.000Z","size":278,"stargazers_count":188,"open_issues_count":1,"forks_count":12,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-11-12T00:36:40.457Z","etag":null,"topics":["architecture","haskell"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alpacaaa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-23T13:23:10.000Z","updated_at":"2024-10-13T00:36:45.000Z","dependencies_parsed_at":"2022-09-21T19:51:45.850Z","dependency_job_id":null,"html_url":"https://github.com/alpacaaa/quad-ci","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacaaa%2Fquad-ci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacaaa%2Fquad-ci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacaaa%2Fquad-ci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacaaa%2Fquad-ci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alpacaaa","download_url":"https://codeload.github.com/alpacaaa/quad-ci/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251635230,"owners_count":21619178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["architecture","haskell"],"created_at":"2024-08-02T13:01:30.392Z","updated_at":"2026-02-09T02:08:25.658Z","avatar_url":"https://github.com/alpacaaa.png","language":"Haskell","readme":"# Quad CI\n\n![Build Status][]\n\nQuad CI is a _simple_, _tiny_ and _beginner friendly_ Continuous Integration system written in Haskell.\n\n### Features\n\n- sandboxed builds in docker containers\n- multi-node architecture with agents picking up jobs to work on\n- http api to interact with the frontend and other nodes\n- support for triggering builds with github webhooks\n\nAll in 1K lines of code!\n\n[![Screenshot](https://www.dropbox.com/s/x9zujrrgrndn5xz/preview.jpg?raw=1\u0026a)](https://www.dropbox.com/s/k5drxinaq6hjnct/quad-ci-intro.mp4?raw=1)\n\n#### 📼 Watch the [Intro video](https://www.dropbox.com/s/k5drxinaq6hjnct/quad-ci-intro.mp4?raw=1) (~2 minutes).\n\n---\n\n\n\u003cimg src=\"https://marcosampellegrini.com/book-cover.png\" width=\"100\" align=\"left\"\u003e\n\n### Check out the [Simple Haskell Handbook](https://marcosampellegrini.com/simple-haskell-book) where we start from **zero lines of code** and build Quad CI _from scratch_!\n\n\u003cbr clear=\"left\"/\u003e\n\n---\n\n### Getting Started\n\n```bash\n# Needed for RecordDotSyntax\n$ stack install record-dot-preprocessor\n\n# Run server\n$ stack run -- start-server\n\n# Run agent\n$ stack run -- start-agent\n```\n\nTry running a simple build:\n\n```bash\n$ curl -X POST -H \"Content-Type: application/json\" -d \\\n@test/github-payload.sample.json \"http://localhost:9000/webhook/github\"\n\n```\n\nQuad CI comes with a web UI, which can be accessed at `http://localhost:3000`. To install it, run the following:\n\n```bash\ncd frontend/\nyarn\nyarn next\n```\n\n### Why?\n\nThis project tries to answer the question: _How do I build an application with Haskell?_\n\nIntermediate 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).\n\nAnother goal is to showcase [Simple Haskell](https://www.simplehaskell.org/) (or at least my own interpretation of it).\n\nFinally, 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.\n\n### Architecture\n\nSingle server - multiple agents.\n\nBuilds share workspace.\n\nSTM queue\n\n1 build/agent concurrency limit\n\n\n### Codebase overview\n\n_`src/Core.hs`_  \nDomain types (`Build`, `Pipeline` etc.) along with main state machine (`progress`)\n\n_`src/Docker.hs`_  \nTalks to Docker api\n\n_`src/Runner.hs`_  \nRuns a single build, collecting logs (`Core.collectLogs`) and processing state updates (`Core.progress`)\n\n_`src/JobHandler.hs`_  \nIntroduces `Job` type, which is just a `Build` that can be _queued_ and _scheduled_\n\n_`src/JobHandler/Memory.hs`_  \nAn in-memory implementation of `JobHandler`, built on top of STM\n\n_`src/Github.hs`_  \nTalks to Github api\n\n_`src/Agent.hs`_  \nAgents ask the server for work to do, run builds (`Runner`) and send updates back to the server\n\n_`src/Server.hs`_  \nThe 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)\n\n_`src/Cli.hs`_  \nMain entrypoint. Calls either `Server.run` or `Agent.run`\n\n_`src/Socket.hs`_  \nLow-level code to send http requests to a socket. Not interesting, can be ignored.\n\n---\n\nFor a full overview of the codebase, check out the [Simple Haskell Handbook](https://marcosampellegrini.com/simple-haskell-book) where we start from **zero lines of code** and build Quad CI _from scratch_!\n\n[build status]: https://github.com/alpacaaa/quad-ci/workflows/ci/badge.svg\n","funding_links":[],"categories":["Haskell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falpacaaa%2Fquad-ci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falpacaaa%2Fquad-ci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falpacaaa%2Fquad-ci/lists"}