-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d513be
commit 6f7262b
Showing
2 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: Build and Deploy | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
branches: | ||
- master | ||
- release-* | ||
|
||
jobs: | ||
Docker-build: | ||
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@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Restore Maven cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2 | ||
key: userorg-dependency-cache-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
userorg-dependency-cache- | ||
- name: Build and Run test cases | ||
run: mvn clean install | ||
|
||
- name: Save the build artifact | ||
run: mvn -f controller/pom.xml play2:dist | ||
|
||
- name: Store build artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: userorg-service | ||
path: controller/target/userorg-service-1.0-SNAPSHOT-dist.zip | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download build artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: userorg-service | ||
path: ./controller/target/ | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ vars.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and Push Docker Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: | | ||
${{ vars.DOCKERHUB_USERNAME }}/userorg_service:${{ github.ref_name }} | ||
- 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 org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ | ||
-Dsonar.projectKey=Sunbird-Lern_userorg-service \ | ||
-Dsonar.organization=sunbird-lern \ | ||
-Dsonar.host.url=https://sonarcloud.io \ | ||
-Dsonar.coverage.exclusions=**/cassandra-utils/**,**/es-utils/**,**/models/**,**/model/**,**/bean/**,**/dto/**,**/bulkupload/**,**/error/**,**/exception/**,**/util/search/** \ | ||
-Dsonar.coverage.jacoco.xmlReportPaths=/home/runner/work/userorg-service/userorg-service/reports/target/jacoco/jacoco.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Build and Deploy | ||
on: | ||
pull-request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
Test-and-Build: | ||
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@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Restore Maven cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2 | ||
key: userorg-dependency-cache-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
userorg-dependency-cache- | ||
- name: Build and Run test cases | ||
run: mvn clean install | ||
|
||
- name: Store build artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: userorg-service | ||
path: controller/target/userorg-service-1.0-SNAPSHOT-dist.zip | ||
|
||
- 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 org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ | ||
-Dsonar.projectKey=Sunbird-Lern_userorg-service \ | ||
-Dsonar.organization=sunbird-lern \ | ||
-Dsonar.host.url=https://sonarcloud.io \ | ||
-Dsonar.coverage.exclusions=**/cassandra-utils/**,**/es-utils/**,**/models/**,**/model/**,**/bean/**,**/dto/**,**/bulkupload/**,**/error/**,**/exception/**,**/util/search/** \ | ||
-Dsonar.coverage.jacoco.xmlReportPaths=/home/runner/work/userorg-service/userorg-service/reports/target/jacoco/jacoco.xml |