DEV Community

irenejoeunpark
irenejoeunpark

Posted on

2

Github CI Integration

As a coursework of OSD600, we were integrating CI on our projects. Since my project was being created with Java, and added Maven for dependency and artifacts, I added maven run in my GitHub action CI.

I have experienced those automated tests and checks through GitHub actions when I was contributing on huge projects before. It is a very cool feature that could allow multiple contributors to check if they broke any core functionality when contributing.

I had to modify the yml file multiple times because it was not functioning properly at first. I had to add some plugin and scope in pom.xml for maven automated tests.

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
Enter fullscreen mode Exit fullscreen mode

And after adding surefire, below commands was finally picking up Junit classes for testing

      - name: Build maven package
        run: mvn package -DskipTests
      - name: Test
        run: mvn test
Enter fullscreen mode Exit fullscreen mode

I wanted to add formatter and linter inside the CI, but since the formatter and linter I have used in my project had no functionality to check and format the code with "mvn" command, I had to postpone it to later development.

For the future improvement, I would like to add a script to run formatter and linter that could automatically reformat and check all of the file, and add the script into the CI. This would require more research and knowledge on CI.

A successful action that ran for the pull request could be found here. I created a unit test to test if the html header & footer writer method is working properly.

Second part of the lab was to partner up with another student and create a unit test for their project and see if the CI is working properly.

I contributed on Le Minh Pham's project which was written in Python.
Unit testing in python was a lot simpler than using Java.
I created two unit testings, which have test cases for horizontal rules and a combined markdown feature.
First I failed on horizontal rules testing, and had to discuss with Le Minh Pham, he was able to fix the part where it breaks the

tag inside the html body.

After his fixes and commits, my PR was able to pass the automated checks and was able to get merged.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay