CircleCI for Continuous Integration - Jacob1225/pufferfish-minecraft-mod GitHub Wiki
What is Continuous Integration (CI) and why is it important for this project?
When pushing a code change, you want to know if the state of the code is still okay by running automated builds and tests. When a developer updates code to the master branch, having a continuous integration service to automatically check the integrity of the merged changes will reduce the number of errors that result for the update. In this project, we choose to use a CI service because we are working with a team of 10 which will mean that different areas of code will be worked on by different people. CI will aid the workflow among this team and ensure that we can identify bugs quickly and efficiently.
Choices of open source CI tools:
-
Bamboo: Good for running multiple builds in parallel (decreases compilation time). Can integrate bamboo with repositories and can be paired with maven.
-
Buildbot: Written in python and can execute jobs across multiple platforms in parallel. Main purpose is to automate the build, test and release process.
-
Apache Gump: Specifically made for java projects that need to be built and tested.
-
Travis CI: Specifically made to build and test software that is hosted in github.
-
Jenkins: Open source automation server written in Java. Made to build and test software and provides continuous delivery.
Jenkins in-depth (initial consideration):
Has plugin architecture. Provides hundreds of plugins that can be installed to enhance functionality.
Jenkins Architecture:
- Developer pushes code to source code repository
- Jenkins CI server pulls code from the source repository to run tests against it using a maven build server.
- Build Server builds the code into an executable file (JAR file). If the build fails then developers will be notified.
- Can use maven or selenium plugins to write test scripts for source code.
- If all tests pass, the new build will be deployed to the production server.
- Jenkins master pulls code from remote source repository, then different jenkins slaves are used to test and run different builds of the app in parallel.
- Disadvantages: After trying to setup the environment, the setup with the local server is not straightforward. The UI needs some graphical improvements. Integration all works with plugins that need to be additionally installed on the instance. Move towards exploring other options.
Alternative tools:
- Github actions: Used YAML files for deployment and automated testing/building (Not hard to learn and provides CI functionality. Downside would be that it provides less of an opportunity to the team to learn other interesting CI tools that are widely used in the job market)
- Bamboo: Could be interesting to use since it is made for the Atlassian suite (JIRA). Our team decided to use JIRA for ticket tracking and sprint planning, thus would fit well with our choice.
- CircleCI: Provides all CI functionality and is highly used in the workforce. Could also provide an interesting learning opportunity for the team.
- Travis CI: Described briefly above and is open source.
- Buddy: Use buddy at work and it provides really advanced features. Learning curve is higher than other tools but not impossible to integrate. Not free.
CircleCI in depth (our top consideration):
It is free and is commonly used in the workforce, so it would be beneficial to our professional development to learn through this project.
CircleCI Architecture:
- Very easy to set up and use out-of-the-box
- Link up GitHub with CircleCI so that it has access to continuously check for changes on the repository
- Tester writes a YML config file that will tell CircleCI how to run the build and test code
- Developer pushes code to the GitHub repository and CircleCI keeps track of any updates on the repository
- CircleCI will run the tests when changes are made and display whether the code passed the build and test (can view the results from either the CircleCI app or GitHub repository)
View from GitHub:
View from CircleCI:
If an error occurs during the checks, the results can be easily seen on GitHub and will notify you to make changes before merging a pull request.
Checks not passed:
Updates made and CircleCI will automatically detect and initiate another check:
Checks passed, okay to merge:
- CircleCI can also tell you which part of the code failed
- Can specify different workflows for different branches
- Can set up the process to CD to a staging server
- Can ask CircleCI to run your Dockerized projects instead of needing to use native images
- Set-up tutorial