forked from apex-enterprise-patterns/fflib-apex-common
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standardised the build - particularly running apex and getting the co…
…de coverage numbers
- Loading branch information
1 parent
4938a08
commit e76cf0f
Showing
3 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
ORG_ALIAS="OrtooQassignScratch" | ||
|
||
if [ $# = 1 ]; then | ||
ORG_ALIAS=$1 | ||
else | ||
echo | ||
echo "Script requires one parameter" | ||
echo "1. Org Alias for created org. e.g. OrtooQassignScratch" | ||
echo | ||
exit 1 | ||
fi | ||
|
||
sfdx force:data:soql:query -u "$ORG_ALIAS" -t -q "SELECT SUM(NumLinesUncovered), SUM(NumLinesCovered) FROM ApexCodeCoverageAggregate" | grep -o -E '[0-9]+' | xargs | while read -r uncovered covered remainder ; do | ||
totallines=$(expr $covered + $uncovered) | ||
coveredtimeshundred=$(expr $covered \* 100) | ||
percentage=$(expr $coveredtimeshundred / $totallines) | ||
echo "Uncovered: $uncovered, Covered: $covered, Percentage: $percentage%" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
ORG_ALIAS="OrtooQassignScratch" | ||
|
||
if [ $# = 1 ]; then | ||
ORG_ALIAS=$1 | ||
else | ||
echo | ||
echo "Script requires one parameter" | ||
echo "1. Org Alias for created org. e.g. OrtooQassignScratch" | ||
echo | ||
exit 1 | ||
fi | ||
|
||
( set -o pipefail; SFDX_IMPROVED_CODE_COVERAGE='true' SFDX_MAX_QUERY_LIMIT=200000 sfdx force:apex:test:run -u "$ORG_ALIAS" -r human --codecoverage --wait 30 | grep -v ' Pass ' | grep -v '^[a-zA-Z0-9]\{18\}\s\s' | grep -v 'UNCOVERED' | grep -v 'Apex Code Coverage' | grep -v ' ─────── ───────────────' | grep -v '─────────────────────────────────────────────────────────────────────────────────────────────────────────────' ) |