Exercise 12
info
This is an in-class exercise. An exercise page like this one will contain a brief description but is intended to be supplemented by discussion during our meeting time. Complete the exercise to the best of your ability in the time given. Feel free to talk with other students as you work, and do not be afraid to ask questions. Aim to complete as much as possible during our meeting and continue to work at home to finish, but you need not hand it in.
#
Learning ObjectivesObjectives
This exercise should help you practice with:
- Continuous integration/delivery
- Github Actions and Docker technologies
- CI automated unit tests and branch coverage
#
Answer the following questions- What is the difference between CI & CD?
- What is a CI/CD pipeline?
- In a CI/CD pipeline: what is a workflow? What is a job?
- What problem does the Docker technology solve?
#
TaskGo over the "Continuous Integration" section of the Readings tab on the course website and make sure you finish all subsections and parts to replicate the fully functioning CI/CD pipline on the simple program containing
Main
,ArrayUtils
, andArrayUtilsTest
classes using Github Actions ad Docker; once you finish all parts, you should have your ownci-helloworld
Github repo and when a push/pull request update is made to themaster
branch, an updated docker container image must get published to docker hub (under your own docker account.)Add the following method to your
ArrayUtils
class under thesrc
, but do not add any tests for it to yourArrayUtilsTest
test class.
This should bring the overall BC coverage on ArrayUtils
class under the current set threshold in the pipleline (i.e., gradle.yml
). Now, commit and push the changes to the master
branch and imediately go to Actions
tab of your repo on Github to observe how the pipleline workflow fails once it reaches the Jacoco
job. What is the mentioned failure reason for the failed pipeline?
- Add tests to
ArrayUtilsTest
to acheive 100% BC onArrayUtils
(and the newcountOf
function in particular), leaving in the existing tests! Commit, push, and confirm that all the steps in the pipleline run successfully and a new image is published to docker hub.
Find the specs of
jacoco-badge-generator
Action on Github Actions "Marketplace". Modify your pipleline (i.e.,gradle.yml
) such that the workflow would fail "if branche coverage is less than it was on the previous run."Verify that the docker image of the containerized
ci-helloworld
app is deployed successfully on docker hub!
tip
On Docker Hub, you can make your containerized application public/private to share/hide it with/from the outside world by going to the "Settings" tab of the DockerHub repository and make adjustments under "Visibility settings".