Skip to content

Commit

Permalink
Setup CI (unit tests) (#1)
Browse files Browse the repository at this point in the history
* Setup CI (unit tests)

* Add build status badge to README.md file.

* Add code coverage
  • Loading branch information
dksifoua authored Jan 18, 2024
1 parent 2a41e99 commit 295ac39
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/makefile-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Makefile CI
on:
push:
branches:
- master
- develop
- feature/**
- ci/**
pull_request:
branches:
- master
- develop
- feature/**
- ci/**
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup JDK
uses: actions/setup-java@v3
with:
java-version: "20.0.1"
distribution: "temurin"
server-id: github
settings-path: ${{ github.workspace }}
- name: Unit Tests
run: ./gradlew test
- name: Code Coverage
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: false
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Leetcode - Java
[![Makefile CI](https://github.com/dksifoua/leetcode/actions/workflows/makefile-ci.yaml/badge.svg)](https://github.com/dksifoua/leetcode/actions/workflows/makefile-ci.yaml)

## Types of data structures

Expand Down
26 changes: 26 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'java'
id 'jacoco'
}

group = 'io.dksifoua'
Expand All @@ -16,4 +17,29 @@ dependencies {

test {
useJUnitPlatform()
finalizedBy jacocoTestReport
}

jacoco {
toolVersion = "0.8.9"
reportsDirectory = layout.buildDirectory.dir("reports/jacoco")
}

jacocoTestReport {
dependsOn test

reports {
xml.required = true
html.required = true
}
}

jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.5
}
}
}
}

0 comments on commit 295ac39

Please sign in to comment.