push.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. WORKSPACE_FOLDER=$1
  2. VSCODE_FOLDER=$WORKSPACE_FOLDER/.vscode
  3. DEV_ENV=$VSCODE_FOLDER/.devenv
  4. if [ -f $DEV_ENV ]; then
  5. source $DEV_ENV
  6. else
  7. DEV_MODE='normal'
  8. fi
  9. echo "Dev mode: $DEV_MODE"
  10. if [[ 'tcr' = $DEV_MODE ]] || [[ 'tcr-hard' = $DEV_MODE ]]; then
  11. git add -u
  12. fi
  13. sfdx force:source:status
  14. sfdx force:source:push
  15. rc=$?
  16. if [[ $rc != 0 ]]; then
  17. if [[ 'tcr-hard' = $DEV_MODE ]]; then
  18. echo "Push failed - reverting"
  19. git reset --hard
  20. fi
  21. exit $rc;
  22. fi
  23. if [[ 'tdd' = $DEV_MODE ]] || [[ 'tcr' = $DEV_MODE ]] || [[ 'tcr-hard' = $DEV_MODE ]]; then
  24. # -t Test_MockServer \
  25. sfdx force:apex:test:run \
  26. --codecoverage \
  27. --resultformat human \
  28. --outputdir "$WORKSPACE_FOLDER/.sfdx/tools/testresults/apex" \
  29. --loglevel error
  30. rc=$?
  31. if [[ 'tcr' = $DEV_MODE ]] || [[ 'tcr-hard' = $DEV_MODE ]]; then
  32. if [[ $rc != 0 ]]; then
  33. echo "Tests failed - reverting"
  34. git reset --hard
  35. exit $rc;
  36. fi
  37. echo "Tests passed - committing"
  38. git commit -m '>>> TCR wip'
  39. fi
  40. fi