* Our build system is Jenkins and hosted at https://jenkins.c4science.ch
# How to do Continuous Integration (CI)
There are two ways of doing unit testing in c4science
* [[#using-jenkins-on-c4scien | With Jenkins or external build system (advanced)]]
* [[#using-arcanist-on-your-l | With Arcanist when doing code review or manually (simple)]]
# Using Jenkins on c4science
### Access
Jenkins on c4science is in private beta mode. You can [[https://c4science.ch/maniphest/task/edit/form/8/?title=Jenkins%20access | ask to have access]]. Once you're given access to the group #jenkins_access
you will see a `Jenkins Job` tab on every of your repository and a `Create Jenkins Job`on your Project.
### How this works
You can create a new Job from a Project page or from the [[/jobs | Jenkins application]]. You'll have to provide a Project that will be used as Policy for the job. Only the people in the Project will have access to the Job on Jenkins. You also have to provide a branch the Job will use.
Once you created the job, a Harbormaster build plan and a Herald commit rule will automatically be created. The Herald rule triggers the Harbormaster build plan on new commit on the Repository/Branch couple. The build plan then call the new Jenkins Job.
You can see the status of the job from the Project page and the Repository page, as well as the link to the Jenkins job.
### Jenkinsfile
The most important part of the setup is the Jenkinsfile. It is a file that must be present in your repository/branch the job will execute against. This file contains a set of options and command that define your Job.
You can find basic example in this repo: rPHJENKINS
# Using Arcanist on your local machine
We'll be using a community extensions to integrate your custom unit test engine with Phabricator. This extensions allows any [[https://testanything.org/|TAP]] compatible engine to be used. You can also write your own engine, [[https://secure.phabricator.com/book/phabricator/article/arcanist_lint_unit/|take a look at the documentation]].
* In your repository
* Add the lib as a submodule
```
git submodule add https://github.com/tagview/arcanist-extensions.git .arcanist-extensions
git submodule update --init
```
* Create an `.arcconfig` file with the following content
```{
"load": [
".arcanist-extensions/tap_test_engine"
],
"unit.engine": "TAPTestEngine",
"unit.engine.tap.command": "your_unit_test_script.sh"
}
```
* Replace `your_unit_test_script.sh` by a script in your repository that do the unit testing and returns the result in a [[https://testanything.org/producers.html|TAP format]]
* For instance if your code is in python, you can use `tap.py`, see the example in rPHTEST
* Those tests can be run by using the `arc unit` command or it will be run automatically when you create a Differential Revision using Arcanist (`arc diff`)