---
title: "Setup CI/CD Workflow"
chapter: true
weight: 2
---
## Setup your Environments
In this video, we will be creating the Production and CI/CD Environments that our jobs will run on.
*Summary of this video:*
1. To create the Production environment, click on Environments under the hamburger menu. Click on `New Environment`. Name the Environment. Keep the `Deployment` type and the default dbt version (which is always the latest stable version). Use your user's Redshift credentials for the Deployment environment and called the schema `analytics`.
2. To create the CI/CD environment, repeat the above but name the default schema `qa`.
## Setup CI/CD Workflow
In this video, we will be adding a Pull Request Template and creating the Production and CI/CD jobs.
*Summary of this video:*
1. Check out a new branch by clicking on `create new branch`. Name the branch `feature/add_pull_request_template`.
2. Create a new folder called `.github` at the same level as the analysis folder.
3. Create a new file in the folder called `pull_request_template.md`. Paste the following pull request template in.
```md
## Description & motivation
## Changes to existing models:
## Screenshots (DAG, query results):
## Validation of models:
## Checklist:
- [ ] My pull request represents one logical piece of work.
- [ ] My commits are related to the pull request and look clean.
- [ ] My SQL follows the [dbt Labs style guide](https://github.com/dbt-labs/corp/blob/master/dbt_style_guide.md).
- [ ] I have materialized my models appropriately.
- [ ] I have added appropriate tests and documentation to any new models or fields.
```
4. Save the file by clicking on Save or CMD+S/Ctrl+S
5. Click on `Open Pull Request`
6. Fill out the Pull Request template and Merge in the Pull Request.
7. Delete the existing branch.
8. Now go back to dbt Cloud. Go to Jobs by clicking on the hamburger and click on Jobs.
9. Click on `New Job` for a new Production Job.
10. Fill out the form this way:
- Name the job `Production Daily`.
- Choose the Production Environment.
- Check off generate docs.
- Add a new command `dbt test` under the `dbt run` command.
- Update the schedule to run every 12 hours.
11. Click off the Production job by clicking on `Run Now`
12. Take a look through the run steps. Take a look at each step and view the documentation site the run generated.
13. Now create the CI/CD job. To do this, fill out the form in this way:
- Name the job: CI/CD
- Choose the CI/CD Environment
- Check off generate docs
- Defer to the Production Daily run state
- Update the dbt run command to `dbt run -m state:modified+`
- Add a new command `dbt test -m state:modified+` under the dbt run command.
- Uncheck the `Run on Schedule` and check `Run on Pull Request`
## Helpful Links
- [Here are our docs on SlimCI builds](https://docs.getdbt.com/docs/dbt-cloud/using-dbt-cloud/cloud-enabling-continuous-integration-with-github#slim-ci)
- [Here are our docs on generating documentation](https://docs.getdbt.com/docs/dbt-cloud/using-dbt-cloud/cloud-generating-documentation)
- [Here are our docs on source freshness](https://docs.getdbt.com/docs/dbt-cloud/using-dbt-cloud/cloud-snapshotting-source-freshness)