-
Notifications
You must be signed in to change notification settings - Fork 155
100 lines (100 loc) · 4.08 KB
/
gradle.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: "gradle-actions"
on:
push:
branches:
- master
- feature/*
- fix/*
pull_request:
branches:
- master
jobs:
build:
permissions:
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify Conventional Commits
uses: amannn/action-semantic-pull-request@v5
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up NodeJS
if: github.ref == 'refs/heads/master'
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Set up Semantic Release
if: github.ref == 'refs/heads/master'
run: npm -g install @semantic-release/git [email protected]
- name: Semantic Release
if: github.ref == 'refs/heads/master'
run: npx [email protected]
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_P_A_TOKEN }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Validate code formatting
run: ./gradlew verGJF
- name: Execute build test and report
run: ./gradlew jacocoTestReport --refresh-dependencies --no-daemon --continue
- name: copy the reportTest to codeCoverage
run: cp build/reports/jacoco/report.xml jacoco.xml || echo "Code coverage failed"
- name: Push codeCoverage to Codecov
run: bash <(curl -s https://codecov.io/bash)
- name: Run sonar
if: github.event.pull_request.head.repo.fork == false
run: ./gradlew sonar --stacktrace
-Dsonar.token=${{ secrets.SONAR_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Next steps will only run if generation code templates have been changed
- name: Detect changes in generated code
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
templates:
- 'src/main/resources/**'
- 'src/main/java/co/com/bancolombia/Constants.java'
- 'src/main/java/co/com/bancolombia/factory/**'
# Generated code Analysis
- name: Publish local
if: steps.changes.outputs.templates == 'true'
run: ./sh_publish_plugin_local.sh
# Generated code reactive
- name: Generate reactive project to scan
if: steps.changes.outputs.templates == 'true'
run: ./sh_generate_project.sh reactive
- name: Scan generated reactive project dependencies
if: steps.changes.outputs.templates == 'true'
working-directory: ./build/toscan
run: ./gradlew build dependencyCheckAnalyze && ./gradlew it && cat applications/app-service/build/reports/dependency-check-sonar.json
- name: Sonar analysis for generated reactive project
if: github.event.pull_request.head.repo.fork == false && steps.changes.outputs.templates == 'true'
working-directory: ./build/toscan
run: ./gradlew sonar --stacktrace
-Dsonar.token=${{ secrets.SONAR_TOKEN_GENERATED }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Generated code imperative
- name: Generate imperative project to scan
if: steps.changes.outputs.templates == 'true'
run: ./sh_generate_project.sh imperative
- name: Scan generated imperative project dependencies
if: steps.changes.outputs.templates == 'true'
working-directory: ./build/toscan
run: ./gradlew build dependencyCheckAnalyze && ./gradlew it && cat applications/app-service/build/reports/dependency-check-sonar.json
- name: Sonar analysis for generated imperative project
if: github.event.pull_request.head.repo.fork == false && steps.changes.outputs.templates == 'true'
working-directory: ./build/toscan
run: ./gradlew sonar --stacktrace
-Dsonar.token=${{ secrets.SONAR_TOKEN_GENERATED_I }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}