Code Challenge 46 - Add Continuous Integration (CI) to Your Project

PyBites, Mon 11 December 2017, Challenge

automation, Better Code Hub, CI, deployment, Docker, Heroku, Jenkins, Semaphore, SIG, Travis

It's not that I'm so smart, it's just that I stay with problems longer. - A. Einstein

Hi Pythonistas, becoming a Python developer is partly about knowing your tools. Managing your environment, testing and continuous integration are unmissable skills when you start working on bigger projects with a team. So we decided to dedicate a code challenge to deployment.

Take an existing projects or make a demo app from scratch, the goal is to build an automated pipeline. Will you be the next guy or girl at work receiving kudos for setting up a Jenkins server? Have fun!

CI Defined

CI is great to streamline and automate deployment of your software, saving time and quickly finding regression bugs. It enforces quality of your software. For a broader definition check out Martin Fowler's Continuous Integration article:

Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly.

The Challenge

  1. Choose one of your existing projects or start a small demo project.

  2. If you have tests, good move on to the next step, if not add them now - overview testing / if you go with pytest consider taking Code Challenge 39 - Writing Tests With Pytest too.

  3. Choose a tool to automate your build. We played a bit with Travis CI and it's nice. Alternatively there is Semaphore or what about Jenkins? We want you to be free. You can check out the Hitchhiker's guide or Full Stack Python's CI and Jenkins reference pages and choose the tool you feel most comfortable with.

  4. Open a PR against our repo with a username/ file detailing what you did, ideally with a screenshot of an automated build. We are happy to share it with our community in our monthly review post.

  5. Bonus: Rob van der Leek (SIG) wrote a great article: How to build a modern CI/CD pipeline. You get bonus karma if you additionally use Docker and Better Code Hub.

Good luck and if any issues or brainstorming, there is ...

Pybites Slack

You like these challenges? We have published quite a few and we're not planning to stop anytime soon!

You really like them and plan on submitting (PR'ing) your work? Then consider joining our private Slack channel sending us an email. This way you get the unique opportunity to learn from other passionate Pythonistas and share your experience.

Get Credit

As always you can PR your work to our Community branch of our Challenges repo. We will include it in our review post. Our PR template also lets you reflect a bit on your learning and provide some feedback how we can keep this interesting for you. See detailed instructions here.

We are working on a Code Challenge Platform to facilitate this process, stay tuned ...

About PyBites Code Challenges

Our goal is to learn and teach you Python through practical exercises. We are almost a year in now and the progress we've seen in our Python learning, as well as that of our growing community, is absolutely amazing! Besides, learning a programming language is way more fun as a community!

For any feedback tweet us or drop us an email. If you have a cool idea for a challenge please open an issues against our Challenges repo and we can discuss it there.

Thanks for your support.

Keep Calm and Code in Python!

-- PyBites

PyBites Python Tips

Do you want to get 250+ concise and applicable Python tips in an ebook that will cost you less than 10 bucks (future updates included), check it out here.

Get our Python Tips Book

"The discussions are succinct yet thorough enough to give you a solid grasp of the particular problem. I just wish I would have had this book when I started learning Python." - Daniel H

"Bob and Julian are the masters at aggregating these small snippets of code that can really make certain aspects of coding easier." - Jesse B

"This is now my favourite first Python go-to reference." - Anthony L

"Do you ever go on one of those cooking websites for a recipe and have to scroll for what feels like an eternity to get to the ingredients and the 4 steps the recipe actually takes? This is the opposite of that." - Sergio S

Get the book