|  |  | **1. Setup Slack integration** | 
|  |  |  | 
|  |  | *  Make sure you have admin access to your Slack team. | 
|  |  | *  Open Slack application, select your team's name and select Apps & Integrations. | 
|  |  |  | 
|  |  | *  Select "Build" in the upper right corner. | 
|  |  | *  Select "Make a custom integration". | 
|  |  | *  Select "Incoming webhooks". | 
|  |  | *  Select a channel you want to post in and click "Add incoming WebHooks integration". | 
|  |  | *  Configure integration (optional) and save WebHook URL for future use. | 
|  |  |  | 
|  |  | **2. Setup slash command** | 
|  |  |  | 
|  |  | *  Go to Slack configuration panel again. | 
|  |  | *  Select "Build" in the upper right corner. | 
|  |  | *  Select "Make a custom integration". | 
|  |  | *  Select "Slash commands". | 
|  |  | *  Specify command name following the convention /build-<proj_name>-<platform>-<configuration>, e.g. /build-myproj-ios-qa | 
|  |  | *  Click "Add Slash Command Integration". | 
|  |  | *  Enter `http://macos.faifly.com:8181/slack-commands/trigger-build` as URL, add custom name and setup autocomplete. | 
|  |  | *  Save the changes. | 
|  |  |  | 
|  |  | **3. Setup Gitlab CI for the project** | 
|  |  |  | 
|  |  | *  Go to http://gitlab.faifly.com/ and select your project. | 
|  |  | *  Click "Setup CI" button. | 
|  |  | *  Copy-paste the following code: | 
|  |  | ```stages: | 
|  |  | - diawi | 
|  |  |  | 
|  |  | diawi_build: | 
|  |  | stage: diawi | 
|  |  | script: | 
|  |  | - fastlane ios ${FASTLANE_CONFIGURATION} slack_response_url:"${SLACK_RESPONSE_URL}" | 
|  |  | only: | 
|  |  | - triggers | 
|  |  | ``` | 
|  |  | *  Click "Commit Changes". | 
|  |  | *  Go to project settings (in Gitlab) and select "Triggers". | 
|  |  | *  Add trigger. | 
|  |  | *  Make a note of new trigger's token and project's ID. Project ID can be found here: | 
|  |  |  | 
|  |  |  | 
|  |  | **4. Configure the project** | 
|  |  |  | 
|  |  | *  Enable automatic signing. | 
|  |  | *  Go to Build Settings. | 
|  |  | *  Find `Code Signing Identity` Field and select `iOS Distribution` for your distribution configuration. | 
|  |  | *  Make sure `Development Team` is correctly selected for your distribution configuration. | 
|  |  | *  Go to https://developer.apple.com/ and generate AdHoc provisioning profiles for your project and make sure you have a correct signing identity to use them. | 
|  |  | * | 
|  |  |  | 
|  |  | **3. Setup fastlane for the project.** | 
|  |  |  | 
|  |  | *  Run`fastlane init` and follow the instructions. | 
|  |  | * | 
|  |  | \ No newline at end of file |