File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 1616      uses : actions/checkout@v3.3.0 
1717    - name : Unit Tests 
1818      run : go test -v -race ./... 
19+     - name : Quality Gate - Test coverage shall be above threshold 
20+       env :
21+         TESTCOVERAGE_THRESHOLD : 75 
22+       run : | 
23+         echo "Quality Gate: checking test coverage is above threshold ..." 
24+         echo "Threshold             : $TESTCOVERAGE_THRESHOLD %" 
25+         totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'` 
26+         echo "Current test coverage : $totalCoverage %" 
27+         if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then 
28+             echo "OK" 
29+         else 
30+             echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value." 
31+             echo "Failed" 
32+             exit 1 
33+         fi 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments