Skip to content

Practice project with a basic CI pipeline using GitHub Actions, Gradle, Java (with Spring Boot, Junit & Jacoco), Trivy and Docker.

License

Notifications You must be signed in to change notification settings

kimgoetzke/practice-basic-ci

Repository files navigation

CI

Basic CI Project

This repository was created to practice building a basic CI pipeline with GitHub Actions, Gradle, Java and Docker.

How it works

Feature workflow

Branches created with a name starting with feature- trigger the GitHub Actions feature workflow (see basic-ci-feature-workflow.yml).

  1. Request a runner with Ubuntu
  2. Set up Java
  3. Validate Gradle wrapper
  4. Build application, run all tests and build scan
  5. Upload Gradle build reports and attach as artifact to action
  6. Upload Jacoco test coverage reports and attach as artifact to action
  7. Create Docker images and upload to DockerHub
  8. Run Trivy vulnerability scan and fail if critical vulnerabilities detected*
  9. Upload vulnerability scan results as artifact to action

A new Docker image feature-{name}_v{github.run_number} is created and feature-{name}_latest is overwritten.

Main/release workflow

Only branches with the feature- prefix are permitted to push to main. Changes to main trigger workflow basic-ci-workflow.yml.

  1. Request a runner with Ubuntu, set up Java, and validate Gradle wrapper
  2. Request a runner with Ubuntu
  3. Set up Java
  4. Validate Gradle wrapper
  5. Build application, run all tests and build scan
  6. Create Docker images and upload to DockerHub
  7. Create a release on GitHub
  8. Use content of latest_release_notes.txt as release notes body

A new Docker image main_v{github.run_number} is created and main_latest is overwritten. Release is named v{github.run_number}.

Branch protection

ci-diagram.svg

About

Practice project with a basic CI pipeline using GitHub Actions, Gradle, Java (with Spring Boot, Junit & Jacoco), Trivy and Docker.

Topics

Resources

License

Stars

Watchers

Forks