Skip to content

Added logic to skip autoCalc for saveFormAnswers triggered by form clone #1441

Added logic to skip autoCalc for saveFormAnswers triggered by form clone

Added logic to skip autoCalc for saveFormAnswers triggered by form clone #1441

name: Generate/Upload Quarkus Coverage Report To Code Climate
on:
push:
branches: [main]
pull_request:
types: [opened, reopened, synchronize]
branches: [main]
workflow_dispatch:
jobs:
quarkus:
env:
CC_TEST_REPORTER_ID: 889fcd8abd72cd5fd355c136d4b143130731fb7052aa9442f57a30ce0d482701
name: Create, format and upload Java coverage artifact
runs-on: ubuntu-latest
steps:
# Checkout Project
- name: Checkout CCCM Repository
uses: actions/checkout@v2
# Get Code Climate binary
- name: Download Code Climate Binary
run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
# Permissions applied to the Code Climate Executable
- name: Apply executable perms to Code Climate Binary
run: chmod +x ./cc-test-reporter
# Before build
- name: Before build
run: ./cc-test-reporter before-build
# Set required Git env vars for either pull request
- name: Set ENV for codeclimate (pull_request)
run: |
echo "GIT_BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
if: github.event_name == 'pull_request'
# Set required Git env vars for a push to main
- name: Set ENV for codeclimate (push)
run: |
echo "GIT_BRANCH=$GITHUB_REF" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV
if: github.event_name == 'push'
# Trimming the ref to main in order to publish correct report
- name: Set ref/head/main to main
run: |
echo "GIT_BRANCH=main" >> $GITHUB_ENV
if: env.GIT_BRANCH == 'refs/heads/main'
# Setup Java Environment
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# Run Maven Verify to generate all jacoco reports
- name: Build with Maven
run: mvn -B verify -P all -f cccm-backend/pom.xml
# Formatting the coverage reports generated (dynamically)
- name: Format coverage reports
run: |
JACOCO_SOURCE_PATH=cccm-backend/cccm-api/src/main/java ./cc-test-reporter format-coverage cccm-backend/cccm-api/target/jacoco-report/jacoco.xml --input-type jacoco --output coverage/cccm-codeclimate.json;
# Count of all total coverage files available
- name: Debug Count files present
run: |
echo "FILE_COUNTER=$(ls -1q ./coverage | wc -l )" >> $GITHUB_ENV
#echo "::set-env name=FILE_COUNTER::$(ls -1q ./coverage | wc -l )"
# Upload JSON for debugging purposes
- name: Upload JSON for debugging purposes
uses: actions/upload-artifact@v2
with:
name: summed-java-coverage-report
path: coverage/cccm-codeclimate.json
# Upload total coverage report to Code Climate
- name: Upload coverage report to Code Climate
run: ./cc-test-reporter upload-coverage -i coverage/cccm-codeclimate.json