-
Notifications
You must be signed in to change notification settings - Fork 417
56 lines (53 loc) · 1.82 KB
/
promotion-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
name: promotion service ci
on:
push:
branches: ["main"]
paths:
- "promotion/**"
- ".github/workflows/actions/action.yaml"
- ".github/workflows/promotion-ci.yaml"
pull_request:
branches: ["main"]
paths:
- "promotion/**"
- ".github/workflows/actions/action.yaml"
- ".github/workflows/promotion-ci.yaml"
workflow_dispatch:
jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: ./.github/workflows/actions
- name: Run Maven Build Command
run: mvn clean install -DskipTests -f promotion
- name: Run Maven Test
run: mvn test -f promotion
- name: Unit Test Results
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Promotion-Service-Unit-Test-Results
path: "promotion/**/surefire-reports/*.xml"
reporter: java-junit
- name: Analyze with sonar cloud
if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f promotion
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v2
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@v3
with:
context: ./promotion
push: true
tags: ghcr.io/nashtech-garage/yas-promotion:latest