-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Robert Sösemann
committed
Sep 8, 2020
1 parent
e7a5396
commit f7a5662
Showing
3 changed files
with
20 additions
and
46 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
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 |
---|---|---|
@@ -1,50 +1,29 @@ | ||
#!/bin/bash | ||
source `dirname $0`/config.sh | ||
|
||
holdScreen=true | ||
while getopts 'p' flag; do | ||
case "${flag}" in | ||
p) holdScreen=false ;; | ||
esac | ||
done | ||
|
||
execute() { | ||
$@ > temp.json | ||
cat temp.json | ||
$(jq '.status == 0' temp.json) || $holdScreen || exit 1 | ||
} | ||
|
||
executenpm() { | ||
$@ | ||
$(jq '.success' temp.json) || $holdScreen || exit 1 | ||
$@ || exit | ||
} | ||
|
||
if [ -z "$DEV_HUB_URL" ]; then | ||
echo "set default devhub user" | ||
execute sfdx force:config:set defaultdevhubusername=$DEV_HUB_ALIAS | ||
|
||
echo "deleting old scratch org" | ||
sfdx force:org:delete -p -u $SCRATCH_ORG_ALIAS | ||
echo "deleting old scratch org" | ||
sfdx force:org:delete -p -u $SCRATCH_ORG_ALIAS | ||
fi | ||
|
||
echo "Creating scratch ORG" | ||
sfdx force:org:create -a $SCRATCH_ORG_ALIAS -s -f ./config/project-scratch-def.json -d 1 | ||
execute sfdx force:org:create -a $SCRATCH_ORG_ALIAS -s -f ./config/project-scratch-def.json -d 30 | ||
|
||
echo "Pushing changes to scratch org" | ||
execute "sfdx force:source:push --json" | ||
execute sfdx force:source:push | ||
|
||
echo "Assigning permission" | ||
execute "sfdx force:user:permset:assign --json -n Admin" | ||
|
||
echo "Running apex tests" | ||
execute "sfdx force:apex:test:run -l RunLocalTests -w 30 --json" | ||
execute sfdx force:user:permset:assign -n PlantUml | ||
|
||
echo "Make sure Org user is english" | ||
sfdx force:data:record:update -s User -w "Name='User User'" -v "Languagelocalekey=en_US" | ||
|
||
echo "Running jest tests" | ||
npm install | ||
executenpm "npm run test:unit" | ||
|
||
rm temp.json | ||
|
||
if $holdScreen | ||
then | ||
echo "Org is set up" | ||
read | ||
fi | ||
|
||
echo "Running apex tests" | ||
execute sfdx force:apex:test:run -l RunLocalTests -w 30 |