Reflection to Tealeaf Course3 Week5 (2/2)
###Continuous Integration(CI) and Continous Delivery(CD)
This part is super exciting so I decide to make it a individual post.
Continuous Integration(CI) and Continous Delivery(CD) are two of most important part in automation development. There are plenty of innovation tools, but I think the work flow is the key to understand.
- Pull the latest code from GitHub.
- Create a new feature branch and develop.
- Finish development and put to a feature named branch on GitHub.
- Create a PR from this branch to
staging
branch. - Wait CI test for staging branch.
- CI automatically deploy from staging branch to
staging server
. - Manual test on staging server.
- Create PR from staging to
master
branch. - trigger CI for master branch and automatically deploy to
production server
.
###Setting CI and CD
Here we use Circle CI for CI and CD. There is also well known service called Travis CI.
- Create a
staging
branch. - Follow Circle CI project setting.
- You may need Heroku API key and SSH.
- [Key] Create a
circle.yml
in the root of project, adjustproduction_app_name
andstaging_app_name
.
1 | machine: |
I got an error when running Circle test: [counldn’t find file ‘bootstrap’]
Solution: Rename file stylesheets/application.css
to stylesheets/application.css.scss
. And add Line to the file:
1 | @import 'bootstrap-sprockents' |
and remove line *= require bootstrap
.
###Embeded Badget
I aslo try to use badget in my homepage.
1 | %img(src="https://circleci.com/gh/tomohung/myflix.png?circle-token=a7c782deb0d0022335fa1f095e268bb44eb4cab8") |
Then I can see this passing test badget.
Slack ingegration with Github and Circle CI
I failed to use CCMenu to have a notification. But I use Slack to integrate GitHub and Circle CI, and that’s why I said it’s exciting!!
After setting done, the only thing I need to do is git push origin staging
or git push origin master
. I’ll get notifications in Slack when Github got a push event, and Circle CI run the test and deployment in the same time. Surely I will also get a Circle CI result notification if test and deployment finished.
This is what a programmer should do!! Don’t Repeat Yourself!! Bravo!!