Added test cases #87
Workflow file for this run
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: CI with SonarCloud | |
on: | |
push: | |
branches: | |
- main | |
- 'feature/**' | |
pull_request: | |
branches: | |
- main | |
- 'feature/**' | |
jobs: | |
sonarcloud: | |
name: SonarCloud Analysis | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the code from the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Set up JDK 11 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' # or 'zulu', 'adopt', 'oracle' as per your preference | |
# Cache Maven dependencies to speed up the build process | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
# Build the project and run tests (uses Maven) | |
- name: Build and Test with Maven | |
run: mvn clean verify | |
# Run SonarCloud analysis | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@v2 | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # The token you set as a GitHub secret | |
# Upload test results to GitHub if needed | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: target/surefire-reports |