mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-11-03 19:17:16 -05:00 
			
		
		
		
	Handling coverage in the CI
This commit is contained in:
		
							parent
							
								
									b5f31eba02
								
							
						
					
					
						commit
						23977eed1f
					
				
							
								
								
									
										23
									
								
								.github/workflows/analysis.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										23
									
								
								.github/workflows/analysis.yml
									
									
									
									
										vendored
									
									
								
							@ -2,7 +2,7 @@ name: Analysis
 | 
				
			|||||||
on: [push, pull_request]
 | 
					on: [push, pull_request]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
jobs:
 | 
					jobs:
 | 
				
			||||||
  build:
 | 
					  analysis:
 | 
				
			||||||
    name: Static Analysis
 | 
					    name: Static Analysis
 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
@ -28,16 +28,27 @@ jobs:
 | 
				
			|||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          mkdir -p ./.sonar/scanner
 | 
					          mkdir -p ./.sonar/scanner
 | 
				
			||||||
          dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner
 | 
					          dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner
 | 
				
			||||||
 | 
					      - name: Wait for tests to run
 | 
				
			||||||
 | 
					        uses: lewagon/wait-on-check-action@master
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          ref: ${{github.ref}}
 | 
				
			||||||
 | 
					          check-name: tests
 | 
				
			||||||
 | 
					          repo-token: ${{secrets.GITHUB_TOKEN}}
 | 
				
			||||||
 | 
					          running-workflow-name: analysis
 | 
				
			||||||
 | 
					          allowed-conclusions: success,skipped,cancelled,neutral,failed
 | 
				
			||||||
 | 
					      - name: Download coverage report
 | 
				
			||||||
 | 
					        uses: dawidd6/action-download-artifact@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          commit: ${{env.COMMIT_SHA}}
 | 
				
			||||||
 | 
					          workflow: tests.yml
 | 
				
			||||||
 | 
					          name: coverage.xml
 | 
				
			||||||
 | 
					          github_token: ${{secrets.GITHUB_TOKEN}}
 | 
				
			||||||
      - name: Build and analyze
 | 
					      - name: Build and analyze
 | 
				
			||||||
        env:
 | 
					        env:
 | 
				
			||||||
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
 | 
					          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
 | 
				
			||||||
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
 | 
					          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
 | 
				
			||||||
        shell: bash
 | 
					        shell: bash
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          dotnet test \
 | 
					 | 
				
			||||||
            '-p:CollectCoverage=true;CoverletOutputFormat=opencover' \
 | 
					 | 
				
			||||||
            '-p:SkipTranscoder=true;SkipWebApp=true' || echo "Test failed. Skipping..."
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          dotnet build-server shutdown
 | 
					          dotnet build-server shutdown
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          ./.sonar/scanner/dotnet-sonarscanner begin \
 | 
					          ./.sonar/scanner/dotnet-sonarscanner begin \
 | 
				
			||||||
@ -45,7 +56,7 @@ jobs:
 | 
				
			|||||||
            -o:"anonymus-raccoon" \
 | 
					            -o:"anonymus-raccoon" \
 | 
				
			||||||
            -d:sonar.login="${{ secrets.SONAR_TOKEN }}" \
 | 
					            -d:sonar.login="${{ secrets.SONAR_TOKEN }}" \
 | 
				
			||||||
            -d:sonar.host.url="https://sonarcloud.io" \
 | 
					            -d:sonar.host.url="https://sonarcloud.io" \
 | 
				
			||||||
            -d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" 
 | 
					            -d:sonar.cs.opencover.reportsPaths="./coverage.xml" 
 | 
				
			||||||
          
 | 
					          
 | 
				
			||||||
          dotnet build --no-incremental '-p:SkipTranscoder=true;SkipWebApp=true'
 | 
					          dotnet build --no-incremental '-p:SkipTranscoder=true;SkipWebApp=true'
 | 
				
			||||||
          
 | 
					          
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										13
									
								
								.github/workflows/tests.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								.github/workflows/tests.yml
									
									
									
									
										vendored
									
									
								
							@ -3,7 +3,7 @@ name: Testing
 | 
				
			|||||||
on: [push, pull_request]
 | 
					on: [push, pull_request]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
jobs:
 | 
					jobs:
 | 
				
			||||||
  build:
 | 
					  tests:
 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    container: mcr.microsoft.com/dotnet/sdk:5.0
 | 
					    container: mcr.microsoft.com/dotnet/sdk:5.0
 | 
				
			||||||
    services:
 | 
					    services:
 | 
				
			||||||
@ -18,17 +18,18 @@ jobs:
 | 
				
			|||||||
          --health-retries 5
 | 
					          --health-retries 5
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
    - uses: actions/checkout@v2
 | 
					    - uses: actions/checkout@v2
 | 
				
			||||||
    - name: Setup .NET
 | 
					 | 
				
			||||||
      uses: actions/setup-dotnet@v1
 | 
					 | 
				
			||||||
      with:
 | 
					 | 
				
			||||||
        dotnet-version: 5.0.x
 | 
					 | 
				
			||||||
    - name: Restore dependencies
 | 
					    - name: Restore dependencies
 | 
				
			||||||
      run: dotnet restore
 | 
					      run: dotnet restore
 | 
				
			||||||
    - name: Build
 | 
					    - name: Build
 | 
				
			||||||
      run: dotnet build --no-restore '-p:SkipWebApp=true;SkipTranscoder=true' 
 | 
					      run: dotnet build --no-restore '-p:SkipWebApp=true;SkipTranscoder=true' 
 | 
				
			||||||
    - name: Test
 | 
					    - name: Test
 | 
				
			||||||
      run: dotnet test --no-build
 | 
					      run: dotnet test --no-build '-p:CollectCoverage=true;CoverletOutputFormat=opencover'
 | 
				
			||||||
      env:
 | 
					      env:
 | 
				
			||||||
        POSTGRES_HOST: postgres
 | 
					        POSTGRES_HOST: postgres
 | 
				
			||||||
        POSTGRES_USERNAME: postgres
 | 
					        POSTGRES_USERNAME: postgres
 | 
				
			||||||
        POSTGRES_PASSWORD: postgres
 | 
					        POSTGRES_PASSWORD: postgres
 | 
				
			||||||
 | 
					    - name: Upload coverage report
 | 
				
			||||||
 | 
					      uses: actions/upload-artifact@v2
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        name: coverage.xml
 | 
				
			||||||
 | 
					        path: "**/coverage.opencover.xml"
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user