A simple server that carries out CI pipelines for your projects on GitHub.
- Install Node.js
- Create a personal access token on GitHub
- Pick a secure webhook secret.
- Create a file called
.env
inside the project directory in the following format:
GITHUB_ACCESS_TOKEN=<token>
HOST_IP=<ip_address>
SERVER_PORT=<port_number>
WEBHOOK_ENDPOINT_SUFFIX=<endpoint_suffix> # example: /webhooks/github
WEBHOOK_SECRET=<webhook_secret>
WORK_DIR=<absolute_path> # example: /home/utku/bombaci
Create a GitHub webhook for the project which you want to set up CI. Make sure that pull requests trigger the webhook:
Select a protected default branch (e.g. master
) via GitHub repository settings:
Edit rules for the protected branch so that pull requests cannot be accepted before certain status checks pass:
Create a file called bomba.yml
which might look like the following:
env: '.env'
build:
steps:
- name: client
command: "docker-compose build client"
- name: server
command: "docker-compose build server"
- name: db
command: "docker-compose build db"
test:
initialize: "docker-compose up -d db"
steps:
- name: server
command: "docker-compose run server npm run test"
finalize: "docker-compose down"
If there's an environment file that's not tracked by Git but required during the CI process, its name must be specified using the env
keyword in bomba.yml
. Also it has to be copied beforehand into <WORK_DIR>
in the host machine.
For instance, if WORK_DIR
is /home/utku/bombaci
, then the absolute path for this file has to be /home/utku/bombaci/.utkuufuk_bomba-ci
for this repository.
Any dependencies for building/testing the target project has to be installed in the host machine that bomba-ci
is going to be deployed.
As an example, Docker
has to be be pre-installed in the host machine if a project is meant to be built and/or tested using Docker
during the CI process.
Install dependencies:
npm install
Start server
# development mode
npm run dev
# production mode (background process)
npm start
Check server process:
npm run check
Stop server:
npm stop