Merge pull request #73 from CJP2004/dev #28
This file contains hidden or 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: Backend Build And Review | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| build-and-review: | |
| name: Build Jar And Sonar Review | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 拉取代码 | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: 安装 JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: '21' | |
| cache: maven | |
| cache-dependency-path: | | |
| pom.xml | |
| auth-service/pom.xml | |
| - name: 显示 Java 和 Maven 版本 | |
| run: | | |
| java -version | |
| mvn -version | |
| - name: 编译、测试、打包并生成覆盖率报告 | |
| run: mvn -B -ntp clean verify | |
| - name: 上传 auth-service jar | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: auth-service-jar | |
| path: auth-service/target/*.jar | |
| if-no-files-found: error | |
| - name: SonarCloud 代码扫描 | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| run: > | |
| mvn -B -ntp | |
| org.sonarsource.scanner.maven:sonar-maven-plugin:5.6.0.6792:sonar | |
| -Dsonar.organization=cjp2004 | |
| -Dsonar.projectKey=CJP2004_service-governance-backend |