mirror of
				https://github.com/continew-org/continew-starter.git
				synced 2025-10-31 22:57:19 +08:00 
			
		
		
		
	ci: 更新 GitHub Action 脚本
This commit is contained in:
		
							
								
								
									
										28
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| name: Build | ||||
|  | ||||
| on: | ||||
|   pull_request: | ||||
|     branches: | ||||
|       - dev | ||||
|  | ||||
| jobs: | ||||
|   build: | ||||
|     runs-on: ubuntu-latest | ||||
|     strategy: | ||||
|       matrix: | ||||
|         jdk-version: | ||||
|           - 17 | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|       - name: Setup Java | ||||
|         uses: actions/setup-java@v4 | ||||
|         with: | ||||
|           distribution: "adopt" | ||||
|           java-version: ${{ matrix.jdk-version }} | ||||
|           cache: "maven" | ||||
|       - name: Compile | ||||
|         run: | | ||||
|           sed -i.bak '/<repositories>/,/<\/repositories>/d' pom.xml | ||||
|           sed -i.bak '/<pluginRepositories>/,/<\/pluginRepositories>/d' pom.xml | ||||
|           mvn -B compile --file pom.xml | ||||
| @@ -1,26 +1,31 @@ | ||||
| name: Analysis Code Quality | ||||
| name: Scan | ||||
| 
 | ||||
| on: | ||||
|   # 推送时执行 | ||||
|   push: | ||||
|     branches: [dev] | ||||
|   # 可手动执行 | ||||
|   workflow_dispatch: | ||||
|     branches: | ||||
|       - dev | ||||
|   pull_request: | ||||
|     branches: | ||||
|       - dev | ||||
| 
 | ||||
| jobs: | ||||
|   # Sonar 扫描 | ||||
|   sonar-scan: | ||||
|     runs-on: ubuntu-latest | ||||
|     strategy: | ||||
|       matrix: | ||||
|         jdk-version: | ||||
|           - 17 | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@master | ||||
|         uses: actions/checkout@v4 | ||||
|         with: | ||||
|           fetch-depth: 0 | ||||
|       - name: Setup Java | ||||
|         uses: actions/setup-java@master | ||||
|         uses: actions/setup-java@v4 | ||||
|         with: | ||||
|           distribution: 'adopt' | ||||
|           java-version: 17 | ||||
|           distribution: "adopt" | ||||
|           java-version: ${{ matrix.jdk-version }} | ||||
|           cache: "maven" | ||||
|       - name: Cache SonarCloud packages | ||||
|         uses: actions/cache@v3 | ||||
|         with: | ||||
| @@ -34,7 +39,10 @@ jobs: | ||||
|           key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||||
|           restore-keys: ${{ runner.os }}-m2 | ||||
|       - name: Analyze | ||||
|         run: mvn -B verify -Psonar | ||||
|         run: | | ||||
|           sed -i.bak '/<repositories>/,/<\/repositories>/d' pom.xml | ||||
|           sed -i.bak '/<pluginRepositories>/,/<\/pluginRepositories>/d' pom.xml | ||||
|           mvn -B verify -Psonar | ||||
|         env: | ||||
|           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||||
|           SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||||
		Reference in New Issue
	
	Block a user