49 implement a bean definition scanner #76
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
name: Build, Test, and Analyze | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
build-and-analyze: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Step 2: Set up Java environment | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 21 | |
# Step 3: Cache Gradle dependencies | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: gradle-cache-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
gradle-cache-${{ runner.os }} | |
# Step 4: Build the project and run static code analysis with Checkstyle | |
- name: Run Checkstyle | |
run: ./gradlew checkstyleMain checkstyleTest | |
# Step 5: Run OWASP Dependency Check | |
- name: Run Dependency Check | |
timeout-minutes: 10 | |
continue-on-error: true | |
env: | |
NVD_API_KEY: ${{ secrets.NVD_API_KEY }} | |
run: ./gradlew dependencyCheckAnalyze | |
# Step 6: Run tests and generate JaCoCo coverage report | |
- name: Run tests with JaCoCo | |
run: ./gradlew test jacocoTestReport | |
env: | |
CI: true | |
# Step 7: Run SonarCloud Analysis | |
- name: SonarCloud Scan | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./gradlew sonar -Dsonar.token=$SONAR_TOKEN |