[OSD600] CI/CD for Java Maven using Github Actions

GitHub Action Workflows

I set up GitHub Action for my Static Site Generator (SSG). Actions themselves are individual jobs that can be combined together in a workflow to create a complex pipeline that handles our needs in the development life cycle. These workflow files can then be configured in YAML and triggered to run on specific events such as each time someone pushes code to the main branch.

  • actions/setup-java@v2 : set up a Java environment that the job can run in. I also use the with keyword to tell setup-java to use a specific version of the JDK, which in this case is JDK-11.
  • mvn package -DskipTest : install all dependencies and skiptests
  • mvn com.coveo:fmt-maven-plugin-format:fmt : Run Formatter ( I need to configure the plugin in pom.xml to run this
  • mvn test Run all the tests
name: Maven CI/CD

branches: [ main ]
branches: [ main ]


runs-on: ubuntu-latest

- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
java-version: '11'
distribution: 'adopt'
- name: Install dependencies
run: mvn package -DskipTests
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
- name: Run Formatter
run: mvn com.coveo:fmt-maven-plugin:format
- name: Test
run: mvn test

Add Test to partner Repo

I pick Minsu Kim‘s repo to write some more unit tests on his/ her project. Though the project is written in C#, I still want to give it a try because I’m curious if C#’s testing methods are similar to java.

  • shouldReturnOptions()
  • shouldReturnAVersion()
  • shouldThrowExceptionWhenTitleIsEmpty()

Computer Programming Student @Seneca. Writing to share solutions and encourage my sister to write.