Building Java-based microservices as part of a GitHub Action

I recently migrated all c14r builds from Azure DevOps to GitHub Actions.
The migration went smoothly. Here is a snippet:

build-dexter:
name: Static Code Analysis for Dexter Microservice
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/dexter/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.DEXTER_SONAR_TOKEN }}
run: cd dexter && mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar

Pretty standard. The action does build the code on push and on a pull request, providing code quality metrics based on sonar insights and triggering all unit and integration tests. The full workflow is available here.

--

--

--

DevOps – Linux — Kubernetes –Azure — Java — JS — Apache Camel

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to handle 100k rows decision table in Drools-Part2

Open Mic

Own Operating System For Getting Hardware information

How to start a bot in Mybotgarage futures trading platform

100 Days of DevOps — Day 76-How Linux Kernel is organized

Data Visualization using Matplotlib

Comparison of cloud computing services for your team

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aymen Furter

Aymen Furter

DevOps – Linux — Kubernetes –Azure — Java — JS — Apache Camel

More from Medium

Virtualization & Containerization

Differences between static and dynamic libraries

CS373 Spring 2022: Sage Sanford

Fermenting unrest