-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (60 loc) · 2.19 KB
/
ci-jacoco.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: 'ContinuousIntegration'
on:
push:
branches:
- main
- development
pull_request:
branches:
- main
- development
jobs:
ContinuousIntegration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup Gradle
uses: gradle/gradle-build-action@v3
with:
arguments: build
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' }}
- name: Jacoco Report to PR
id: jacoco
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{ github.workspace }}/build/jacocoReport/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 80
min-coverage-changed-files: 80
debug-mode: false
title: Code Coverage
update-comment: true
- name: Upload jacoco HTML report
uses: actions/upload-artifact@v4
with:
name: jacoco-html-report
path: ${{ github.workspace }}/build/jacocoReport/test/html
- name: Get the Coverage info
run: |
echo "Total coverage ${{ steps.jacoco.outputs.coverage-overall }}"
echo "Changed Files coverage ${{ steps.jacoco.outputs.coverage-changed-files }}"
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build Docker Image
run: |
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/readup-server:${{ github.sha }} .
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/readup-server:${{ github.sha }} ${{ secrets.DOCKERHUB_USERNAME }}/readup-server:latest
- name: Push Docker Image
run: |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/readup-server:${{ github.sha }}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/readup-server:latest