Skip to content

PRIME-2371 Non-BC Certification #6251

PRIME-2371 Non-BC Certification

PRIME-2371 Non-BC Certification #6251

Workflow file for this run

name: CodeClimate-Checks
on:
pull_request:
types: [opened, reopened, synchronize, closed]
branches-ignore:
- 'test'
- 'master'
workflow_dispatch:
jobs:
collect-frontend-coverage:
defaults:
run:
working-directory: ./prime-angular-frontend
if: github.ref != 'develop' || (github.ref == 'develop' && github.event.pull_request.merged == true)
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v1
- name: set-date
run: |
echo "GIT_COMMITTED_AT=$(date +%s)" >> ${GITHUB_ENV}
# - name: Cache node modules.
# uses: actions/cache@v2
# with:
# path: ~/.npm
# key: ${{ runner.os }}-node-${{ hashFiles('**/prime-angular-frontend/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-node-
- name: Node ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache-dependency-path: prime-angular-frontend/yarn.lock
- name: install yarn
run: npm install -g yarn
- uses: amancevice/setup-code-climate@v0
with:
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }}
cc_test_reporter_version: latest # optional
- run: cc-test-reporter before-build
- name: yarn and yarn run test
run: |
yarn
yarn run test
- name: Collect Frontend Report
run: |
cc-test-reporter format-coverage -t lcov -o coverage/frontend.json coverage/lcov.info
- name: Create frontend coverage file artifact
uses: actions/upload-artifact@v4
with:
name: frontend
path: ./prime-angular-frontend/coverage/frontend.json
retention-days: 1
collect-backend-coverage:
defaults:
run:
working-directory: ./prime-dotnet-webapi-tests
if: github.ref != 'develop' || (github.ref == 'develop' && github.event.pull_request.merged == true)
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['8.0']
steps:
- uses: actions/checkout@v2
- name: set-date
run: |
echo "GIT_COMMITTED_AT=$(date +%s)" >> ${GITHUB_ENV}
- name: Setup .NET Core 8.0
uses: actions/setup-dotnet@v1
with:
# Semantic version range syntax or exact version of a dotnet version
dotnet-version: '8.0'
- name: Install dependencies
run: |
cd ../
dotnet restore
- name: Install ReportGenerator
run: |
cd ../
dotnet tool install -g dotnet-reportgenerator-globaltool --version 5.3.6
- uses: amancevice/setup-code-climate@v0
with:
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }}
cc_test_reporter_version: latest # optional
- run: cc-test-reporter before-build
- name: Generate coverage report
env:
EXCLUDE: "**/Migrations/**%2c**/Models/**%2c**/Views/**%2c**/ViewModels/**%2c**/Configuration/**%2c**/DTOs/**%2c**/Helpers/**%2c**/Resources/**%2c**/**Definitions.cs"
run: |
dotnet test /p:ExcludeByFile=$EXCLUDE /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:Exclude=[xunit.*]* --filter FullyQualifiedName\!~Integration
- name: Run report generator
run: |
reportgenerator "-reports:coverage.cobertura.xml" "-targetdir:coverage" -reporttype:lcov "-filefilters:-ApiDbContextModelSnapshot.cs;" -verbosity:Error
- name: Collect Backend Report
run: |
cd ../prime-dotnet-webapi
cc-test-reporter format-coverage -t lcov -o ../prime-dotnet-webapi-tests/coverage/backend.json ../prime-dotnet-webapi-tests/coverage/lcov.info -p /home/runner/work/moh-prime/moh-prime/prime-dotnet-webapi
- name: Create backend coverage file artifact
uses: actions/upload-artifact@v4
with:
name: backend
path: ./prime-dotnet-webapi-tests/coverage/backend.json
retention-days: 1
codeclimate-sum-coverage:
needs: [ collect-frontend-coverage, collect-backend-coverage ]
if: github.ref != 'develop' || (github.ref == 'develop' && github.event.pull_request.merged == true)
runs-on: ubuntu-latest
steps:
- name: set-date
run: |
echo "GIT_COMMITTED_AT=$(date +%s)" >> ${GITHUB_ENV}
- uses: amancevice/setup-code-climate@v0
with:
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }}
cc_test_reporter_version: latest # optional
- name: Download frontend artifact
uses: actions/download-artifact@v4
with:
name: frontend
# path: frontend/
- name: Download backend artifact
uses: actions/download-artifact@v4
with:
name: backend
# path: backend/
- name: Sum files
run: |
cc-test-reporter sum-coverage -p 2 frontend.json backend.json
cc-test-reporter upload-coverage -i ./coverage/codeclimate.json
- name: Create summed report
uses: actions/upload-artifact@v4
with:
name: summed
path: ./coverage/codeclimate.json
retention-days: 1