Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Code Quality

on:
push:
branches: [ "main", "develop" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read
pull-requests: write

jobs:
test-and-coverage:
name: Unit Tests & Code Coverage
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for better analysis

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven

- name: Run tests with coverage
run: mvn -B clean test jacoco:report

- name: Generate coverage report
run: mvn jacoco:report

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Archive coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: target/site/jacoco/
retention-days: 30

- name: Comment coverage on PR
if: github.event_name == 'pull_request'
uses: madrapps/[email protected]
with:
paths: ${{ github.workspace }}/target/site/jacoco/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 50
min-coverage-changed-files: 60
title: '📊 Code Coverage Report'
update-comment: true

code-analysis:
name: Static Code Analysis
runs-on: ubuntu-latest
needs: test-and-coverage

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven

- name: Compile project
run: mvn -B compile test-compile

- name: Run Maven verify
run: mvn -B verify -DskipTests

build-quality:
name: Build Quality Check
runs-on: ubuntu-latest
needs: [test-and-coverage, code-analysis]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven

- name: Full build with all checks
run: mvn -B clean package

- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
target/*.jar
target/site/jacoco/
retention-days: 7
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Android Emulator Manager

[![Java CI with Maven](https://github.com/NmurtasDev/AndroidEmulatorManager/actions/workflows/maven.yml/badge.svg)](https://github.com/NmurtasDev/AndroidEmulatorManager/actions/workflows/maven.yml)
[![Code Quality](https://github.com/NmurtasDev/AndroidEmulatorManager/actions/workflows/code-quality.yml/badge.svg)](https://github.com/NmurtasDev/AndroidEmulatorManager/actions/workflows/code-quality.yml)
[![codecov](https://codecov.io/gh/NmurtasDev/AndroidEmulatorManager/branch/main/graph/badge.svg)](https://codecov.io/gh/NmurtasDev/AndroidEmulatorManager)
[![CodeQL](https://github.com/NmurtasDev/AndroidEmulatorManager/actions/workflows/codeql.yml/badge.svg)](https://github.com/NmurtasDev/AndroidEmulatorManager/actions/workflows/codeql.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Java Version](https://img.shields.io/badge/Java-21-blue.svg)](https://www.oracle.com/java/technologies/javase/jdk21-archive-downloads.html)
Expand Down Expand Up @@ -169,11 +171,14 @@ This version introduces major architectural improvements over previous versions:
- ✅ **Dark theme support** with automatic system theme detection
- ✅ **Rename AVD functionality** directly from UI

### CI/CD
### CI/CD & Quality
- ✅ **Automated releases** via GitHub Actions on tag push
- ✅ **Multi-platform builds** (JAR, Windows EXE)
- ✅ **Pre-release support** for beta/RC versions
- ✅ **CodeQL security scanning** on every commit
- ✅ **Automated code coverage** with JaCoCo and Codecov
- ✅ **Code quality checks** on every PR
- ✅ **Unit test execution** with detailed coverage reports (55 tests)

## Release Pipeline

Expand Down
43 changes: 43 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
codecov:
require_ci_to_pass: yes
notify:
wait_for_ci: yes

coverage:
precision: 2
round: down
range: "50...100"

status:
project:
default:
target: 50%
threshold: 5%
if_ci_failed: error

patch:
default:
target: 60%
threshold: 10%

changes:
default:
if_ci_failed: error

comment:
layout: "reach,diff,flags,tree,footer"
behavior: default
require_changes: false
require_base: no
require_head: yes

ignore:
- "src/test/**"
- "**/*Test.java"
- "**/test/**"

flags:
unittests:
paths:
- src/main/java/
carryforward: true
65 changes: 65 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<junit.version>5.10.1</junit.version>
<slf4j.version>2.0.9</slf4j.version>
<logback.version>1.5.19</logback.version>
<lombok.version>1.18.30</lombok.version>

<!-- Launch4j default properties -->
<bundled.jre.path></bundled.jre.path>
Expand All @@ -59,13 +60,35 @@
<version>${logback.version}</version>
</dependency>

<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>

<!-- Testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.8.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.8.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -90,6 +113,48 @@
<version>3.2.2</version>
</plugin>

<!-- JaCoCo Plugin for Code Coverage -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>jacoco-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>PACKAGE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.50</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>

<!-- Fat JAR con dipendenze -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Loading
Loading