-
Notifications
You must be signed in to change notification settings - Fork 414
90 lines (88 loc) · 3.21 KB
/
order-ci.yaml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: order service ci
on:
push:
branches: ["main"]
paths:
- "order/**"
- ".github/workflows/actions/action.yaml"
- ".github/workflows/order-ci.yaml"
- "pom.xml"
pull_request:
branches: ["main"]
paths:
- "order/**"
- ".github/workflows/actions/action.yaml"
- ".github/workflows/order-ci.yaml"
- "pom.xml"
workflow_dispatch:
jobs:
Build:
runs-on: ubuntu-latest
env:
FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: ./.github/workflows/actions
- name: Run Maven Checkstyle
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }}
run: mvn checkstyle:checkstyle -pl order -am -Dcheckstyle.output.file=order-checkstyle-result.xml
- name: Upload Checkstyle Result
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }}
uses: jwgmeligmeyling/checkstyle-github-action@master
with:
path: '**/order-checkstyle-result.xml'
- name: Run Maven Verify
run: mvn clean verify -f order
- name: Test Results
uses: dorny/test-reporter@v1
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }}
with:
name: Order-Service-Unit-Test-Results
path: "order/**/*-reports/TEST*.xml"
reporter: java-junit
- name: Analyze with sonar cloud
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f order
- name: OWASP Dependency Check
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }}
uses: dependency-check/Dependency-Check_Action@main
env:
JAVA_HOME: /opt/jdk
with:
project: 'yas'
path: '.'
format: 'HTML'
- name: Upload OWASP Dependency Check results
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }}
uses: actions/upload-artifact@master
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }}
with:
paths: ${{github.workspace}}/order/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Order Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v6
with:
context: ./order
push: true
tags: ghcr.io/nashtech-garage/yas-order:latest