Skip to content

Commit

Permalink
adding templates
Browse files Browse the repository at this point in the history
  • Loading branch information
vsc1cob committed Jan 20, 2025
1 parent 0c52252 commit fa3fcf9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@ jobs:
# Call the build and artifact workflow
build-and-artifact:
uses: ./.github/workflows/build-and-artifact.yml # Reference to the build workflow
needs: java-maven-setup # Ensure Java and Maven setup is completed first

# Call the Spring Boot run and stop workflow
springboot-run-stop:
uses: ./.github/workflows/springboot-run-stop.yml # Reference to the Spring Boot workflow
needs: build-and-artifact # Ensure the build is completed before running Spring Boot

# Call the SonarCloud analysis workflow
sonarcloud-analysis:
uses: ./.github/workflows/sonarcloud-analysis.yml # Reference to the SonarCloud analysis workflow
with:
sonar-token: ${{ secrets.SONAR_TOKEN }}
sonar-org: your-organization # Replace with your actual SonarCloud organization
sonar-host-url: https://sonarcloud.io
needs: build-and-artifact # Ensure the build job is completed before analysis
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_ORG: ${{ secrets.SONAR_ORG }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

17 changes: 12 additions & 5 deletions .github/workflows/sonarcloud-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
name: SonarCloud Analysis

on:
workflow_call: # This workflow can be called from other workflows
workflow_call:
secrets:
SONAR_TOKEN: # SonarCloud authentication token
required: true
SONAR_ORG: # SonarCloud organization
required: true
SONAR_HOST_URL: # SonarCloud host URL
required: true

jobs:
sonarcloud-analysis:
runs-on: self-hosted
runs-on: ubuntu-latest

steps:
# Checkout the repository
Expand All @@ -19,12 +26,12 @@ jobs:
java-version: '17'
distribution: 'temurin'

# SonarCloud Analysis (separate job)
# Perform SonarCloud Analysis
- name: SonarCloud Analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_ORG: your-organization # Replace with your actual SonarCloud organization
SONAR_HOST_URL: https://sonarcloud.io
SONAR_ORG: ${{ secrets.SONAR_ORG }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: |
mvn clean verify sonar:sonar \
-Dsonar.organization=${{ secrets.SONAR_ORG }} \
Expand Down

0 comments on commit fa3fcf9

Please sign in to comment.