forked from SFDO-Community/GrantGuides
-
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.
Merge pull request #37 from SFDO-Community-Sprints/wi-36-cliscript
Update dx scripts for issue #36 convert to sf cli
- Loading branch information
Showing
8 changed files
with
109 additions
and
3 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
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh | ||
|
||
########################################################################################## | ||
# | ||
# Author: Igor Androsov 2023 | ||
# | ||
########################################################################################## | ||
|
||
# Create new Scratch org environment for development testing and load test data | ||
# Set input prameter values | ||
|
||
ORG_ALIAS="$1" | ||
# Get input for ORG active days with default to 30 days | ||
ACTIVEDAYS="${2:-30}" | ||
|
||
echo "--- START DEPLOYMENT FOR: $ORG_ALIAS" | ||
echo "--- New ORG will be active for: $ACTIVEDAYS" | ||
# Set user alias from org name | ||
TESTUSER="${ORG_ALIAS}-user" | ||
|
||
# Create new scratch org 30 days max | ||
sf org create scratch --target-dev-hub labsDevHub --alias $ORG_ALIAS --definition-file config/project-scratch-def.json --set-default --duration-days $ACTIVEDAYS || { echo 'Scratch org create failed' ; exit 1; } | ||
|
||
# Create test user | ||
# sfdx force:user:create --setalias $TESTUSER --definitionfile config/user-def.json || { echo 'Scratch org User create failed' ; exit 1; } | ||
# sfdx force:user:display -u $TESTUSER | ||
|
||
# Push source | ||
echo "--- PUSH SOURCE FOR: $ORG_ALIAS" | ||
sf project deploy start --target-org $ORG_ALIAS || { echo 'Source push failed' ; exit 1; } | ||
|
||
# Assign Permission Set to users | ||
echo "--- ASSIGN PERMISSIONS FOR: $ORG_ALIAS" | ||
sf org assign permset --name GGW_User_Permissions --target-org $ORG_ALIAS || { echo 'User permission failed' ; exit 1; } | ||
|
||
# Push sample data | ||
echo "--- INSERT SAMPLE DATA FOR: $ORG_ALIAS" | ||
sf data import tree --plan test-data/export-section-GGW_Section__c-plan.json --target-org $ORG_ALIAS | ||
|
||
# sfdx force:data:tree:import --target-org $ORG_ALIAS --plan test-data/export-section-GGW_Section__c-plan.json | ||
#sfdx force:data:tree:import -u ggw --plan test-data/export-section-GGW_Section__c-plan.json | ||
# Run Tests - optional step | ||
|
||
# Open new org | ||
#sf org open --target-org $ORG_ALIAS | ||
echo "--- END DEPLOYMENT FOR: $ORG_ALIAS" |
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,23 @@ | ||
#!/bin/sh | ||
|
||
########################################################################################## | ||
# | ||
# Author: Igor Androsov 2023 | ||
# | ||
# Script to run APEX Unit Tests for project | ||
# For more details on sfdx testing refer to: | ||
# https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_testing.htm | ||
########################################################################################## | ||
|
||
# Run all unit tests on new Scratch org environment asynchronous | ||
# Set input prameter values org alias | ||
|
||
ORG_ALIAS="$1" | ||
|
||
echo "--- START UNIT TESTS FOR: $ORG_ALIAS" | ||
|
||
# Run Tests - optional step | ||
# --- DEPRECTAED CLI OPTIONS change to new version of sfdx | ||
sf apex run test --code-coverage --detailed-coverage --result-format human --target-org $ORG_ALIAS | ||
|
||
echo "--- END UNIT TESTS FOR: $ORG_ALIAS" |
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,33 @@ | ||
#!/bin/sh | ||
|
||
########################################################################################## | ||
# | ||
# Author: Igor Androsov 2023 | ||
# | ||
# IMPORTANT! Before exec this script update the QA user email address to allow password | ||
# resets. Replace placeholder value <PLACE USER EMAIL HERE> in config/user-def.json file with | ||
# correct user email. | ||
########################################################################################## | ||
|
||
# Create new QA User for Scratch org environment for testing and avlidation | ||
# Required existing scratch org set with alias | ||
# Set input prameter values | ||
|
||
ORG_ALIAS="$1" | ||
# Get input for ORG active days with default to 30 days | ||
ACTIVEDAYS="${2:-30}" | ||
|
||
echo "--- START DEPLOYMENT FOR: $ORG_ALIAS" | ||
echo "--- New ORG will be active for: $ACTIVEDAYS" | ||
# Set user alias from org name | ||
TESTUSER="${ORG_ALIAS}-user" | ||
|
||
# Create test user | ||
sf org create user --set-alias $TESTUSER --definition-file config/user-def.json --target-org $ORG_ALIAS || { echo 'Scratch org User create failed' ; exit 1; } | ||
sfdx force:user:display -u $TESTUSER | ||
|
||
# Assign Permission Set to users | ||
sf org assign permset --name GGW_User_Permissions --onbehalfof $TESTUSER --target-org $ORG_ALIAS || { echo 'User permission failed' ; exit 1; } | ||
|
||
# Open new org | ||
#sf org open -u $ORG_ALIAS |