# Unit tests
* Our build system is Jenkins and hosted at https://jenkins.c4science.ch
## Create a new Job
* Create a new Item of type "Freestyle project", give it a name
* Select Git as source code management and put the URL of the repository
** If your repository is private, you have to create a new Creadential for it, for instance using an SSH key with your Phabricator username, You'll add the public key to your phabricator profile: https://c4science.ch/settings/panel/ssh/
* If you want to periodically build the project, select the option under Build triggers and use this syntax `H/30 * * * *` to build every 30 mn. See complete documentation about the syntax by clicking on the question mark on the right of the field
* To run your unit test, add a Build step, select Execute Shell and provide the command to run your tests
### Run builds from Phabricator
* You can also trigger a build from Phabricator
* Create a Build Plan for your repository, https://c4science.ch/harbormaster/plan/
* Add a new Build Step of type "Make HTTP Request"
* You'll have to create a token on your Jenkins job, go to your job configuration page under Build Triggers, tick "Trigger builds remotely" and create a token.
** The best would be some random string, you can generate one like this on a linux shell: `head /dev/urandom | md5sum`
* Go back to your Build step on Phabricator and add the following URL, `https://jenkins.c4science.ch/buildByToken/build?token=<your token>&job=<your job name>`
* Save your step
* Go to Herald, https://c4science.ch/herald/
* Create a new Rule on Commits of type Global
* Give it a name and select the condition as "Repository is any of <your repository>"
* Then select the "Run build plans" action with your newly created Build plan
* Save the rule
* Now when a commit is pushed on your repository, a build will be generated on your Jenkins job
# Linters
* You can use various syntax checking tools when submitting patches to phabricator
### List available tools
```
arc linters
```
### Configuration of a specific linter for your project
* Create a .arclint file in your project with the desired linters
* In this example it has python, text, spelling and filename linters
```
{
"linters": {
"spelling-linter": {
"type": "spelling"
},
"filename-linter": {
"type": "filename"
},
"text-linter": {
"type": "text"
},
"python-checks": {
"type": "pylint",
"include": "(\\.py$)"
}
}
}
```
Checks all files with configured linters
```
arc lint --everything
```
* Complete documentation: https://secure.phabricator.com/book/phabricator/article/arcanist_lint/
# Official documentation
* Lint [[https://secure.phabricator.com/book/phabricator/article/arcanist_lint/]]