-
Notifications
You must be signed in to change notification settings - Fork 46
75 lines (60 loc) · 2.3 KB
/
pull-request.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
name: Build and Test
on:
pull_request:
types: [opened, synchronize]
jobs:
Run-test-cases:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Checkout code
uses: actions/checkout@v3
- name: Restore Maven cache
uses: actions/cache@v3
with:
path: ~/.m2
key: lern-jobs-dependency-cache-${{ hashFiles('pom.xml') }}
restore-keys: |
lern-jobs-dependency-cache-
- name: Install ImageMagick
run: |
sudo apt-get update || sudo apt-get update
sudo apt-get install -y imagemagick
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Build the code
run: mvn clean install -DskipTests
- name: Execute coverage report
run: mvn clean scoverage:report
- name: Save test results
if: always()
run: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/test-results/junit/ \;
- name: Cache Maven dependencies
uses: actions/cache@v3
with:
path: ~/.m2
key: lern-jobs-dependency-cache-${{ hashFiles('pom.xml') }}
- name: Store test results
uses: actions/upload-artifact@v3
with:
name: test-results
path: ~/test-results
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Run SonarQube analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
mvn verify -DskipTests=true sonar:sonar -Dlog4j.configuration=./logs sonar:sonar -Dsonar.projectKey=Sunbird-Lern_data-pipeline -Dsonar.organization=sunbird-lern -Dsonar.host.url=https://sonarcloud.io -Dsonar.java.binaries=$(find . -path '*/build/classes/java' | xargs | tr ' ' ',') -Dsonar.coverage.exclusions=**/notification-sdk/**,**/notification/domain/** -Dsonar.test.exclusions=**/notification-sdk/** -Dsonar.exclusions=**/**.java -Dsonar.scala.coverage.reportPaths=/home/circleci/lern/target/scoverage.xml