-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from ADORSYS-GIS/52-create-the-cicd-pipeline-f…
…or-online-banking-servicee5 Create CI/CD for OBS
- Loading branch information
Showing
1 changed file
with
114 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,114 @@ | ||
name: Java CI/CD Pipeline with Maven | ||
|
||
on: | ||
push: | ||
branches: [ "main", "staging" ] | ||
pull_request: | ||
branches: [ "main", "staging" ] | ||
|
||
jobs: | ||
# 1. Build Stage | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: maven | ||
|
||
- name: Build with Maven | ||
run: mvn clean install | ||
|
||
# 2. Test Stage | ||
test: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Run Unit Tests | ||
run: mvn test | ||
|
||
- name: Run Integration Tests | ||
run: mvn verify | ||
|
||
# 3. Code Quality Check with SonarQube | ||
# quality-check: | ||
# runs-on: ubuntu-latest | ||
# needs: build | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# | ||
# - name: Set up JDK 17 | ||
# uses: actions/setup-java@v4 | ||
# with: | ||
# java-version: '17' | ||
# distribution: 'temurin' | ||
# | ||
# - name: SonarQube Scan | ||
# env: | ||
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
# run: mvn sonar:sonar -Dsonar.login=${{ secrets.SONAR_TOKEN }} | ||
|
||
# 4. Deployment Stage | ||
# deploy: | ||
# runs-on: ubuntu-latest | ||
# needs: test | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# | ||
# - name: Set up JDK 17 | ||
# uses: actions/setup-java@v4 | ||
# with: | ||
# java-version: '17' | ||
# distribution: 'temurin' | ||
# | ||
# - name: Login to Docker Hub | ||
# uses: docker/login-action@v2 | ||
# with: | ||
# username: ${{ secrets.DOCKER_USERNAME }} | ||
# password: ${{ secrets.DOCKER_PASSWORD }} | ||
# | ||
# - name: Build Docker Image | ||
# run: docker build -t ${{ secrets.DOCKER_USERNAME }}/online-banking-service:${{ github.sha }} . | ||
# | ||
# - name: Push Docker Image | ||
# run: docker push ${{ secrets.DOCKER_USERNAME }}/online-banking-service:${{ github.sha }} | ||
# | ||
# - name: Deploy to Staging | ||
# if: github.ref == 'refs/heads/staging' | ||
# run: | | ||
# echo "Deploying to staging environment" | ||
# # Add deployment script or command here | ||
# | ||
# - name: Deploy to Production | ||
# if: github.ref == 'refs/heads/main' | ||
# run: | | ||
# echo "Deploying to production environment" | ||
# # Add deployment script or command here | ||
|
||
# 5. Notifications | ||
# notifications: | ||
# runs-on: ubuntu-latest | ||
# needs: [build, quality-check, test, deploy] | ||
# steps: | ||
# - name: Notify on Success or Failure | ||
# if: always() | ||
# run: | | ||
# if [ "${{ job.status }}" == "success" ]; then | ||
# echo "Build and deployment successful." | ||
# else | ||
# echo "Build or deployment failed." | ||
# fi |