bcgov/jag-document-utils

View on GitHub
.github/workflows/code-climate-test-coverage.yaml

Summary

Maintainability
Test Coverage
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
    
jobs:
  spring-boot:
    
    name: Build, Run Test and upload test coverage to code climate
    runs-on: ubuntu-latest
    
    steps:
      
      # Checkout Project
      - name: Checkout File Submission Repository
        uses: actions/checkout@v2

      # Setup Java Environment
      - name: Set up JDK 17
        uses: actions/setup-java@v1
        with:
          java-version: 17
      
      # Cache maven dependencies
      - name: Cache Java Dependencies
        uses: actions/cache@v1
        with:
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
          restore-keys: |
            ${{ runner.os }}-maven-
            
      # Update Env Variables
      - name: Update Env Variables
        run: |
          echo "CC_TEST_REPORTER_ID=e103c74e2b53c51672067da3861f3e6aa412cec1a8819e60dd93bce66c18bed0" >> $GITHUB_ENV
          echo "JACOCO_SOURCE_PATH=${{github.workspace}}/src/document-utils-api/src/main/java" >> $GITHUB_ENV
      
      #P Push coverage to code climate
      - name: Test & publish code coverage
        uses: paambaati/codeclimate-action@v2.7.4
        with:
          # The report file must be there, otherwise Code Climate won't find it
          coverageCommand: mvn -B verify -P all --file src/pom.xml
          coverageLocations: ${{github.workspace}}/src/document-utils-api/target/site/jacoco/jacoco.xml:jacoco