Skip to content

Commit 573e223

Browse files
authored
Merge pull request #9 from decode-development/ci-setup
Implement changes for SDLC - CI pipeline and PR template
2 parents 90ae31d + 58a6ccb commit 573e223

File tree

4 files changed

+190
-1
lines changed

4 files changed

+190
-1
lines changed

.codeclimate.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
version: "2"
2+
checks:
3+
argument-count:
4+
enabled: true
5+
config:
6+
threshold: 4
7+
complex-logic:
8+
enabled: true
9+
config:
10+
threshold: 4
11+
file-lines:
12+
enabled: true
13+
config:
14+
threshold: 250
15+
method-complexity:
16+
enabled: true
17+
config:
18+
threshold: 5
19+
method-count:
20+
enabled: true
21+
config:
22+
threshold: 20
23+
method-lines:
24+
enabled: true
25+
config:
26+
threshold: 25
27+
nested-control-flow:
28+
enabled: true
29+
config:
30+
threshold: 4
31+
return-statements:
32+
enabled: true
33+
config:
34+
threshold: 4
35+
similar-code:
36+
enabled: true
37+
identical-code:
38+
enabled: true
39+
40+
exclude_patterns:
41+
- "test/"
42+
- "tests/"
43+
- "**/test/"
44+
- "**/tests/"
45+
- "**/*Test.java"
46+
- "build/"
47+
- "target/"
48+
- "docs/"
49+
- "*.md"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
## Description
2+
<!--A brief explanation of what was changed, why it was changed and how it was changed. -->
3+
4+
## Type of change
5+
<!-- Mark relevant items with 'x' -->
6+
- [ ] New Feature
7+
- [ ] Bug Fix
8+
- [ ] Refactor
9+
- [ ] Documentation Update
10+
- [ ] Style
11+
- [ ] Performance Improvements
12+
- [ ] Test Update
13+
- [ ] Build/CI Update
14+
15+
## Testing
16+
<!-- Describe how you tested these changes -->
17+
- [ ] Unit Tests Added/Updated
18+
- [ ] Integration Tests Added/Updated
19+
- [ ] Manual Testing Completed
20+
### Test Cases
21+
<!-- List key test scenarios -->
22+
1.
23+
2.
24+
25+
## Deployment Instructions (optional)
26+
<!-- Include instructions about any scripts that need to be run -->
27+
28+
## QA Instructions (optional)
29+
<!-- Include any information that will help a reviewer with testing -->
30+
31+
## Breaking Changes
32+
<!-- Mark with 'x' if applies -->
33+
- [ ] This PR introduces breaking changes
34+
<!-- If yes, describe the impact and migration path -->
35+
36+
## Dependencies
37+
<!-- List any new dependencies or changes to existing ones -->
38+
39+
## Related Tickets & Documents
40+
<!-- Include JIRA ticket references and their summary -->
41+
42+
## Screenshots/Recordings
43+
<!-- If applicable, add screenshots or recordings -->
44+
45+
## Checklist
46+
<!-- Mark completed items with 'x' -->
47+
- [ ] Code follows style guidelines
48+
- [ ] Self-review completed
49+
- [ ] Tests pass locally
50+
- [ ] Documentation updated
51+
- [ ] No new warnings generated
52+
53+
## Additional Notes
54+
<!-- Any other relevant information -->
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Continuous Integration Pipeline
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '**.md'
7+
- '**.txt'
8+
- '**.json'
9+
- '**.properties'
10+
- '**.xml'
11+
- '**.sql'
12+
- '**.csv'
13+
- '**.zip'
14+
- 'docs/**'
15+
- '.gitignore'
16+
17+
defaults:
18+
run:
19+
shell: bash
20+
21+
env:
22+
JAVA_VERSION: '17'
23+
24+
jobs:
25+
test:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v3
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Set up JDK
33+
uses: actions/setup-java@v3
34+
with:
35+
java-version: ${{ env.JAVA_VERSION }}
36+
distribution: 'temurin'
37+
cache: maven
38+
39+
- name: Run Tests
40+
run: mvn test
41+
42+
- name: Upload JaCoCo reports
43+
if: always()
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: jacoco-reports
47+
path: target/site/jacoco/
48+
49+
- name: Setup Code Climate
50+
run: |
51+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
52+
chmod +x ./cc-test-reporter
53+
./cc-test-reporter before-build
54+
55+
- name: Run Code Climate Analysis
56+
env:
57+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
58+
run: |
59+
JACOCO_SOURCE_PATH=src/main/java ./cc-test-reporter format-coverage target/site/jacoco/jacoco.xml --input-type jacoco
60+
./cc-test-reporter upload-coverage

pom.xml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
<properties>
1919
<java.version>17</java.version>
20+
<sonar.coverage.exclusions>
21+
**/model/**,**/dto/**
22+
</sonar.coverage.exclusions>
23+
<jacoco.minimum.coverage>0.80</jacoco.minimum.coverage>
2024
</properties>
2125

2226
<dependencies>
@@ -156,7 +160,29 @@
156160
<executable>true</executable>
157161
</configuration>
158162
</plugin>
163+
<plugin>
164+
<groupId>org.jacoco</groupId>
165+
<artifactId>jacoco-maven-plugin</artifactId>
166+
<version>0.8.8</version>
167+
<executions>
168+
<execution>
169+
<goals>
170+
<goal>prepare-agent</goal>
171+
</goals>
172+
</execution>
173+
<execution>
174+
<id>report</id>
175+
<phase>test</phase>
176+
<goals>
177+
<goal>report</goal>
178+
</goals>
179+
<configuration>
180+
<outputDirectory>${project.build.directory}/site/jacoco</outputDirectory>
181+
</configuration>
182+
</execution>
183+
</executions>
184+
</plugin>
159185
</plugins>
160186
</build>
161187

162-
</project>
188+
</project>

0 commit comments

Comments
 (0)